mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-09-19 16:03:06 +02:00
Update: which-key pop-up closes by space/leader
This commit is contained in:
25
init.lua
25
init.lua
@@ -49,7 +49,30 @@ end
|
||||
|
||||
require('lazy').setup({
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
{ 'folke/which-key.nvim', event = 'VeryLazy', opts = {} },
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
spec = {
|
||||
{ '<leader>q', group = 'Quit' },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local wk = require 'which-key'
|
||||
wk.setup(opts)
|
||||
-- Patch which-key's getchar so <Space> acts as a close key,
|
||||
-- since <Esc> is the only hardcoded one and isn't configurable
|
||||
local state = require 'which-key.state'
|
||||
local orig_getchar = state.getchar
|
||||
state.getchar = function()
|
||||
local ok, char = orig_getchar()
|
||||
if ok and char == ' ' then
|
||||
char = vim.api.nvim_replace_termcodes('<Esc>', true, false, true)
|
||||
end
|
||||
return ok, char
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git related plugins
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ return {
|
||||
keys = {
|
||||
{ '<leader>sf', desc = '[S]earch [F]iles' },
|
||||
{ '<leader>?', desc = '[?] Find recently opened files' },
|
||||
{ '<leader><leader>', desc = 'Switch to Open Buffers' },
|
||||
{ '<leader>m', desc = 'Switch to Open Buffers' },
|
||||
{ '<leader>/', desc = '[/] Fuzzily search in current buffer' },
|
||||
{ '<leader>s/', desc = '[S]earch [/] in Open Files' },
|
||||
{ '<leader>ss', desc = '[S]earch [S]elect Telescope' },
|
||||
@@ -225,7 +225,7 @@ return {
|
||||
end, { desc = '[?] Find recently opened files' })
|
||||
|
||||
-- Current buffers for Telescope (switch to already open buffer)
|
||||
vim.keymap.set('n', '<leader><leader>', function()
|
||||
vim.keymap.set('n', '<leader>m', function()
|
||||
require('telescope.builtin').buffers {
|
||||
attach_mappings = function(_, map)
|
||||
map('n', 'q', actions.close)
|
||||
@@ -301,7 +301,14 @@ return {
|
||||
end
|
||||
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>ss', function()
|
||||
require('telescope.builtin').builtin {
|
||||
attach_mappings = function(_, map)
|
||||
map('n', 'q', actions.close)
|
||||
return true
|
||||
end,
|
||||
}
|
||||
end, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>gf', function()
|
||||
local is_git_dir = vim.fn.system('git rev-parse --is-inside-work-tree'):gsub('%s+', '') == 'true'
|
||||
if not is_git_dir then
|
||||
|
||||
Reference in New Issue
Block a user