Skip to content

Cheatsheet

Rob Yang edited this page Nov 26, 2016 · 38 revisions

git

COMMAND ACTION
git branch -m [old name] [new name] Rename any branch
git branch -m [new name] Rename current branch
git remote prune origin Prune branches
git rebase -i master Squash commits
git stash Stash changes
git stash list View list of stashed changes
git stash apply [the thing from list] Restore stashed change
git stash drop Drop top stash

vim

COMMAND ACTION
1. control+V
2. Select text
3. C
4. Type your changes
5. esc
Replace column of text
shift+O Insert line above
O Insert line below
^ or 0 Go to beginning of line
shift+I Go to beginning of line and edit
$ Go to end of line
shift+A Go to end of line and edit
1. DD
2. Move cursor to line
3a. P to paste line after cursor
3b. shift+P to paste line before cursor
Move line of text to different line
CS"``' "Hello world!" to 'Hello world!'
CS'``<q> 'Hello world!' to <q>Hello world!</q>
DS" "Hello world!" to Hello world!
1. Put cursor on Hello
2. YSIW] (iw is a text object)
Hello world! to [Hello] world!
:help NERDTreeMappings Show all keyboard mappings
T Open the selected file in a new tab
I Open the selected file in a horizontal split window
S Open the selected file in a vertical split window
shift+I Toggle hidden files
M Show the NERD Tree menu
shift+R Refresh the tree, useful if files change outside of Vim
? Toggle NERD Tree's quick help

sublime

COMMAND ACTION
shift+command+space Select between brackets
shift+command+K Select to open/closing tags
control+D Select between tags
control+shift+W Wrap line/selection with tag

terminal

COMMAND ACTION
lsof -i tcp:9292 list all processes running on port 9292
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
download pathogen

Clone this wiki locally