tmux new -s <name>create new session withtmux attach -t <name>attach to session withtmux kill-session -t <name>kill session with
In tmux hit prefix c-a or c-b then:
:new<CR> new session
s list sessions
$ name session
d detach
c create window
w list windows
n next window (`c-l` for oh-my-tmux)
p previous window (`c-h` for oh-my-tmux)
f find window
, name window
& kill window
% vertical split
" horizontal split
o swap panes
q show pane numbers
x kill pane (or c-d)
+ break pane into window (e.g. to select text by mouse to copy)
- restore pane from window
⍽ space - toggle between layouts
m-<arrow key> resize pane
<prefix> q (Show pane numbers, when the numbers show up type the key to goto that pane)
<prefix> { (Move the current pane left)
<prefix> } (Move the current pane right)
<prefix> z toggle pane zoom
-
gactions: http://vimdoc.sourceforge.net/htmldoc/vimindex.html#g -
insert mode:
<c-p>,<c-n>enable completion<c-x>extended completion mode (shows other options)- +
<c-l>complete a line (you have to start typing a bit of the line then vim completes for you) - +
<c-n>|<c-p>context aware completion (use multiple<c-n>+<c-p>to complete sentence) - +
<c-f>complete file name
- +
-
normal mode:
- wWeEbBfFtT%/?{} (easymotion)
*|#search forward|backward=i{indent block within{}, also>i{/<i{to increase / decrease indent within{}mk, make markerk,`k, move to k.<cmd>`kapplies<cmd>between marker and current location.- text object
iwinner worditinner tag (content of html tag)i"inside " quotesipinside paragraphasa sentence
- fold
zatoggle code foldzrfold reduce (foldlevel--),zRopen all folds (set foldlevel to the highest level)zmfold more (foldlevel++),zMclose all foldszcclose fold under cursor,zCclose fold under cursor recursivelyzoclose fold under cursor,zOopen fold under cursor recursivelyzvview cursor line, if jump to a line in a closed fold this opens just enough fold to see the linezxupdate fold, re-apply foldlevel, undo manual folds
:b n|pmove to next|prev buffer- splits
- :[v]sp [vertical] split
<c-w>general split command- +
qclose split - +
[j|k|h|l]move to [down|up|left|right] split - +
<number>[+|-][increase|decrease] split size by
- +
- tag/nav
<c-]>,<c-t>- jump to def, jump back.<c-i>,<c-o>move forward and backward through jump list (lookinto locations, then backout)g]to view a list of def for a taggd|gDlocal|global declaration.g*|g#search for the word fwd|bwd under the cursor (like , but g on 'rain' will find words like 'rainbow').<c-w>}preview tag in preview window,:pclosecloses preview window<c-w>fgoto file under cursor in new window
-
Ex mode
:+nyyanknline after current line,:-nysame before current line:.,+nyyank current andnline after current line,:-n,.ysame in the other direction
-
quickfix
cop[en],:ccl[ose], open, close:cnand:cpallows moving to next, prev item even when quickfix is closed
- diff
]cand[cnext or prev change
- merging
- :diffg RE " get from REMOTE
- :diffg BA " get from BASE
- :diffg LO " get from LOCAL
ConflictMotionsplugin can help navigate around conflict markers
gd - jump to definition. gq - on a visual selection reflow and wordwrap blocks of text, preserving commenting style. Great for formatting documentation comments. gb - adds another cursor on the next word it finds which is the same as the word under the cursor. af - visual mode command which selects increasingly large blocks of text. For example, if you had "blah (foo [bar 'ba|z'])" then it would select 'baz' first. If you pressed af again, it'd then select [bar 'baz'], and if you did it a third time it would select "(foo [bar 'baz'])". gh - equivalent to hovering your mouse over wherever the cursor is. Handy for seeing types and error messages without reaching for the mouse!