my configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
470 B

  1. local utils = {}
  2. utils.map = function (key)
  3. -- get the extra options
  4. local opts = { noremap=true, silent=true }
  5. for i, v in pairs(key) do
  6. if type(i) == 'string' then opts[i] = v end
  7. end
  8. -- basic support for buffer-scoped keybindings
  9. local buffer = opts.buffer
  10. opts.buffer = nil
  11. if buffer then
  12. vim.api.nvim_buf_set_keymap(0, key[1], key[2], key[3], opts)
  13. else
  14. vim.api.nvim_set_keymap(key[1], key[2], key[3], opts)
  15. end
  16. end
  17. return utils