2026-01-05
Inserting/appending the same string in a bunch of lines:
I find that I need to append multiple > when I am using callout boxes in markdown, when I paste text inside a callout box and the text has blank lines in it. This causes part of the pasted text to ‘jump out’ of the callout box and I have to manually add the > (single or multiple) to put the pasted text back in the callout box.
Vim definitely makes it easy with normal i command:
Prefix a bunch of lines with >> (Visual-line + :normal I)
- Put cursor on the first line you want to indent
- Enter Visual line mode:
V - Select down to the last line you want inside the callout (use
j,}for paragraph hops, or search for a boundary and jump). - Run:
:'<,'>normal I>>
That inserts >> at the start of every selected line.
2025-12-23
Find and replace all the instances of a string in multiple lines
(Source - Stack exchange)
Replace All:
:%s/foo/bar/g
Find each occurrence of ‘foo’ (in all lines), and replace it with ‘bar’.
For specific lines:
:6,10s/foo/bar/g
Change each ‘foo’ to ‘bar’ for all lines from line 6 to line 10 inclusive.
2025-02-03
neovim intro doc:
Clipping of neovim intro doc from neovim website. Goes over the very basic definitions, notations etc.
2024-09-03
- https://www.vimgolf.com/
- Vim Cheat sheet: https://www.barbarianmeetscoding.com/boost-your-coding-fu-with-vscode-and-vim/cheatsheet
Basics
movement in a line
Basic Movement
0- Jump to the start of the line.^- Move to the first non-blank character in the line.$- Move to the end of the line.g_- Move to the last non-blank character in the line.
Word Movements
w- Jump forward to the beginning of the next word.e- Jump forward to the end of the current/next word.b- Jump backward to the beginning of the previous word.ge- Jump backward to the end of the previous word.
Inner Word Movements (CamelCase/underscores)
W/B- Move by “big words” (words separated by spaces).iw- Select the word under the cursor.ciw- Change the word under the cursor.diw- Delete the word under the cursor.
Character Movements
f<char>- Jump forward to a specific character in the line.t<char>- Jump forward to just before a specific character.F<char>- Jump backward to a specific character.T<char>- Jump backward to just after a specific character.;and,- Repeat the lastf,t,F, orTsearch forward or backward, respectively.
Quick Jumps and Editing
0f<char>- Combine0withf<char>to jump to the first occurrence of a character in a line.A- Jump to the end of the line in insert mode.I- Jump to the first non-blank character and enter insert mode.
Undo and Redo
u- Undo the last change.Ctrl + r- Redo the last undone change.
Miscellaneous Tips
g;andg,- Move between recent change positions in the file (useful for navigating recent edits).*and#- Jump to the next or previous occurrence of the word under the cursor within the file.