If you're typing a command in Vim (I mean you've started with :
and you're working in the bar at the bottom of the screen) is there a way to move the cursor around other than tapping the arrow keys? In particular, can you move it to the beginning, end, back n characters, or back one word?
views:
148answers:
3
+6
A:
Type
:h cmdline-editing
for details. I am listing a few of the interesting non-arrow commands that do something similar to what you want.
ctrl-B
: cursor to beginning of command-linectrl-E
: cursor to end of command-linectrl-W
: delete the word before the cursorctrl-U
: remove all characters between the cursor position and the beginning of the line
Alok
2010-01-16 00:14:36
Thanks, that's great. I searched through that help doc and I'm not seeing a way to move back and forth by word. Do you know if that's available?
Ethan
2010-01-16 00:23:54
The documentation says that shift+left and shift+right are used to move back and forward a word. It also has an example of how to bind `<Esc>b` to shift+left (and so on) in commandline mode: `:cnoremap <Esc>b <S-Left>`
Alok
2010-01-16 01:14:59
That key mapping looks aweful lot like Emacs :)
jeffjose
2010-01-28 13:11:01
+2
A:
Tap Ctrl+F while in command-line mode (just after :
). There you'll get command-line window which could be edited&navigated as a regular vim window (hjkl etc.).
See :h cmdline-window
for details.
Maxim Kim
2010-01-16 17:11:30
+2
A:
To add to Maxim Kim's Answer,
In the Normal Mode
..
q:
-> cmdline window for commands
q/
-> cmdline window for search forward
q?
-> cmdline window for search backward
Ctrl-C
or <CR>
will take you out of cmdline-window
jeffjose
2010-01-16 18:39:21