zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

due to many collisions introduce turn on/off switch

Open ngmariusz opened this issue 4 years ago • 8 comments

we should have this switch

ecosystem is like:

bindkey -M emacs '\eOQ\eOQ' one-wiget-from-.oh-my-zsh
bindkey -M vicmd '\eOQ\eOQ' one-wiget-from-.oh-my-zsh
bindkey -M viins '\eOQ\eOQ' one-wiget-from-.oh-my-zsh 

do now i have to create bindings for all my widgets like?

zvm_bindkey vicmd '\eOQ\eOQ' one-wiget-from-.oh-my-zsh
zvm_bindkey viins '\eOQ\eOQ' one-wiget-from-.oh-my-zsh 

ngmariusz avatar Feb 17 '21 02:02 ngmariusz

Hi @ngmariusz

Thanks for your good question. Exactly, you are right, it is better to use the zvm_bindkey to bind your widgets to avoid some unnecessary problems. Also, you should do the keybindings at the right stage (See here).

Especially, if the lazy keybindings feature is enabled, all the keybindings for vicmd and visual should be bound in zvm_after_lazy_keybindings_commands.

Thanks and regards

jeffreytse avatar Feb 17 '21 02:02 jeffreytse

in case anybody struggles

  • will give you a list of existing keymap names.
bindkey -l
  • will list all the bindings in a given keymap.
bindkey -M <keymap>
  • to check your key press combination signal just go
cat

when cat is active press your keys

  • i still have problem with multikey action @jeffreytse here i'm trying double hit f2; any sugestions? (no problem with 'signle key combnation')
zvm_bindkey viins '\eOQ\eOQ' one-wiget-from-.oh-my-zsh 

@jeffreytse also thankyou for your work; much appreciated

ngmariusz avatar Feb 17 '21 08:02 ngmariusz

Hi @ngmariusz

Thanks for your tips to other users who also struggles in the issue. Currently zsh's bindkey doesn't support to bind multiple control keys (i.e. Function keys F1-F12 and Command keys Ctrl-<KEY>), so the following example is invalid.

bindkey -M viins '^[OQ^[OQ' your_custom_widget   # bind to <F2><F2>
bindkey -M viins '^E^E' your_custom_widget       # bind to <Ctrl-E><Ctrl-E>
bindkey -M vicmd '^[OQ^[OQ' your_custom_widget   # bind to <F2><F2>
bindkey -M vicmd '^E^E' your_custom_widget       # bind to <Ctrl-E><Ctrl-E>

So I suggest you trying to bind to other key sequences.

Thanks and regards

jeffreytse avatar Feb 17 '21 09:02 jeffreytse

Thank you.

Let me clarify

I'd like to bind double key press to execute my widget

  • this works fine when zsh-vi-mode is NOT active
bindkey -M '^[OQ^[OQ' your_custom_widget   # bind to <F2><F2> 
  • this does not work when zsh-vi-mode is active
zvm_bindkey vicmd '^[OQ^[OQ' your_custom_widget   # bind to <F2><F2> 

it registers only first press

  • it works when zsh-vi-mode is active
zvm_bindkey vicmd '^[OQ' your_custom_widget   # bind to <F2> 

but it's not a goal; <f2><f2> it's just example; it should work with any pair

  • this also doesn't work; (sort of)
bindkey -M vicmd '^[OQ^[OQ' your_custom_widget   # bind to <F2><F2> 

my guess is timing - somehow when zsh-vi-mode is active it changes how long it waits til next key press - but i can't figure it out and it make it unusable; i see it activating my widget when holding key and keyboard repeating activates but it's not good enough; @jeffreytse

ngmariusz avatar Feb 18 '21 04:02 ngmariusz

Hi @ngmariusz

I will have a further checking about this issue, any information I will upadte you.

Thanks and regards

jeffreytse avatar Feb 18 '21 04:02 jeffreytse

Hi @ngmariusz

Thanks for your patience and this issue has been addressed and fixed on #34 by this commit 8b16025. Welcome to update your plugin to the latest version.

Thanks and regards

jeffreytse avatar Mar 04 '21 06:03 jeffreytse

Hi @ngmariusz

Thanks for the reporting and patience, this issue has been totally settled down on this commit b9232fb, please update your plugin to the latest version.

Thanks and regards

jeffreytse avatar Mar 11 '21 04:03 jeffreytse

Hi @ngmariusz , is this issue settled down? welcome back to have a further discussion with me. : )

jeffreytse avatar Apr 02 '21 11:04 jeffreytse