Skip to content

Conversation

dbarnett
Copy link
Contributor

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.

@dbarnett dbarnett requested a review from malcolmr March 23, 2020 19:37
Copy link
Member

@malcolmr malcolmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry for the long delay!

" does one thing immediately and then a different follow-up behavior on another
" keystroke.
"
" For example, this defines a mapping that immediately unfolds one level but
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really surprised that this works, but we have tests, so sgtm!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, actually it looks like I had a typo in the args there I just fixed.

@dbarnett
Copy link
Contributor Author

dbarnett commented Nov 8, 2020

I'd held off on merging this PR for a while because

  1. 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
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement #mapping#MapUntilTimeout

3 participants