4

In vim command mode, while i am typing a really long search and replace command, how do i go to the beginning of the line?

Ctrl+e and Ctrl+w are working. But when i press Ctrl+a it just prints ^A.

Is there any other way to jump to the beginning of the line?

2
  • It's the same as in pretty much every text input widget in every program written with every UI toolkit on every platform: <Home>.
    – romainl
    Commented Oct 21, 2015 at 20:38
  • 1
    i dont have <Home> on my laptop keyboard.
    – woodstok
    Commented Oct 21, 2015 at 21:56

2 Answers 2

10

Ctrl-b or Home will jump the cursor to the beginning of the line in command-line mode.

See :help c_Home.

Adding

cnoremap <C-A> <Home>

to your .vimrc will let you use Ctrl-a.

3

You could try these mappings, taken from the longer list of tcsh-style key bindings documented in :help tcsh-style:

:cnoremap <C-A> <Home>
:cnoremap <C-F> <Right>
:cnoremap <C-B> <Left>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .