diff --git a/init.lua b/init.lua index b7778f0..6ed6827 100644 --- a/init.lua +++ b/init.lua @@ -75,14 +75,20 @@ if fn.executable('rg') then end -- Convenience keybindings -require'which-key'.register{['!'] = {'copen', 'Quickfix window'}} -require'which-key'.register{[''] = {'set number! relativenumber!', 'Toggle relative numbers'}} -require'which-key'.register{[''] = {'set number!', '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{['!'] = {'copen', 'Quickfix window'}} + which_key.register{[''] = {'set number! relativenumber!', 'Toggle relative numbers'}} + which_key.register{[''] = {'set number!', 'Toggle line numbers'}} -require'which-key'.register{[''] = {'h', 'Go to the left window'}} -require'which-key'.register{[''] = {'l', 'Go to the right window'}} -require'which-key'.register{[''] = {'n', 'Go to the up window'}} -require'which-key'.register{[''] = {'e', 'Go to the down window'}} + which_key.register{[''] = {'h', 'Go to the left window'}} + which_key.register{[''] = {'l', 'Go to the right window'}} + which_key.register{[''] = {'n', 'Go to the up window'}} + which_key.register{[''] = {'e', 'Go to the down window'}} + end +end -- Do workman remappings noremap('', 'n', 'gj')