Wednesday, February 16, 2011

Re: How to move to beginning of command line

On Wed, Feb 16, 2011 at 01:04:15PM EST, Jeremy wrote:

> When typing a command, (i.e., su/.../.../) how can I jump around on the
> command line without using the arrow keys. That is, how can I jump to the
> beginning, or the end, or move backward/forward? In a terminal, I can just
> use the CTRL-A and CTRL-E to go to the beginning and end of the command. Is
> there something similar in Vim?

These mappings emulate the key combos I use most frequently in
bash/readline's emacs mode::

cnoremap <C-O> <C-D>
cnoremap <C-D> <Del>
cnoremap <C-A> <Home>
cnoremap <C-B> <Left>
cnoremap <C-E> <End>
cnoremap <C-F> <Right>
cnoremap <C-N> <Down>
cnoremap <C-P> <Up>
cnoremap <Esc>b <S-Left>
cnoremap <Esc>f <S-Right>

In order to make CTRL-D reproduce bash's behavior (delete the character
before the cursor), I first had to remap it to CTRL-O so that the
original functionality (pattern matching) remains available.

I use pattern matching extensively to find what I'm looking for in Vim's
help system and I find it much more practical than 'wildmenu'.

cj

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: