Is modal editing possible in command-line mode?
Some examples:
!ls ~/foo/bar
I want to db
to delete bar ls
to mv
and jump back to $Use ctrl-w N to switch to "terminal-normal mode", which will let you navigate around.
Normal mode is where one should spend most of their time while using Vim. Remember, this is what makes Vim different. In normal mode, there are multiple ways to move around an open file. In addition to using the cursor keys to move around, you can use h (left), j (down), k (up), and l (right) to move as well.
You can use ^ or 0 (Zero) in normal mode to move to the beginning of a line. You can also use Shift i to move and switch to Insert mode.
Type i to switch into insert mode so that you can start editing the file. Enter or modify the text with your file. Once you're done, press the escape key Esc to get out of insert mode and back to command mode.
By default you can press Control + f
(or otherwise see set cedit
) when on the Vim command-line, which opens the command-line window where you can edit the command using normal-mode Vim editing keys. Enter
will run the command or Control + c
will return you to the standard command-line.
So in your specific example, you could press Control + f
on the Vim command-line then db
and it would do what you want.
When I have to do more sophisticated editing commands I use the above approach because I'm more familiar with Vim editing keys than I am with the alternatives. I also find the normal-mode vim keys more powerful.
See :help c_ctrl-f
for more information.
in vim's command line mode: <ctrl-w>
deletes a word
in normal mode: q:
goes to the command history (which can be edited with vim commands)
see :help cmdline-editing
and :help cmdline-window
for more commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With