-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim_commands.txt
129 lines (90 loc) · 3.07 KB
/
vim_commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
:tabedit {file} edit specified file in a new tab
:tabfind {file} open a new tab with filename given, searching the 'path' to find it
:tabclose close current tab
:tabclose {i} close i-th tab
:tabonly close all other tabs (show only the current tab)
ctrl-shift-v paste!! (have to be in insert mode)
:w Save
:q Quit
ctrl-f scroll one page down (forwards)
ctrl-b scroll one page up (backwards)
% jumps to matching bracket from a bracket. Also, jumps to the start or tend of /* */ comment. Can jump to a matching C/C++ preproscessor conditional: #if, #ifdef, #else, #elif, #endif
u undo
fd Run python script for within file (setup in my .vimrc)
Commands for splitting windows and getting around them. Found at https://www.cs.oberlin.edu/~kuperman/help/vim/windows.html
:e filename - edit another file
:split filename - split window and load another file
ctrl-w up arrow - move cursor up a window
ctrl-w ctrl-w - move cursor to another window (cycle)
ctrl-w_ - maximize current window
ctrl-w= - make all equal size
10 ctrl-w+ - increase window size by 10 lines
:vsplit file - vertical split
:sview file - same as split, but readonly
:hide - close current window
:only - keep only this window open
:ls - show current buffers
:b 2 - open buffer #2 in this window
The following (from e to % was found at vim.wikia.com/wiki/Moving_around
e
Move to the end of a word.
w
Move forward to the beginning of a word.
3w
Move forward three words.
W
Move forward a WORD (any non-whitespace characters).
b
Move backward to the beginning of a word.
3b
Move backward three words.
$
Move to the end of the line.
0
Move to the beginning of the line.
^
Move to the first non-blank character of the line.
)
Jump forward one sentence.
(
Jump backward one sentence.
}
Jump forward one paragraph.
{
Jump backward one paragraph.:
j
Jump forward one line.
k
Jump backward one line.
H
Jump to the top of the screen.
M
Jump to the middle of the screen.
L
Jump to the bottom of the screen.
10<PageUp> or 10<CTRL-B>
Move 10 pages up.
5<PageDown> or 5<CTRL-F>
Move 5 pages down.
G
Jump to end of file.
1G
Jump to beginning of file (same as gg).
50G
Jump to line 50.
mx
Set mark x at the current cursor position.
'x
Jump to the beginning of the line of mark x.
`x
Jump to the cursor position of mark x.
''
Return to the line where the cursor was before the latest jump.
(Two single quotes.)
``
Return to the cursor position before the latest jump (undo the jump).
(Two back ticks. This is above the Tab key on some keyboards.)
'.
Jump to the last-changed line.
%
Jump to corresponding item, e.g. from an open brace to its matching closing brace. See Moving to matching braces for more.