Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: end-of-line behavior with vi mode

51 views
Skip to first unread message

Chet Ramey

unread,
Apr 29, 2005, 4:17:58 PM4/29/05
to sha...@unix.stortek.com, bug-...@gnu.org, ch...@po.cwru.edu
> When in emacs mode, if I execute a line-up (via a line-up or ctrl-p) to
> the previous history item, the cursor is set to the end-of-the-line.
> If I set vi mode, and execute an up-arrow, the cursor is still and
> end-of-line. However, if I use a escape-k (line-up in vi), the cursor
> goes to the start of the line. Is there some configuration item that
> allows the line-up to work the same in all cases? I like the line-up
> to go to the end of the line, as that is typically closer to the typo
> in the command line.

All of these commands are bound to the same readline function. That
function behaves differently depending on the editing mode.

The default (emacs) mode behavior is to set point at the end of the line.

POSIX.2 defines the behavior of vi mode. The `k' command in vi `command
mode' (what you enter by hitting ESC) is defined to put point at the
beginning of the line. The up-arrow is equivalent to `k' when in vi
command mode.

Since POSIX.2 doesn't define the behavior of the arrow keys when in insert
mode, readline makes them behave as they do in emacs mode.

This behavior is more or less hardcoded into readline and not changeable
by any variable or keybinding.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU ch...@case.edu http://tiswww.tis.cwru.edu/~chet/


0 new messages