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

Re: vi command line editing

Quoting Andrew Main (zefram@xxxxxxxxx):
> Stephen Marley wrote:
> >How can I get vi command line editing to start in command mode rather
> >than insert mode after moving in the history with the arrow keys?  I am
> >using 3.0.5. 
> Use the arrow keys while in command mode.

I really want to avoid having to remember to type <ESC> before issuing
some vi commands. This causes me enormous grief after years of using zsh
as I'm never sure which mode I'm in so I find myself typing 'B' or 'cw'
or 'i' when I'm in already in insert mode. It does my head in!

You see, my fingers are tuned to using the older vi's (eg SunOS's) where
movement using the arrow keys doesn't work in insert mode. To stop
spurious A's and D's (from the arrow keys escape sequences) appearing in
my text I have always map!ed the arrow keys to <esc>l or <esc>k etc so
that they take me into command mode and then move. 

Even now that I use Vim 5 I still keep these mappings because I am so
used to being in command mode after moving with the arrow keys however
there seems to be no way to make zsh behave like this.

My current bindings for the arrow keys are:

"^[[A"  history-search-backward
"^[[B"  history-search-forward
"^[[C"  forward-char
"^[[D"  backward-char

So I what I would really like, for example, is that my first typed up
arrow takes me into command mode and then does history-search-backward
regardless of my current mode. Is there any way to achieve this?


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