Vim Commands Flashcards

1
Q

What 3 ways can you save and exit?

A

ZZ :wq :x

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

Exit without saving

A

:q!

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

Go to beginning of current word

A

b

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

Go to end of current word

A

e

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

Go to start of next word

A

w

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

Move to column 15

A

15|

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

Move to the beginning of the next line

A

+

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

Move to the beginning of the previous line

A

-

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

Half screen up

A

C - u

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

Half screen down

A

C - d

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

Full screen up

A

C - B

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

Full screen down

A

C - f

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

Go to line 32

A

32G 32gg :32

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

Set current line to the top of the screen

A

z then return

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

Delete the next character

A

x

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

Delete the previous character

A

X

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

Delete the entire line

A

dd

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

Delete all the text to the right of the cursor till the end of the line

A

D

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

Insert after the end of the line

A

A

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

Paste after the current cursor position

A

P

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

Paster before the current cursor position

A

p

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

Indent selected block of code

A

>

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

Outdent selected block of code

A

<

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

Undo

A

u

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

Redo

A

C - r

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

Open file

A

:e

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

Open a menu like list of files in the current directory

A

:e .

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

Jump to shell

A

:sh

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

Search for the first occurrence of flower

A

/flower

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

Find next occurrence after a / search

A

:n

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

Global find and replace

A

ggVG :s/find/replace/g

32
Q

Jump to matching delimiter

A

%

33
Q

Jump to matching keyword

A

%

34
Q

Next buffer

A

:b#

35
Q

First buffer

A

:bf

36
Q

Last buffer

A

:bl

37
Q

Switch to another buffer by its number

A

:b5

38
Q

List all the buffers in use

A

:ls

39
Q

Open another file into a split screen

A

:split

40
Q

Open multiple files in split

A

:vi -o

41
Q

Switch between windows

A

C -w C - w

42
Q

Close current window

A

C -w q

43
Q

Split current window

A

C - w s

44
Q

Display info about current file

A

C - g

45
Q

Move to next start of method

A

]m

46
Q

Move back to first start of method

A

[m

47
Q

Change params of method we are in

A

[m f(

48
Q

Change return value of method we are in

A

]MO

49
Q

Jump to the start of the next class or module definition

A

]]

50
Q

Jump to the start of the previous class or module definition

A

[[

51
Q

What do you need to add to .vimrc.local to be able to use % to toggle between matching keywords?

A

runtime macros/matchit.vim

52
Q

When’s a great way to use % to toggle between matching keywords?

A

At the bottom of an rspec file to match all the ends

53
Q

select inside method

A

vim

54
Q

delete inside method

A

dim

55
Q

change inside method

A

cim

56
Q

yank inside method

A

yim

57
Q

select around method

A

vam

58
Q

delete around method

A

dam

59
Q

change around method

A

cam

60
Q

yank around method

A

yam

61
Q

select inside class

A

viM

62
Q

delete inside class

A

diM

63
Q

change inside class

A

ciM

64
Q

yank inside class

A

yiM

65
Q

select around class

A

vaM

66
Q

delete around class

A

daM

67
Q

change around class

A

caM

68
Q

yank around class

A

yaM

69
Q

select inside ruby block

A

vir

70
Q

delete inside ruby block

A

dir

71
Q

change inside ruby block

A

cir

72
Q

yank inside ruby block

A

yir

73
Q

select around ruby block

A

var

74
Q

delete around ruby block

A

dar

75
Q

change around ruby block

A

car

76
Q

yank around ruby block

A

yar