VIM Flashcards
What are the three main modes in VIM?
normal,
insert,
last line
normal mode is often also called ‘command’ mode, but is ‘normal’ in the manual
last line or lastline may also be called command-line or ex. But afaik it is “officially” called last line mode
What is the primary way to enter insert mode? Also, what mode must you be in to enter insert mode?
From ‘normal’ mode, press ‘i’
What button should you press to enter last line mode? Also, what mode must you be in to enter this mode?
From ‘normal’ mode, press ‘:’
If you wish to open a document for editing in a VIM session, what mode is the only mode capable of doing this?
This is done with the last line command ‘:e ‘
What is the command to enter insert mode and place the cursor at the end of the current line?
A
If you wish to enter insert mode to change the line from the point of the cursor to the end of the line, which key should you use?
C
If you are in normal mode and wish to delete the character under the cursor without entering insert mode, how would you do this?
x
If you are in normal mode and wish to change the single character under the cursor without entering insert mode, how can this be done?
r and then enter the letter you wish to replace it
To move to the beginning of the line in normal mode, which key should you use?
0 as in ‘zero’
How to move to the end of the line in normal mode?
$
In normal mode, does ‘j’ mean ‘down’ or ‘up’?
It means down. I remember this because j hooks ‘down’ and k points ‘up’
In normal mode, does ‘k’ mean down or up?
It means up! It does not hook ‘down’ like j does
If you wish to enter insert mode after the character that is under your cursor, what key should you press?
a
If, while in normal mode, you wish to create a new line after the cursor and enter insert mode on that line, which key should you press?
o, as in ‘my god’
If, while in normal mode, you wish to create a new line before the cursor and enter insert mode on that line, which key should you press?
O, as in ‘MY GOD!!”
What if you are in normal mode and wish to enter insert mode in order to change the entirety of the word that the cursor is currently on?
‘ciw’ for ‘change inner word’
note: the ‘inner’ is not to help memorize this command. If you said ‘cw’ for ‘change word’, it would change from the cursor to the end of the word. If you said ‘ctw’ for ‘change till w’, it would delete everything from the cursor to the next ‘w’ and enter insert mode. hopefully this makes sense.
In normal mode, you wish to place your cursor on the next ‘X’ symbol in the line without using the ‘l’ key. You do not need to enter insert mode, just to move the cursor
this is done with ‘f’ and then ‘X’
you can seek backwards with ‘F’
What if you are in normal mode and you wish to enter insert mode to change the text from under the cursor until the next ‘/’ symbol. What should you press to do this?
‘ct/’
“change till… /”
You can seek backwards with a capital “Till”:
‘cT/’
How do you enter command mode from insert mode?
ESC key
Which mode enables you to save your file? What is the command?
last line mode
the command is:
:w
for ‘write’
What symbol in last line mode acts as an ‘override’? If you cannot send the write command, for instance, what would you add to the command to override and save?
!
example:
:w!
What mode must you be in to tell VIM to quit? What command is used?
last line
:q
VIM will not close if you have unsaved changes. What key will override this?
!
example:
:q!
You wish to move the cursor to the first line of the document. Which mode and which command?
Normal mode
‘gg’
This is an alias for ‘1G’. The first line is the ‘1st’ line, not the ‘0th’ line.