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

Re: End of line instead of beginning of line



Tommi Airikka <airikka@xxxxxxxxx>:
> In vi-mode, is there any way to get the cursor directly to the end of
> the line (insert mode) when pressing the up arrow for history, just by
> changing in my local .zshrc?
> It's really annoying that it defaults to the beginning of the line.
> 
> I'm using zsh 4.3.6 in a urxvt.

My guess is, that you're on debian or something that uses its zsh
package.

The global debian zshrc (/etc/zsh/zshrc) binds up and down to vi-*
wigdets in vi mode, like this:

[snip]
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
[[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history

# [...] and fixups for ncurses' application mode:
[[ "$terminfo[kcuu1]" == ""* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history
[[ "$terminfo[kcud1]" == ""* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history
[snap]

That is not the default, but possibly closer to the original vi.
Just bind those keys back to the corresponding emacs widgets
(up-line-or-history and down-line-or-history) to get what I think you
want.

Regards, Frank



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