I’ve also added TMux shortcuts because I’m learning to use that too.
Vim commands
u/<C-r>: Undo/Redo.: Repeat last commandw/b: Move forward/backward by a worde: Move to end of word (last character)srefers to a sentence. Thusdisanddasdeletes a sentence from anywhere inside it, and everything around the sentence, respectively.(/): Jump to previous/next sentencei/a/I/A: Start editing before/after cursor, before start/after end of linei: Considers whitespace as words too, soi2wselects a word and any whitespace after it.a: Considers word + whitespace as a text object, soa2wselects"text1 text2 ".
0/^/$: Go to starting character / starting non-whitespace character / end of line+/-: Jump to starting non-whitespace character of next/previous line
d: Delete (suffix with counter and text object, liked2w,dd)c: Change (suffix with counter and text object, likec2w,cc)r: Replace the single character under cursorRkeeps you in replace mode
y: Yank (suffix with counter and text object, likey2w,yy)- Interesting Use Case:
ny$yanks from cursor to end of linentimes, sonlines, starting from the current cursor position.
- Interesting Use Case:
f-x/F-x: Find characterxforward / backward from cursort-x/T-x: Find “just before” characterxforward / backward from cursor*: Search forward word under cursor/and?: Find string forward/backward- NOTE: You can chain this with other normal mode commands, e.g.:
d/loldeletes all the way upto, but excluding,lol.
- NOTE: You can chain this with other normal mode commands, e.g.:
P/p: Paste before/after cursorx: Delete character under cursornG/ngg: Go to line numbernG: Go to end of filei: “Everything inside” qualifier used in conjunction with other verbs, likediw,ci"a: “Everything around” qualifier used in conjunction with other verbs, likedaw,ca"<C-v>: Visual Block Mode, useIto insert en-masse<C-o>/<C-i>: Go to old/new positions<C-u>/<C-d>: Move up/down half a page{/}: Jump forward/back across a contiguous block of text
Ex commands
x,y<Command>z: Defines an inclusive range of lines fromxtoyand performs<Command>with optional argumentz.m/t: Move/Copy range of lines to afterz. Example:10,20m30. Single line variants like10m30also work.
x;+/-n: Defines range of+/-nstarting from linex.,.+/-n: Refers to the current line / Refers tonlines after/before current line.$,$+/-n: Refers to the last line of the document (Compare to going to last character in line in Vim’s Normal mode).+/-nnavigatesnlines after/before last line.%: Refers to all lines (same as1,$)<scope>s/<pattern>/<replacement>does search and replace, but only for the first occurrence ofpatternon a given line. No specified scope limits it to the current line. Add/gat the end for it to process every occurrence ofpatternon a given line.- Commands can be
d,y,c, etc. Append/eto include thepattern. - Use
:<scope>g/<pattern>/<Command>to match every line inscopewhich matchespattern, and then runs theCommandon that line.
TMux commands
<C-b>?: View all keybindings<C-b>%: Horizontal split<C-b>": Vertical split<C-b><Arrow Keys>: Moves across TMux panes<C-b>d: Detaches from current TMux session<C-b>[: Enables scroll mode<C-b><Space>: Enables highlight mode after entering scroll mode. Press<C-b>to yank highlighted text.<C-b>]: Pastes copied content to another TMux terminaltmux ls: Lists running TMux sessionstmux attach -t <SessionID>: Attaches to specified TMux sessiontmux rename-session -t <OldSessionID> <NewSessionID>: Renames a TMux session<C-b>,: Renames current windowtmux new -s <SessionID>: Creates a new TMux session with givenSessionID