<prefix>!
break pane to new window, helpful if window is getting crowded
Vim's interface is a programming language made up of movements (w
e
b
h
j
k
l
), edits (c
), counts and modifiers (i
inside, a
around). video
I am documenting the motions I am learning in Vim. Disabling the mouse and the arrow keys really helps me learn.
- Edit a macro:
"qp
then edit, thenV"qy
to update it. gf
go into file^o
go back,^i
go forward,:jumps
qa
quit all windowsfc
find the first c in a line (variants:FtT
)ysiw"
surround word in "quotes",cs'"
change surrounding'
to"
'like'
:%g!/^(/d
across the whole file (%
) run a command (g
) on any line that does not (!
) start with(
(g!/^(
) — in this case the command is delete (d
):%s/foo/bar/gc
substitute foo for bar across the whole line, prompt for confirmationr
replace characterJ
join line(s), work with visual selection.^w v
to split vertically:registers
list what you have copied"ayiw
into register a, yank inner word
I
to insert at start of line,A
to insert at end of line
.
repeat last action:*cw<name><esc>n.n.n.n.
to rename a bunch of stuffD
delete till end of linedi"
delete in quotes%
jump to matching brace,V%
, visually select until matching bracex
delete char. better then forward delete, block cursor
- map shortcuts in normal mode
nmap <leader>t gg
dtt
delete until tgg=g
auto intent a file (sometimes works)]c
and[c
next and previous git hunk (use with git-gutter plugin)\hs
stage current hunkt
is liket
but backwards,dt{
means delete until {f
is likef
but backwards,df(
means delete back to ( (inclusive)h
,m
,l
high middle low of the screengg
top of file,g
bottom of file,8gg
line 8 of filezz
center screen to cursor^e
scroll down,^y
scroll up^f
scroll full screen,^d
scroll have- nice for macros (
q<slot>
,q
,@<slot>
) 0
start of line^
first char of line$
end of lineg_
last char on line*
search for word that you are currently onu
undo,^r
redoW
is a big word- Marks
mm
set a mark called m on the line- backtick
m
to go to mark called m
:r !date
to insert todays date on next lineShift K
shows documentation for the thing under the cursor:h f
taught me about thef
motion,f"
takes me to the :ext " on the current lineinoremap " ""<left>
maps"
in insert mode to""
with the cursor between the""