for _,keys in ipairs{'jj', 'jJ', 'Jj', 'JJ', 'jk', 'jK', 'Jk', 'JK'} do vim.api.nvim_set_keymap('i', keys, '', {}) end local m = { s = {silent = true}, n = {noremap = true}, sn = {silent = true, noremap = true}, } local keymap = { n = { ['r'] = {':luafile ' .. vim.g.vimdir .. '/init.lua:echo \'Reloaded init.lua\'', m.s}, ['gv'] = {':e ' .. vim.g.vimdir .. '/init.lua', m.s}, ['w'] = {':bd', m.s}, ['h'] = {':b#', m.s}, ['k'] = {':bnext', m.s}, ['j'] = {':bprevious', m.s}, ['m'] = {':lua print()', m.s}, ['/'] = {':let @/ = "":', m.s}, [''] = ':qa', [''] = 'Telescope git_files', [''] = 'Telescope live_grep', [''] = 'Telescope buffers', ['t'] = 'Telescope help_tags', [''] = ':TmuxNavigateLeft', [''] = ':TmuxNavigateDown', [''] = ':TmuxNavigateUp', [''] = ':TmuxNavigateRight', [' n'] = "'Nn'[v:searchforward]", [' N'] = "'nN'[v:searchforward]", }, t = {}, [''] = { [''] = {'', m.sn}, [''] = 'mw:%s/\\s\\+$//:let @/ = ""\'w', [''] = ':setlocal spell!', [',w'] = {'CamelCaseMotion_w', m.s}, [',b'] = {'CamelCaseMotion_b', m.s}, [',e'] = {'CamelCaseMotion_e', m.s}, [',ge'] = {'CamelCaseMotion_ge', m.s}, }, o = { ['ib'] = {'CamelCaseMotion_ib', m.s}, ['ie'] = {'CamelCaseMotion_ie', m.s}, }, x = { ['<'] = ''] = '>gv', ['ib'] = {'CamelCaseMotion_ib', m.s}, ['ie'] = {'CamelCaseMotion_ie', m.s}, }, c = { [''] = '', [''] = '', }, i = { [''] = '', [''] = {'(completion_trigger)', m.s}, }, } for mode,mappings in pairs(keymap) do for key,bind in pairs(mappings) do if type(bind) == 'table' then vim.api.nvim_set_keymap(mode, key, bind[1], bind[2]) else vim.api.nvim_set_keymap(mode, key, bind, {}) end end end