vim - konradmayer/knowledge-base GitHub Wiki

search from text in buffer

from https://medium.com/usevim/vim-101-pasting-into-command-line-mode-db5946a1e8a7#:~:text=For%20example%2C%20let's%20say%20you,escape%2C%20and%20then%20%2F%20to%20search

  • In Normal mode, type "ayw to yank a word
  • Press escape, and then / to search
  • Then press CTRL-R and a to put register a

jumplist

from https://vim.fandom.com/wiki/Jumping_to_previously_visited_locations

  • Press Ctrl-O to jump back to the previous (older) location.
  • Press Ctrl-I (same as Tab) to jump forward to the next (newer) location.

Display the jump list for the current window with:

:jumps

great in combination with gf (go to file) and gd (go to definition)

change word at multiple positions

https://vim.fandom.com/wiki/Repeat_last_change

Type yiw to copy the current word. Move the cursor to a new location, then type ciw<C-R>0<Esc> to change the word, replacing it with the copied text. After moving the cursor to a new location, press . to repeat the operation (the current word will be replaced with the word that was originally copied

from https://unix.stackexchange.com/a/332145: instead of ciw this can also be applied to next search with cgn instead.

wrap line at textwidth (i.e. 80 characters by default)

gq + Enter

VSCODE specific vim

use search in explorer

https://www.stephenlewis.me/notes/search-vscode-explorer/

⚠️ **GitHub.com Fallback** ⚠️