Vim Cheatsheet

pwd print current directory
cd - To previous working directory
ctrl+a,e,f,b, alt-f,b Move cursor
ctrl+d delete character

History

ctrl+r search previous, press again for next
ctrl+j copy history
ctrl+p,n previous, next

shortcuts

♥︎ https://www.blockloop.io/mastering-bash-and-terminal

ctrl+r reverse-i-search
ctrl-n/ctrl-p previous commands
ctrl-k kill to end
ctrl-u kill to begin
alt-d delete word in front
ctrl-y yank killed text
ctrl-w delete word behind
pbcopy/pbpaste system clipboard
cd - cd back and forth
ctrl-z process to background
jobs -l check bg jobs
fg/bg tell most recent job to fg/bg
less better than cat
:!git status run command while vim

Snippet

// list files by line count, useful when new to a project find . -name “*.m” | xargs wc -l | sort -r

// trim edge of png file mogrify -trim xxx.png

// show history of one line in git git log –pretty=short -u -L 728,728:/Users/jakehao/code/phantom/mutable-audiosession-impl/Libraries/SCAudio/SCAudio/SCAudioSession.m


More writing at jakehao.com