Updpate from Oct 2024: using vim as a daily editor made me learn these keys in the hard and quick way, so I don't need this note as a reference. Moreover, a lot of these been remapped in my config.
:ls :buffers
- list buffers
:buffer <n>
- load buffer n to a current window
:edit <file>
- create a new buffer with a file
:edit #<n>
- edit n-th buffer
:bdelete [n]
- delete current or n-th buffer
:[n] + Ctrl+^
- show previous or n-th buffer
ctrl+w s, ctrl+w v
- split current window, split vertically
:split [filename], :vsplit [filename]
- same as above, optionally loads a file
:q, :qa
- close a window, close all windows
:vert help motion.txt
- open help in vertical split
ctrl+w _
- maximize currnet window horizontall
ctrl+w |
- maximize currnet window vertically
ctrl+w =
- make all splits of whe same size
:tabnew [filename]
- create a new tab, optionally opening a file
:tabe
- new tab with an empty buffer
gt/gT, :tabnext/:tabprev
- show next/previous tab
ctrl+w T
- move current buffer to a new tab (note the capital "T", so it's ctrl+w shift+t)
_
- go to first char of the line
0
- go to the beginning of the line (to the 0-th position)
f+char
- to forward to char, e.g f=
jumps right to the closest = in this line
F+char
- same as above, but backward
;
, ,
- repeat above jumps in each direction
viw
- select the word under cursor ("visual inside word")
vi"
- same as above, select everything in ""-s
vi(
(same as vi)
) - same as above, select everything in ()-s
vip
- select the whole paragraph ("visual inside paragraph")
cw
- change word (c
is for "change", e.g delete and continue in insert mode)
ciw
- select the word under cursor ("visual inside word")
yiw
, yi"
- yank (copy) Word or content in ""s
{
, }
- move back and forth by paragraph
zA
- fold/unfold up to a root level
zM
, zR
- close / open all folds in a document
^w =
- make all split windows of the same size
^w _
, ^w |
- expand current split vertically/horizontally
gx
- open URL under cursor
gf
- open file under cursor in current buffer
Ctrl+W f
- open file under cursor in a split
m<mark>
- mark current position with mark (a single key, e.g: m1
, ma
, etc).
'<mark>
- go to mark (e.g '1
to go mark 1, 'a
go to mark a).
ze, zs
- horizontall scroll to left/right.
/what, ?that
- search forward and backward
n, N
- go to next/previous match
/
then ^p, ^n
- scroll search history
q/
- open the whole search history into a separate buffer. Go search thru your search history!
:set modified?
- check if a buffer was modified
:set modified
- mark buffer as modified
:set [no]modifiable
- make buffer as [no]-modifiable