Vim Flashcards

1
Q

Vim: how to move cursor 1 char left?

A

h

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

Vim: how to move cursor 1 char right?

A

l

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

Vim: how to move cursor 1 char up?

A

k

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

Vim: how to move cursor 1 char down?

A

j

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

Vim: how to move cursor to the beginning of the line?

A

0

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

Vim: how to move cursor to the end of the line?

A

$

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

Vim: how to move cursor to the first non-empty character of the line?

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

Vim: how to move cursor forward one word (next alphanumeric word)?

A

w

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

Vim: how to move cursor forward one word delimited by a whitespace?

A

W

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

Vim: how to move cursor forward five words delimited by whitespace?

A

5W

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

Vim: how to move cursor backwards one word (previous alphanumeric word)?

A

b

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

Vim: how to move cursor backward one word (delimited by whitespace)?

A

B

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

Vim: how to move cursor to end of file?

A

G

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

Vim: how to move cursor to beginning of file?

A

gg

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

Vim: how to move cursor to the previous sentence?

A

(

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

Vim: how to move cursor to the next sentence?

A

)

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

Vim: how to move cursor to the previous paragraph?

A

{

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

Vim: how to move cursor to the next paragraph?

A

}

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

Vim: how to move cursor to the previous section?

A

[[

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

Vim: how to move cursor to the next section?

A

]]

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

Vim: how to move cursor to the end of the previous section?

A

[]

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

Vim: how to move cursor to the end of the next section?

A

][

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

Vim: how insert text after the cursor?

A

a

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

Vim: how to insert text at the end of line?

A

A

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

Vim: how to insert text before the cursor?

A

i

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

Vim: how to begin a new line above the current line?

A

O

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

Vim: how to begin a new line below the current line?

A

o

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

Vim: how to insert the content of the file below the cursor?

A

:r

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

Vim: how to execute command and insert output below the cursor?

A

:r !

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

Vim: how to delete character at cursor and add it to clipboard?

A

x

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

Vim: how to delete from cursor to end of word?

A

dw

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

Vim: how to delete from cursor to beginning of the line?

A

d0

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

Vim: how to delete from cursor to end of line?

A

d$

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

Vim: how to delete from cursor to end of sentence?

A

d)

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

Vim: how to delete from cursor to beginning of file?

A

dgg

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

Vim: how to delete from cursor to end of file?

A

dG

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

Vim: how to delete current line?

A

dd

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

Vim: how to delete 3 lines starting from current?

A

3dd

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

Vim: how to replace character under cursor with ?

A

r{}

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

Vim: how to replace characters instead of inserting them?

A

R

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

Vim: how to copy current line into storage buffer?

A

yy

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

Vim: how to copy current lines into register x?

A

'’xyy

double quotes

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

Vim: how to paste current storage buffer after current line?

A

p

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

Vim: how to paste current storage buffer before current line?

A

P

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

Vim: how to paste from register x after current line?

A

“xp

double quotes

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

Vim: how to undo last operation?

A

u

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

Vim: how to redo last undo?

A

ctrl-r

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

Vim: how to search for “text” forwards?

A

/text

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

Vim: how to search for “text” backwards?

A

?text

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

Vim: how to move to next instance of search result?

A

n

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

Vim: how to move to previous instance of search result?

A

N

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

Vim: how to search for “text” and replace first occurance with “hello”?

A

:%s/text/hello

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

Vim: how to search for “text” and replace all occurances with “hello”?

A

:%s/text/hello/g

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

Vim: how to search for “text” and ask before replacing occurances with “hello”?

A

:%s/text/hello/gc

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

Vim: how to set bookmark “x” to current cursor position?

A

mb

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

Vim: how to list all bookmarks?

A

:marks

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

Vim: how to jump to beginning of line of bookmark at “x”?

A

‘x

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

Vim: how to enter visual mode per character?

A

v

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

Vim: how to enter visual mode per line?

A

V

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

Vim: how to switch case of current visual selection?

A

~

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

Vim: how to delete selected text?

A

d

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

Vim: how to delete selected text and start insert?

A

c

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

Vim: how to copy selected text into clipboard (yank)?

A

y

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

Vim: how to indent text to the right (shift right)?

A

>

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

Vim: how to indent text to the left (shift left)?

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

Vim: how to filter through an external command?

A

!

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

Vim: how to copy current selection into register x?

A

“xy

double quotes

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

Vim: how to open file under current cursor?

A

gf

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

Vim: which arguments makes vim write files with encryption (will prompt for key)?

A

-x

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

Vim: which argument makes vim start without plugins?

A

–noplugin

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

Vim: how to start vim in diff mode (argument)?

A

-d

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

Vim: how to scroll down one half of the screen?

A

ctrl-d

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

Vim: how to scroll up one half of the screen?

A

ctrl-u

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

Vim: how to scroll up one screen?

A

ctrl-b

75
Q

Vim: how to scroll down one line?

A

ctrl-y

76
Q

Vim: how to scroll up one line?

A

ctrl-e

77
Q

Vim: how to move cursor to middle of page?

A

M

78
Q

Vim: how to move cursor to top of page?

A

H

79
Q

Vim: how to move cursor to bottom of page?

A

L

80
Q

Vim: how to move cursor to end of word (alphanumeric)?

A

e

81
Q

Vim: how to move cursor to end of word (whitespace delimited)?

A

E

82
Q

Vim: how to move cursor to line 30?

A

:30

83
Q

Vim: how to move cursor to the matching bracket?

A
  1. Place cursor on the bracket ({})

2. $ %

84
Q

Vim: how to move cursor to previously modified line?

A

’.

85
Q

Vim: how to move cursor to next line with a lowercase mark?

A

]’

86
Q

Vim: how to move cursor to previous line with a lowercase mark?

A

[’

87
Q

Vim: how to insert one character before the cursor?

A

I (uppercase i)

88
Q

Vim: how to undo all changes to current line?

A

U

89
Q

Vim: how to delete contents to end of line?

A

D

90
Q

Vim: how to delete character one before cursor?

A

X

91
Q

Vim: how to substitute one character under the cursor?

A

s

92
Q

Vim: how to substitue entire line and begin to inser at beginning of line?

A

S

93
Q

Vim: how to increment number under cursor?

A

ctrl-a

94
Q

Vim: how to decrement number under cursor?

A

ctrl-x

95
Q

Vim: how to repeat last command action?

A

.

96
Q

Vim: how to open file with tag for word under cursor?

A

ctrl-]

97
Q

Vim: how to open file with ctag “function_name”?

A

:tag function_name

:ta function_name

98
Q

Vim: how to go back when opened a file matching a ctag?

A

ctrl-t

99
Q

Vim: when searching for tags - how to show the list of tags matching the current search?

A

:ts

100
Q

Vim: how to go to next tag in ctag search?

A

:tn

101
Q

Vim: how to go to previous tag in ctag search?

A

:tp

102
Q

Vim: how to go to first ag in ctag search?

A

:tf

103
Q

Vim: how to go to the last tag in ctag search?

A

:tl

104
Q

Vim: how to jump to exact position of mark x?

A

`x

105
Q

Vim: how to list all open tabs?

A

:tabs

106
Q

Vim: how to record macro at identifier “x”?

A
  1. type qx
  2. do the commands
  3. end macro with “q”
107
Q

Vim: how to play macro at identifier “x”?

A

@x

108
Q

Vim: how to do command x times?

A

:x

109
Q

Vim: how to move cursor to next lowercase mark?

A

]`

110
Q

Vim: how to move cursor to previous lowercase mark?

A

[`

111
Q

Vim: how to jump to position where last file has been edited?

A

`0

112
Q

Vim: how to jump to previous file where it has been edited?

A

`1

113
Q

Vim: how to jump to beginning of previously yanked text?

A

`[

114
Q

Vim: how to jump to end of previously yanked text?

A

`]

115
Q

Vim: how to jump to beginning of previous visual selection?

A

`

116
Q

Vim: how to jump to end of previous visual selection?

A

`>

117
Q

Vim: how to delete multiple/single marks?

A

:delmarks a

Example for deleting multiple marks:
:delmarks abc

118
Q

Vim: within search results - how to jump to first match (skip if row 1 col 1)?

A

ggn

119
Q

Vim: within search results - how to jump to real first match?

A

Gn

120
Q

Vim: how to search forward for occurances of the word below cursor?

A

*

121
Q

Vim: how to search backward for occurances of the word below cursor?

A

#

122
Q

Vim: after search - how to replace the searched string with “replace”?

A

:%s//replace/g

Note: After searching the empty search is a placeholder for the previous search string.

123
Q

Vim: how to make vim search while typing?

A

:set incsearch

124
Q

Vim: how to make vim ignore case when searching?

A

:set ignorecase

125
Q

Vim: how to search for the third occurance of “pattern”?

A

3/pattern

126
Q

Vim: when searching for pattern - how to make the cursor being positioned at the end of the occurance?

A

/pattern/e

127
Q

Vim: how to search for the third occurance of the current word forward?

A

3*

128
Q

Vim: how to serch for the third occurance of the current word backward?

A

3#

129
Q

Vim: how to jump to line 50 without a “vim command” (that is the “:”)?

A

50G

130
Q

Vim: how to return to the line where the cursor was before the latest jump?

A

’’

single quotes

131
Q

Vim: how to return to the cursor position before the latest jump?

A

``

132
Q

Vim: how to split window vertical?

A

:vsp

133
Q

Vim: how to split window horizontally?

A

:sp

134
Q

Vim: how to move to split window below?

A

ctrl-j

set in .vimrc

135
Q

Vim: how to move to split window above?

A

ctrl-k

set in .vimrc

136
Q

Vim: how to remap keystrokes in .vimrc?

A

map C-J C-Wj

put C-J and C-W in crocodile brackets

137
Q

Vim: how to move to splut window to the right?

A

ctrl-l

138
Q

Vim: how to move to splut window to the left?

A

ctrl-h

139
Q

Vim: how to jump to next occurance of character “x”?

A

fx

140
Q

Vim: how to jump before next occurance of character “x”?

A

tx

141
Q

Vim: how to show register contents?

A

:req

142
Q

Vim: how to remove highlighting on search results?

A

:noh

143
Q

Vim: after search - how to jump to the cursor position before search (you could also jump back without search)?

A

ctrl-o

144
Q

Vim: how to jump forward to next cursor position (after jumping back)?

A

ctrl-i

145
Q

Vim: how to execute an external command?

A

:!python …

146
Q

Vim: how to show content of folder of current file?

A

:!ls
or
:!dir

147
Q

Vim: what is the command prefix to execute only on the visual selection

A

:’

148
Q

Vim: how to save visual selection to file?

A

:‘w FILENAME

149
Q

Vim: how to insert output of external command below cursor?

A

:r !command

150
Q

Vim: how to display help files?

A

:help

151
Q

Vim: how to edit another file?

A

:e filename

152
Q

Vim: how to save file with sudo privileges?

A

:w !sudo tee %

153
Q

Bash & Vim: how to search for file and open the result in vim?

A

find . -name whatever.js | xargs vim

154
Q

Vim: Which is the leader key?

A

\

155
Q

Vim: How to open CtrlP to show and switch file?

A

(ctrl - p)

156
Q

Vim: How to open the netrw file explorer?

A
157
Q

Vim/netrw: How to open file in new tab?

A

3

158
Q

Vim/netrw: How to open file in horizontal split?

A

1

159
Q

Vim/netrw: How to open file in vertical split?

A

2

160
Q

Vim/netrw: How to open file in previous window?

A

4

161
Q

Vim: how to insert jsdoc for function (when cursor is over funtion)?

A

:JsDoc

162
Q

Vim: how to search for occurance “xxx” in folder y?

A

:vimgrep /xxx/g y

163
Q

Vim: how to expand visual selection to next region?

A
164
Q

Vim: how to reduce visual selection to next region?

A
165
Q

VIm: how to remove extra whitespaces?

A

:StripWhitespace

166
Q

Vim: how to rescane CtrlP files?

A

:CtrlPClearCache

167
Q

Vim: how to switch to next tab?

A
168
Q

Vim: how to switch to previous tab?

A
169
Q

Vim: how to git add?

A

a

170
Q

Vim: how to git commit?

A

c

171
Q

Vim: how to get git status?

A

s

172
Q

Vim: how to get git log?

A

l

173
Q

Vim: how to checkout file?

A

Ctrl + g + checkout

174
Q

Vim: how to show diff?

A

Ctrl + g + diff

175
Q

Vim: how to git pull?

A

Ctrl + g + pull

176
Q

Vim: how to git push?

A

Ctrl + g + push

177
Q

Vim: how to execute any git command?

A

Ctrl + g + git

178
Q

Vim: how to git merge?

A

Ctrl + g + merge

179
Q

Vim: how to finish git merge?

A

Ctrl + g + done

180
Q

Vim: highlight all occurances of word under cursor?

A

*

181
Q

Vim: Alternative for escape key?

A

Ctrl + [

182
Q

Vim: how to search for tags (ctrlp)?

A

Ctrl + L

183
Q

Vim: how to delete until line Z?

A

dZG