-- TODO: Should transition this to be an easier mapping function -- Would love to make this more declarative / easier to use from lua, cause it's a pain to write this local mappings = {} function mappings.set() local initial_mappings = { ['['] = 'update_view(-1)', [']'] = 'update_view(1)', [''] = 'open_file()', h = 'update_view(-1)', l = 'update_view(1)', q = 'close_window()', k = 'move_cursor()' } for k,v in pairs(initial_mappings) do api.nvim_buf_set_keymap(buf, 'n', k, ':lua require"whid".'..v..'', { nowait = true, noremap = true, silent = true }) end local other_chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' } for k,v in ipairs(other_chars) do api.nvim_buf_set_keymap(buf, 'n', v, '', { nowait = true, noremap = true, silent = true }) api.nvim_buf_set_keymap(buf, 'n', v:upper(), '', { nowait = true, noremap = true, silent = true }) api.nvim_buf_set_keymap(buf, 'n', '', '', { nowait = true, noremap = true, silent = true }) end end return mappings