Vim Commands
These are notes on vim from Lesson 3 of Missing Semester, this lesson contains a lot of useful information about Vim.
Since I've written a quick introduction to vim, the notes on this post are just something to complement that article. I will probably update that article with these notes in the future.
The one thing that I loved learning in this lesson was how to create new windows and tabs. The lesson didn't mention how to cycle through them, so I did a quick search to figure out how to do it.
Normal mode:
- click
X
to remove a letter - use
:qa
to close all windows
Vim windows can have tabs.
- use
:sp
to create a new windows- Cycle between tabs with
ctrl+w
- Cycle between tabs with
- use
:tabnew
to open a new tab that can contain a window or more- Move between tabs with
ctrl+PgUp
orctrl+PgDn
- Move between tabs with
Moving around
- use
e
to move to the end of the word 0
moves the cursor to the beginning of the line$
moves the cursor to the end of the line^
moves to the first non-empty character of a linectrl+u
scrolls upctrl+d
scrolls downG
moves to the end of the file- so does
:$
- so does
gg
moves to the beginning of the fileL
moves to the lowest line in the screenM
moves to the middle line in the screenH
moves to the highest line in the screenf<character>
moves the cursor to the first character - f stands for findt<character>
move cursor to character/<word>
search word
Editing commands
u
undo changesctrl+r
redo changeso
opens a new line under the cursorO
opens a new line on top of the cursorc
change mode - used similarly tod
but puts you in insert modeci'
change word inside '
x
delete a characterr
replace charactery
copyyy
copy the whole linepw
copy word
p
paste~
change the case of the selected texta
append word.
repeat the previous command