Just learn about VIM's visual mode today.
Visual mode can be useful for manipulate chunks of text. It has 3 modes: character, line and block.
- character mode : v [lowercase]
- line mode: V [uppercase]
- block mode: ctrl+v
Character Mode
- Press <v> to activate visual character mode. [VISUAL]
- Use <arrow key> to highlight the desired text.
- Press <d> to delete the text.
- Press <u> to undo.
- Press <p> to paste the text.
- Press <c> to change the text. [INSERT]
Line Mode
- Press <shirt-v> (or capital V) to enter line mode. [VISUAL LINE]
- Use <arrow key> to highlight multiple lines.
- Press <d> to delete those lines.
- Press <y> to yank those lines.
- Press > to increase the indentation of those lines.
- Press < to decrease the indentation of those lines.
Block Mode
- Useful for manipulation of specific tabular data.
- Press <ctrl-v> to enter visual block mode. [VISUAL BLOCK]
- Use <arrow key> to highlight the single character column and verify the indentation
Links:
- https://www.freecodecamp.org/news/vim-editor-modes-explained/