Vi/m Fun
I’m honesly not sure if these are vi or vim specific as I use a mac and Debian machine, but here’s some fun stuff I’ve learned over the years. I started as a nano
person, but am finaly sitting down and using vi/m
more and more.
In command mode (make sure to hit esc
)⌗
Go to start of file gg
Go to end of file G
Delete from line to start of file dgg
Delete from line to end of file dG
Go to start of line ^
Go to end of line $
Insert line above currnet line O
Insert line below current line o
Insert text after current cursor position a
Insert text at current cursor position i
Yank (copy) line yy
Yank many lines yNy
where N is number of lines from current line
Paste data below cursor p
Paste data above cursor P
In :
mode (not sure what this mode is called)⌗
Write file :q
Write and exit file :wq
Quit file without saving :q!
Write read-only file :wq!
<- OTHERS ->