But Zsh does have a visual mode! Don’t rebind v to something else. Pick something else: I use ‘^X^E’.
I’ve seen this bind v to edit-command-line advice before, probably because oh-my-zsh does it. I can only guess that the existence of visual mode simply isn’t obvious because by default it is highlighted in a manner that is indistinguishable from the cursor. My advice is to pick something more obvious and set it in zle_hightlight. Note that much of the zsh documentation talks about the “region” which is emacs terminology.
Does Zsh have a visual mode? If so it’s not on by default, or at least by default it’s not mapped to v in command mode. I also could not find any documentation on Zshell visual mode. Can you provide links to any documentation or articles on this? Closest thing I found was a Zshell plugin that implemented this behavior (https://github.com/b4b4r07/zsh-vimode-visual).
Go to http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html or type man zshzle and search for the word “visual”. There are several references. The feature was added three years ago. In general for vi-mode I would recommend using at least 5.0.8 and preferably 5.1 or newer as a lot of vi/vim related improvements were made around the time of those releases. To verify, run zsh -f and try bindkey -a v and you should find v is bound to visual-mode. There’s also visual-line-mode for V and a visual keymap.
I don’t personally use it, but one of our regular contributors has submitted multiple improvements and if you have any other ideas, we’d love to hear them!
Thanks! I’ll comb through it and see if I can find any other gems. I’m still pretty new to Vi mode so this blog posts pretty much sums up what I’ve learned so far.
But Zsh does have a visual mode! Don’t rebind v to something else. Pick something else: I use ‘^X^E’.
I’ve seen this bind v to edit-command-line advice before, probably because oh-my-zsh does it. I can only guess that the existence of visual mode simply isn’t obvious because by default it is highlighted in a manner that is indistinguishable from the cursor. My advice is to pick something more obvious and set it in zle_hightlight. Note that much of the zsh documentation talks about the “region” which is emacs terminology.
Does Zsh have a visual mode? If so it’s not on by default, or at least by default it’s not mapped to
vin command mode. I also could not find any documentation on Zshell visual mode. Can you provide links to any documentation or articles on this? Closest thing I found was a Zshell plugin that implemented this behavior (https://github.com/b4b4r07/zsh-vimode-visual).Go to http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html or type
man zshzleand search for the word “visual”. There are several references. The feature was added three years ago. In general for vi-mode I would recommend using at least 5.0.8 and preferably 5.1 or newer as a lot of vi/vim related improvements were made around the time of those releases. To verify, runzsh -fand trybindkey -a vand you should findvis bound tovisual-mode. There’s alsovisual-line-modeforVand avisualkeymap.Wow! How did I miss that?! That’s really nice, and much faster than opening Vim. I will remove my custom mapping and update the blog post accordingly.
It looks like you’re using oh-my-zsh. The vi plugin seems to remap
v: https://github.com/robbyrussell/oh-my-zsh/blob/3705d47bb3f3229234cba992320eadc97a221caf/plugins/vi-mode/vi-mode.plugin.zsh#L20I actually decided against using that vi plugin for some other reasons, so at least in theory
vshould be mapped to the default command.We’ve got a few additional hacks in prezto you might be interested in: https://github.com/sorin-ionescu/prezto/blob/master/modules/editor/init.zsh
I don’t personally use it, but one of our regular contributors has submitted multiple improvements and if you have any other ideas, we’d love to hear them!
Thanks! I’ll comb through it and see if I can find any other gems. I’m still pretty new to Vi mode so this blog posts pretty much sums up what I’ve learned so far.