Skip to content

Instantly share code, notes, and snippets.

@SViccari
Last active November 24, 2019 16:57
Show Gist options
  • Save SViccari/a5d0400d5099ec0d353db753110a91fe to your computer and use it in GitHub Desktop.
Save SViccari/a5d0400d5099ec0d353db753110a91fe to your computer and use it in GitHub Desktop.
Cheat Sheet for Vim and Tmux

Vim

dap delete paragraph with bottom space dip delete paragraph

J capital J will reformat the line below to be on the current line

G; jumps to the last edit made in the file

zz centers the current line in the window

Speed up Squashing:

Ctrl + v enter visual mode highlight the word being altered (in this case, "pick") c short for change type the replace word or letter (in this case, "f" or "fixup") Ctrl + [ escape and apply the new word to all places that were highlighted

Word Replacement:

Ctrl + v enter visual mode highlight what you want to copy and press y to yank highlight what you want to replace Shift + p

Search and Replace

%s/foo/bar/gc replaces each appearance of "foo" with "bar". The g will update all instances of "foo" including if there is more than one instance on a line. c will "confirm" before applying.

Another, perhaps better flow: find the word that's being changed * to highlight all instances s//bar/g this updates all instances of the highlighted word to "bar".

Tmux

Prefix is Ctrl + s

Create a new named Session

tmux new -s

Detach from Session

Prefix + d

Attach to a Session

tmux attach -t

Kill Session

tmux kill-session -t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment