Selecting text in vim in a terminal window without mouse support may be a bit difficult if it’s not something like 3 words or 2 lines. Visual mode to the rescue! With visual mode your selection is not only highlighted, but you can also select arbitrary parts of the text file.
- go to the start of your selection
- type v
- move to the end of the selection with the usual motion commands
- type the command you want to perform on the selected text (like y for yank, d for delete, etc.)
There are three different selection modes:
v | start visual selection in character mode |
V | start visual selection in line mode |
CTRL-v | start visual selection in block mode |