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

Re: vi mode and ^A



On Jul 20, 12:38pm, Bill Pemberton wrote:
} Subject: vi mode and ^A
}
} I use the vi editing mode.  In 2.5, I can use ^A and ^E (for beginning of
} line/end of line).  However, this doesn't work in 3.0.  Even if I do:
} 
} bindkey '^A' beginning-of-line
} 
} Actually, it does work 3.0, but in a less then desirable way.  If I do the
} bindkey, ^A works in insert mode only, not in command mode (it was the other
} way around in 2.5).

I don't know what was going on in 2.5, but (from zsh.info):

  Command bindings may be set using the `bindkey' builtin.  There are two
  keymaps; the main keymap and the alternate keymap.  The alternate
                                                      ^^^^^^^^^^^^^
  keymap is bound to vi command mode.  The main keymap is bound to emacs
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  mode by default.  To bind the main keymap to vi insert mode, use
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!!!!!!!!!!!
  `bindkey -v'.  However, if either of the `VISUAL' or `EDITOR'
  environment variables contains the string `vi' when the shell starts up
  the main keymap will be bound to vi insert mode by default.

So what you want is:

  bindkey -a '^A' beginning-of-line

Perhaps in 2.5 after bindkey -v, bindkey without -a put the bindings into
both the main and alternate keymaps?  Or has the meaning of "main" and
"alternate" for vi mode changed?  There's nothing in the ChangeLog ...

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"




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