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
-
g
actions: 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>`k
applies<cmd>
between marker and current location.- text object
iw
inner wordit
inner tag (content of html tag)i"
inside " quotesip
inside paragraphas
a sentence
- fold
za
toggle code foldzr
fold reduce (foldlevel--),zR
open all folds (set foldlevel to the highest level)zm
fold more (foldlevel++),zM
close all foldszc
close fold under cursor,zC
close fold under cursor recursivelyzo
close fold under cursor,zO
open fold under cursor recursivelyzv
view cursor line, if jump to a line in a closed fold this opens just enough fold to see the linezx
update fold, re-apply foldlevel, undo manual folds
:b n|p
move to next|prev buffer- splits
- :[v]sp [vertical] split
<c-w>
general split command- +
q
close 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 (lookin
to locations, then backout
)g]
to view a list of def for a taggd|gD
local|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,:pclose
closes preview window<c-w>f
goto file under cursor in new window
-
Ex mode
:+ny
yankn
line after current line,:-ny
same before current line:.,+ny
yank current andn
line after current line,:-n,.y
same in the other direction
-
quickfix
cop[en]
,:ccl[ose]
, open, close:cn
and:cp
allows moving to next, prev item even when quickfix is closed
- diff
]c
and[c
next or prev change
- merging
- :diffg RE " get from REMOTE
- :diffg BA " get from BASE
- :diffg LO " get from LOCAL
ConflictMotions
plugin 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!