6

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?

7

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?

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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