kutsan / zsh-system-clipboard

System clipboard key bindings for Zsh Line Editor with vi mode. It is similar to what `set clipboard=unnamed` does for vim.
GNU General Public License v3.0
149 stars 16 forks source link

Automatically rebind keys after current settings #9

Closed doronbehar closed 6 years ago

doronbehar commented 6 years ago

Parse the output of bindkey -M vicmd and bindkey -M visual in order to rebind the current already set keys to their new functionality. No need to explicitly setopt vi since we assume it is set by most users. Documentation should be added in order to indicate that currently the emacs keymap isn't supported. Plus, to quote zsh's documentation on setopt vi:

VI If ZLE is loaded, turning on this option has the equivalent effect of 'bindkey -v'. In addition, the EMACS option is unset. Turning it off has no effect. The option setting is not guaranteed to reflect the current keymap. This option is provided for compatibility; bindkey is the recommended interface.

Renaming the functions seems reasonable since we don't bind keys according to their name but according to their already binded functions.

kutsan commented 6 years ago

First of all, a HUGE thanks. I like your suggestions, I like this PR as well. I'm quite busy in real life nowadays with some very special things. So, I don't have access to my computer right now to test it locally, but I'm going to merge it anyway.

Renaming the functions seems reasonable since we don't bind keys according to their name but according to their already binded functions.

Yeah, you are right. Naming like key-? was a bad idea. I only did that to make them foreach-able easily.

Documentation should be added in order to indicate that currently the emacs keymap isn't supported. Plus, to quote zsh's documentation on setopt vi:

That's a TODO for me.