Cheatography
https://cheatography.com
A list of commands I commonly use with Git, Tmux and Vim
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Terminal
# grep -lir '<search>' <dir>
|
Find text in files |
# grep -rn '<search>' <dir>
|
... with line number and preview |
# sed -n 20,30p somefile.txt
|
show lines in a file |
Git
|
Undo my changes |
|
if you haven't added any new files and you want to commit |
# git remote set-url origin http://<USERNAME>@stash.example.com/repo.git
|
Reset the origin |
Git - working with others
(When your working with someone on git)
Vim
|
open file |
Esc :q |
quit |
Esc :q! |
shit I've done something wrong |
i |
edit file |
Esc :w |
save changes |
Esc :x |
save and exit |
dd |
delete line |
dG |
delete ALL lines |
Esc :e |
reload file |
/... |
search for text |
* (on a word) |
search for that word |
Esc :noh |
clear search |
Esc :set autoread |
Live reloads |
Copy Text |
v |
start copy |
y |
end copy |
(d) |
(cut text) |
p |
paste |
for :find
to work include :set path=.,/usr/include,,**
in your ~/.vimrc
file
|
|
Tmux
|
show sessions |
|
attache to a session |
|
new session |
# tmux kill-session -t ...
|
kill session |
Ctrl+a d |
exit tmux |
Panels |
Ctrl+a - |
split panel horizontal |
Ctrl+a | |
split panel Vertically |
Ctrl+a x |
close panel |
Ctrl+a z |
Full screen panel |
Alt+<up arrow> |
move to panel above |
Alt+<... arrow> |
... |
Panel - Scroll Mode |
Ctrl+a [ |
enter scroll mode |
<... arrow> |
scroll around |
q |
quit scroll mode |
Windows |
Ctrl+a c |
new window |
Ctrl+a & |
delete window |
Ctrl+a n |
next window |
Ctrl+a p |
previous window |
Ctrl+a ' |
rename window |
Copy Text |
Ctrl+a [ |
enter copy mode |
Ctrl+<space> |
start copy |
Alt+w |
stop copy |
Ctrl+a ] |
paste text |
Ctrl+a
only works if you have set -g prefix C-a
and bind C-a send-prefix
and unbind C-b
in your ~/.tmux.conf
|