In most text editors, I can select text by clicking and dragging with my mouse, and then using Ctrl-C
to copy that text, or Backspace
to delete it.
However, since vim
runs in the console, if I highlight some text with the mouse, my vim
commands don't affect what I have selected.
What is the equivalent way to select text in vim
?
In vim
, text is selected by entering Visual mode. This can be done in multiple ways.
:set mouse=a
.Once you have selected the text you want, you can use all sorts of commands on them. Some of the more useful ones are:
You can learn more about Visual mode by typing :help v
while inside vim
.