Modes Flashcards
Repeats the last change
.
Increases indentation until end of line
> G
Scans line for a specific character after the cursor
f + char
Scans line a specific character before the cursor
F + char
Repeat last find forward command
;
Repeat last find backwards command
,
In one letter,
(1) Delete the character under the cursor
(2) Enter Insert Mode
s
Undo a change
u
Delete from the cursor’s position to the beginning of a word
db
(1) Generally, this is the best way to delete a word
(2) Why so?
(1) daw
(2) This is more repeatable via . than alternatives like dbx and bdw
Copy a line
Y or yy
(1) Add by one
(2) Add by five
(1)
(2) 5
(1) Subtract by one
(2) Subtract by five
(1)
(2) 5
Delete three words
3dw or d3w
Two ways to delete a single character
x or dl
(1) Swap case
(2) Make lowercase
(3) Make uppercase
(1) g~
(2) gu
(3) gU
(1) Shift left
(2) Shift right
(3) Autoindent
(1)
(3) =
Operator-Pending mode is a state that only accepts __________ commands.
motion
List vim’s major modes
Normal
Insert
Visual
Command-Line
List vim’s minor modes
Operator-Pending
Select
Insert-Normal
Two ways to switch from Insert to Normal Mode
Insert-Normal Mode: While in Insert Mode, fire off a single Normal Mode command
From Insert Mode, delete
1) back one character (backspace
(2) back one word
(3) back to start of line
(1)
(2)
(3)
From Insert Mode, paste text from register X
X
Hence, to paste from register zero, 0
From Insert Mode,
(1) Access the expression register
(2) Multiple 8 by 4 with said register
(1) =
(2) =8*4
Overwrite text
R
Use Virtual Replace mode
gR
This should be preferred to Replace mode whenever possible.
(1) Enable character-wise Visual Mode
(2) Enable line-wise Visual Mode
(3) Enable block-wise Visual Mode
(4) Reselect the last visual selection
(1) v
(2) V
(3)
(4) gv
In Visual Mode,
go to the other end of the selected text
o
In Visual Mode,
select backwards by two words
bb or 2blw
In Visual Mode,
(1) Uppercase selected text
(2) lowercase selected text
(1) U
(2) u
Use Visual Mode to create a column marked by |
(1) Enter visual block mode
(2) Use j or k to mark off a column
(3) r|
Use Visual Mode to convert all the characters in a line to ————
Vr-
Using Visual Mode, replace the word “foobar” into a block of text
Use j and k to select the block to be replaced
c
foobar
Using Visual-Block mode, append a semi-colon to the following code. The cursor starts on 1.
var foo = 1 var bar = 'a' var foobar = foo + bar
jj$
A;