Commands Flashcards

1
Q

Increase number by 10

A

10<C-a>

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

Decrease number by 5

A

5<C-x>

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

Insert mode:
Delete one character (backspace)

A

<C-h>

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

Insert mode:
Delete back one word

A

<C-w>

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

Insert mode:
Delete back to start of line

A

<C-u>

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

Insert mode:
Switch to Normal mode

A

<Esc> or <C-[>

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

Insert mode:
Switch to Insert Normal Mode

A

<C-o>

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

Redraw screen with the current line in the middle of the window

A

zz

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

Join current and next line together

A

J

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

Look up man page for the word under cursor

A

K

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

Insert mode:
Result of 7*67

A

<C-r>=7*67<CR>

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

Switch to character-wise Visual mode

A

v

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

Switch to line-wise Visual mode

A

V

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

Switch to block-wise Visual mode

A

<C-v>

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

Reselect the last visual selection

A

gv

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

Visual mode:
Go to other end of highlighed text

A

o

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

Make {motion} text uppercase.

A

gU{motion}

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

Make current line uppercase

A

gUgU or gUU

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

Make {motion} text lowervase

A

gu{motion}

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

Switch case of the current line

A

g~~

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

how to choose area for Ex mode limit

A

After selecting area in visual mode, just press : to limit next command to this selection only. Super useful for find and replace etc.

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

Repeat the last Ex command

A

@:

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

Ex mode:
Copy current word under cursor into command line

A

<C-r><C-w>

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

Open the command-line window with history of Ex commands

A

q:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Open the command-line window with history of searches
q/
26
Execute program in shell
:!{program}
27
Command mode: Current file path
%
28
Suspend current Vim session and enter terminal
Ctrl-z
29
Return back to suspended job from terminal
fg
30
Pass the contents of the buffer as standard input to the external *{cmd}* command
:write !{cmd}
31
Read the contents of external *{cmd}* command into current buffer
:read !{cmd}
32
Sort current buffer from 2nd row onwards, delimiter by `,` and use second column as sort key
:2,$!sort -t',' -k2
33
Difference between buffer and file
Buffer are in-memory representation of file, while files are saved to disk.
34
List current buffers
:ls
35
Next buffer
:bnext
36
Toggle between current and alternative buffer
\
37
Print list of Vim args
:args
38
Next and Previous argument
:next and :prev
39
Save buffer contents to file
:w[rite]
40
Discard buffer changes and re-read from file from disk
:e[dit]!
41
Close Vim
:q
42
Quit all Vim buffers without saving
:qa[ll]!
43
Write all buffers
:wa[ll]
44
Cycle between open windows
\w or \\
45
Move between windows left/down/up/right
\ h/j/k/l
46
Split current window horizontally
\s
47
Split current window vertically
\v
48
Split the current window horizontally, loading {file} into the new window
:sp[lit] {file}
49
Split the current window vertically, loading {file} into the new window
:vsp[lit] {file}
50
Cycle focus between open windows
\w
51
Focus the window to the left,below, above, right.
\h/j/k/l
52
Close active window
\c
53
Keep only the active window, closing all others
\o
54
Open {filename} in a new tab
:tabe[dit] {filename}
55
Move current window into its own tab
\T
56
Close the current tab page and all of its windows
:tabc[lose]
57
Keep the active tab page, closing all others
:tabo[nly]
58
Switch to tab page number N
{N}gt
59
Switch to next tab page
gt
60
Switch to previous tab page
gT
61
current path
:pwd
62
Current buffer path without file name
%:h
63
Find a file
:find {path to file}
64
Move cursor to first nonblank character of real line
^
65
Forward to start of next word
w
66
Backward to start of current/previous word
b
67
Forward to end of current/next word
e
68
Backward to end of previous word
ge
69
Forward to start of next WORD
W
70
Backward to the previous occurrence of {char}
F{char}
71
Forward to the next occurrence of {char}
f{char}
72
Repeat the last character-search command
;
73
Reverse the last character-search command
,
74
Text object: Inside (parentheses)
i) or ib
75
Text object: Around {braces}
a} or aB
76
Text object: A pair of [brackets]
a]
77
Text object: Inside of XML tag
it
78
Text object: In sentence
is
79
Text object: Around paragraph (plus blank lines)
ap
80
Delete a word in sentence
daw (better than diw, as it removes white spaces)
81
change the word
ciw (better than caw, as it preserves spaces)
82
Set a mark m
mm
83
move cursor back to mark m
`m
84
Current buffer's path
Ctrl+g
85
Jump to matching parantheses
%
86
Jump to file name under the cursor
gf
87
Jump to definition of keyword under the cursor
\ or gd
88
Comment out current line
gcc
89
Special registers: Name of the current file
"%
90
Special registers: Name of the alternate file
"#
91
Special registers: Last search pattern
"/
92
Special registers: Last Ex command
":
93
Efficient way to copy word and replace another
yiw -> move to word to change -> viw -> p
94
paste buffer before cursor (useful when pasting words)
P
95
Insert mode: Paste current buffer
\0