Repository navigation
Cheatsheet
Rob Yang edited this page Jan 19, 2017
·
38 revisions
| 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 reset --patch [filename] |
Unstage hunks from file |
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 |
git submodule add [url_to_repo] [repo] |
Add repo as submodule within a repo |
git submodule init |
Initialize existing submodules in repo |
git submodule update |
Downloads submodule repos |
git ls-files --stage |
Show staged submodules in index |
git rm --cached [repo] |
Unstage the repo from the index |
git commit --amend |
Change commit message |
git show-ref --tags |
Show all tags/refs |
git ls-remote --tags |
Show all tags/refs on remote |
| 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 Hello2. 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 |
| GT | Next tab (NERDTree) |
| Gshift+T | Previous tab (NERDTree) |
| 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 |
| 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 |
| SHORTCUTS | ACTION |
|---|---|
Control + W |
Deletes the word immediately before the cursor |
Alt + D |
Deletes character immediately after the cursor |
Control + A |
Moves cursor to the beginning of the line |
Control + E |
Moves cursor to the end of the line |
Control + U |
Clears the entirety of the line before the cursor |
Control + K |
Clears the line that appears after the cursor |
Command + Kor Control + L
|
Clears the entire Terminal screen |