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
Q

Open the command-line window with history of searches

A

q/

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

Execute program in shell

A

:!{program}

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

Command mode:
Current file path

A

%

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

Suspend current Vim session and enter terminal

A

Ctrl-z

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

Return back to suspended job from terminal

A

fg

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

Pass the contents of the buffer as standard input to the external {cmd} command

A

:write !{cmd}

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

Read the contents of external {cmd} command into current buffer

A

:read !{cmd}

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

Sort current buffer from 2nd row onwards, delimiter by , and use second column as sort key

A

:2,$!sort -t’,’ -k2

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

Difference between buffer and file

A

Buffer are in-memory representation of file, while files are saved to disk.

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

List current buffers

A

:ls

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

Next buffer

A

:bnext

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

Toggle between current and alternative buffer

A

<C-^>

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

Print list of Vim args

A

:args

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

Next and Previous argument

A

:next and :prev

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

Save buffer contents to file

A

:w[rite]

40
Q

Discard buffer changes and re-read from file from disk

A

:e[dit]!

41
Q

Close Vim

A

:q

42
Q

Quit all Vim buffers without saving

A

:qa[ll]!

43
Q

Write all buffers

A

:wa[ll]

44
Q

Cycle between open windows

A

<C-w>w or <C-w><C-w>

45
Q

Move between windows left/down/up/right

A

<C-w> h/j/k/l

46
Q

Split current window horizontally

A

<C-w>s

47
Q

Split current window vertically

A

<C-w>v

48
Q

Split the current window horizontally, loading {file} into the new window

A

:sp[lit] {file}

49
Q

Split the current window vertically, loading {file} into the new window

A

:vsp[lit] {file}

50
Q

Cycle focus between open windows

A

<C-w>w

51
Q

Focus the window to the left,below, above, right.

A

<C-w>h/j/k/l

52
Q

Close active window

A

<C-w>c

53
Q

Keep only the active window, closing all others

A

<C-w>o

54
Q

Open {filename} in a new tab

A

:tabe[dit] {filename}

55
Q

Move current window into its own tab

A

<C-w>T

56
Q

Close the current tab page and all of its windows

A

:tabc[lose]

57
Q

Keep the active tab page, closing all others

A

:tabo[nly]

58
Q

Switch to tab page number N

A

{N}gt

59
Q

Switch to next tab page

A

gt

60
Q

Switch to previous tab page

A

gT

61
Q

current path

A

:pwd

62
Q

Current buffer path without file name

A

%:h

63
Q

Find a file

A

:find {path to file}

64
Q

Move cursor to first nonblank character of real line

A
65
Q

Forward to start of next word

A

w

66
Q

Backward to start of current/previous word

A

b

67
Q

Forward to end of current/next word

A

e

68
Q

Backward to end of previous word

A

ge

69
Q

Forward to start of next WORD

A

W

70
Q

Backward to the previous occurrence of {char}

A

F{char}

71
Q

Forward to the next occurrence of {char}

A

f{char}

72
Q

Repeat the last character-search command

A

;

73
Q

Reverse the last character-search command

A

,

74
Q

Text object:
Inside (parentheses)

A

i) or ib

75
Q

Text object:
Around {braces}

A

a} or aB

76
Q

Text object:
A pair of [brackets]

A

a]

77
Q

Text object:
Inside of XML tag

A

it

78
Q

Text object:
In sentence

A

is

79
Q

Text object:
Around paragraph (plus blank lines)

A

ap

80
Q

Delete a word in sentence

A

daw
(better than diw, as it removes white spaces)

81
Q

change the word

A

ciw
(better than caw, as it preserves spaces)

82
Q

Set a mark m

A

mm

83
Q

move cursor back to mark m

A

`m

84
Q

Current buffer’s path

A

Ctrl+g

85
Q

Jump to matching parantheses

A

%

86
Q

Jump to file name under the cursor

A

gf

87
Q

Jump to definition of keyword under the cursor

A

<C-]> or gd

88
Q

Comment out current line

A

gcc

89
Q

Special registers:
Name of the current file

A

”%

90
Q

Special registers:
Name of the alternate file

A

”#

91
Q

Special registers:
Last search pattern

A

”/

92
Q

Special registers:
Last Ex command

A

”:

93
Q

Efficient way to copy word and replace another

A

yiw -> move to word to change -> viw -> p

94
Q

paste buffer before cursor (useful when pasting words)

A

P

95
Q

Insert mode:
Paste current buffer

A

<C-r>0