This guy’s tutorials look pretty excellent:
- https://thevaluable.dev/vim-beginner/
- https://thevaluable.dev/vim-intermediate/
- https://thevaluable.dev/vim-advanced/
C-x {2,3}
C-w s
/:sp
,C-w v
/:vsp
C-x o
C-w {h,j,k,l}
C-x 1
C-w o
C-x C-f
:e <filename>
C-x b
:ls
C-x 0
:q
- Hit
v
to toggle “visual mode” to start selecting text- While in Visual mode, you can hit
o
to exchange point and mark
- While in Visual mode, you can hit
C-w
d
(works with visual mode turned on)M-w
y
(ditto; this is called “yank”)C-y
p
(“put”)
Replace this pattern
with that string
: :s/this pattern/that string/gc
The c
flag on the end signals that vim should confirm replacements, much like query-replace in Emacs.
C-o
- (While in insert mode) switch to normal mode for the next command.
xp
- Simulates swapping a character, by first deleting it, then putting it back.
dawwP
- Simulates swapping a word, by first deleting it, moving forward, then putting it behind the current character.
V
- (shift-v) visual mode, but start by selecting the current line
C-v
- visual-block mode, like
C-x C-SPC
C-r
- redo, but I need to customize my unto system first
f<char>
- move to a character before your cursor; think avy-goto-char-1
F<char>
- same, but backwards
t<char>
- move to the char before the one specified; ditto with
T<char>
<num>G
- Goto line <num>
D
- Same as
Ctrl-k
in Emacs df(
- Delete up to the next
(
cf(
- Ditto, but leave in insert mode (like the change commands)
zz
- Like hitting
C-l
to center a line z<RET>
- Put current line at top
z-
- Put current line at bottom
z.
- Does something similar
gf
- edit filename under cursor
gx
- call
open
on the file under cursor gi
- go to last edit and set cursor to insert mode
g;
- go to next change
g,
- go to previous change
gi
- I think this means “go to last edit and insert”
gt
,gT
- go forward, back tabs
q<letter>
- start recording macro in register
<letter>
q
- stop recording
@<letter>
- replay macro
s
- split horizontally
v
- split vertically
n
- split horizontally and edit a new file
r
- rotate windows
x
- swap with next window
- ===
- resize all windows to be equal (like
C-x =
in Emacs-mode) -
,+
- decrease, increase height
<
,>
- decrease, increase width
(
,)
- go to the beginning and end of a sentance
z=
- run ispell-word
\
\==- (two equal signs) indent current line
[<SPC>
,]<SPC>
- insert spaces above and below
yS<open delimiter><movement>
- wrap the movement (e.g., for
w
wrap a word,f.
will wrap to the next period) in the delimiter with space padding yS<close delimiter><movement>
- same as above, but don’t put spaces around the delimiters
Similar to From Normal Mode, but it doesn’t take a movement. Instead, just wraps whatever you’ve marked. This might be easier to use.