bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: end-of-line behavior with vi mode


From: Chet Ramey
Subject: Re: end-of-line behavior with vi mode
Date: Fri, 29 Apr 2005 16:17:58 -0400

> 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    chet@case.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]