Add which-key safeguard
This commit is contained in:
parent
da04b67bd4
commit
bba7ad4bc1
20
init.lua
20
init.lua
|
@ -75,14 +75,20 @@ if fn.executable('rg') then
|
|||
end
|
||||
|
||||
-- Convenience keybindings
|
||||
require'which-key'.register{['<C-w>!'] = {'<Cmd>copen<CR>', 'Quickfix window'}}
|
||||
require'which-key'.register{['<F2>'] = {'<Cmd>set number! relativenumber!<CR>', 'Toggle relative numbers'}}
|
||||
require'which-key'.register{['<F3>'] = {'<Cmd>set number!<CR>', 'Toggle line numbers'}}
|
||||
do
|
||||
-- which-key might not be available yet
|
||||
local ok, which_key = pcall(require, 'which-key')
|
||||
if ok then
|
||||
which_key.register{['<C-w>!'] = {'<Cmd>copen<CR>', 'Quickfix window'}}
|
||||
which_key.register{['<F2>'] = {'<Cmd>set number! relativenumber!<CR>', 'Toggle relative numbers'}}
|
||||
which_key.register{['<F3>'] = {'<Cmd>set number!<CR>', 'Toggle line numbers'}}
|
||||
|
||||
require'which-key'.register{['<A-h>'] = {'<C-w>h', 'Go to the left window'}}
|
||||
require'which-key'.register{['<A-l>'] = {'<C-w>l', 'Go to the right window'}}
|
||||
require'which-key'.register{['<A-n>'] = {'<C-w>n', 'Go to the up window'}}
|
||||
require'which-key'.register{['<A-e>'] = {'<C-w>e', 'Go to the down window'}}
|
||||
which_key.register{['<A-h>'] = {'<C-w>h', 'Go to the left window'}}
|
||||
which_key.register{['<A-l>'] = {'<C-w>l', 'Go to the right window'}}
|
||||
which_key.register{['<A-n>'] = {'<C-w>n', 'Go to the up window'}}
|
||||
which_key.register{['<A-e>'] = {'<C-w>e', 'Go to the down window'}}
|
||||
end
|
||||
end
|
||||
|
||||
-- Do workman remappings
|
||||
noremap('', 'n', 'gj')
|
||||
|
|
Loading…
Reference in a new issue