vim-maktaba
vim-maktaba copied to clipboard
Implement keymapping helpers
Implements maktaba helpers for programmatically managing vim key mappings (as in the :map command) in maktaba#keymapping# and maktaba#keymappingspec#.
Usage examples:
call maktaba#keymapping#Map(',=b', ':FormatCode<CR>', 'n')
call maktaba#keymappingspec#Spec(',=b', ':FormatCode<CR>', 'n')
\.WithArgs(['<silent>', <buffer>']).Map()
See keymapping.vroom and :help maktaba.KeyMapping for details.
Resolves #221.
I'd held off on merging this PR for a while because
- The "full" implementation was surprisingly complex (vs. the simpler hack I originally found https://github.com/dbarnett/dotfiles/blob/8c9dc859db/.vimrc#L310) and I was hoping to find ways to reduce the scope a bit, and
- I'd seen a few quirks in the meantime while trying it out that I was hoping to troubleshoot further.
I'm still looking into those, but went ahead and submitted some fixes and resolved review comments while I'm looking at it.