Vim Indepth Flashcards

1
Q

Commands to Open Vim

A

enter ‘vim’ without an argument or option in the command line to open the welcome screen. From here, enter ‘vim [file name] to open the file. If a file by that name does not exist, it will create it.

If you just enter ‘vim [file name]’ from the Bash command line, it will immediately open the file, skipping the welcome screen. Again, if the file doesn’t exist, Vim will create it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Vim vertical split screen command

A

ctrl + w + v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Vim horizontal split screen command

A

ctrl + w + s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Insert Mode

A

Enables users to insert text by typing into the system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Execute Mode

A

Enables users to execute commands within the editor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command Mode

A

Enables users to perform different editing actions using single keystrokes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Visual Mode

A

Enables users to highlight or select text for copying and deleting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Vim, Enter Insert Mode from the Command Mode

A

i - insert text to the left of the cursor
A - add text at the end of a line
I - insert text at the beginning of a line
o - insert text on a new line below the cursor
O - insert text on a new line above the cursor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Vim, Enter Visual Mode from the Command Mode

A

v - enable selection, one character at a time
V - enable selection, one line at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Vim, Enter Execute Mode from the Command Mode

A

:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Vim, Return to Command Mode

A

Esc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

:w [file name]
(Vim execute mode supported command)

A

save the open file with the file name if saved for the first time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

:q
(Vim execute mode supported command)

A

quit if there have been no changes since the last save

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

:q!
(Vim execute mode supported command)

A

quit without saving changes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

:qa
(Vim execute mode supported command)

A

quit multiple file/quit all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

:wq
(Vim execute mode supported command)

A

save the file and quit

17
Q

:e!
(Vim execute mode supported command)

A

revert to the last saved version of the file without quiting or closing the file

18
Q

:! [any Linux command]
(Vim execute mode supported command)

A

execute the command and display both the command and any output from the command

19
Q

:help
(Vim execute mode supported command)

A

open Vim’s built-in help documentation

20
Q

Vim motions

A

Used inside Command Mode, Motions move the cursor anywhere within a document

21
Q

h
(Vim Motion key)

A

move one character to the left
(can also use the left arrow key)

Used inside Command Mode

22
Q

j
(Vim Motion key)

A

move down one line
(can also use the down arrow key)

Used inside Command Mode

23
Q

k
(Vim Motion key)

A

move up one line
(can also use the up arrow key)

Used inside Command Mode

24
Q

l
(Vim Motion key)

A

move right one character
(can also use the right arrow key)

Used inside Command Mode

25
Q

(Vim Motion key)

A

move to the beginning of the current line

Used inside Command Mode

26
Q

$
(Vim Motion key)

A

move to the end of the current line

Used inside Command Mode

27
Q

w
(Vim Motion key)

A

move to the next word

Used inside Command Mode

28
Q

b
(Vim Motion key)

A

move to the previous word

Used inside Command Mode

29
Q

Shift + L
(Vim Motion key)

A

move to the bottom of the screen

Used inside Command Mode

30
Q

Shift + H
(Vim Motion key)

A

move to the first line of the screen

Used inside Command Mode

31
Q

[#] Shift + G
(Vim Motion key)

A

move to the line #

Used inside Command Mode

32
Q

gg
(Vim Motion key)

A

move to the first line of the file
(can also use the home key)

Used inside Command Mode

33
Q

Shift + G
(Vim Motion key)

A

move to the last line of the file
(can also use the end key)

Used inside Command Mode

34
Q

/[text string]
(Vim Motion key)

A

search (forward?) through the document for the specified text

Used inside Command Mode

35
Q

?[text string]
(Vim Motion key)

A

search backward through the document for the specified text

Used inside Command Mode

36
Q

u
(Vim Motion key)

A

undo the latest change

Used inside Command Mode

37
Q

ZZ (capitals)
(Vim Motion key)

A

save the file and quit Vim

Used inside Command Mode