Add which-key safeguard

This commit is contained in:
Amanda Graven 2022-06-17 09:54:49 +02:00
parent da04b67bd4
commit bba7ad4bc1
Signed by: amanda
GPG key ID: F747582C5608F4CB

View file

@ -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')