The standard CTRL-E works to go to the end of the line but CTRL-A doesn't seem to work to go to the beginnig.

It would obviously be useful to quickly go to the beginning of line for example if one wanted to replace w /path/to/file in with w! /path/to/file.

Is there a key to go to the beginning of the line in command mode and if so how does one map it to CTRL-A?

1 Answer 1


You can use <C-b> to go to the beginning of the line; from :help c_CTRL-B:

CTRL-B or <Home>                                c_CTRL-B c_<Home> c_Home
                cursor to beginning of command-line

If you want, you can use this to map it to <C-a>:

:cnoremap <C-a> <C-b>

Related: How can I use Readline shortcuts in the vim command line?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.