Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: default vi-mode key bindings



Bart wrote:
> 
> I will bow to the majority opinion on this because I rarely use vi-mode
> in zsh, but I will say that I have lost more work to vim's multi-level
> undo than to practically any other catastrophe I can think of.

I can see that being a problem if you haven't learnt the key for redo
and hit undo several times before you realise what's going on.

The type of person that would affect would need to like vi-style editing
enough to use it in zsh without having ever been tempted into learning
vim. Plenty of people use vi for quick edits from the terminal but use
something else like emacs, eclipse, nedit or whatever for longer editing
sessions. I'd guess that most such people use emacs mode on zsh. It's
hard to find out for sure other than by breaking things. A quick sneak
peak in the .zshrc/.vimrc of the three vim and zsh using people who work
at the same place as me show that they have all left the default of
vi-undo-change. None have put vim in vi-compatible mode.

> This is probably because my fingers are conditioned by so many years of
> using vi before vim even existed.

Since, getting used to vim, I've found that I never use the line undo
with U anymore. Zsh doesn't support that.
 
> } The other keys are all vim bindings starting with a g prefix.
> 
> Maybe the thing to do here is to create a new keymap with vim bindings?

That might sooner lead to calls to support dozens of other editors in
that manner which is the sort of thing better handled by an oh-my-zsh
style plugin.

It also wouldn't work for some vim features like the additional special
marks and registers. vi didn't leave a lot of keys free so most extra
vim functions start with either g or z and can be unbound in one
command. Checking :help compatible, the undo is the most significant vim
behaviour difference. There's also backspacing over newlines and the
start of an insertion, some vi movements going to the start of a line
and cursors working in insert mode.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author