ZeroKnight / dotfiles

Just my dotfiles and other various configs. Nothing to see here.
3 stars 0 forks source link

Use nvim 0.7 `vim.keymap` API instead of custom `zeroknight.util.key` #30

Closed ZeroKnight closed 2 years ago

ZeroKnight commented 2 years ago

One of the new features in 0.7 is the addition of the vim.keymap API (see 16591), which provides a nicer interface than the lower level nvim_(buf_)set_keymap function. Notably, this API takes advantage of being able to pass arbitrary Lua functions to mappings which was added somewhat recently; now I don't need to hack this in myself. It also supports mapping multiple modes at once and defaults to applying nvim_replace_termcodes which is great.

Other than having the short "sugar" methods like key.nnoremap there's not really any reason to keep these around now, especially when we can map multiple modes at once; the new API completely obviates the need for util.key.