Brainscape Vim Flashcards

1
Q

forward word/WORD

A

w / W

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

backward word/WORD

A

b / B

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

end of word/WORD

A

e / E

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

end of previous word

A

ge

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

beginning of line

A

0

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

beginning of text in line

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

end of line

A

$

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

land on next/previous “x” in line

A

fx / Fx

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

land just before the next/previous “x” in line

A

tx / Tx

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

next/previous (intra-line) find result

A

; / ,

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

move to matching parenthesis or bracket (or whatever is set in the ‘matchpairs’ option)

A

%

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

go to beginning of file

A

gg

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

go to end of file

A

G

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

go to line 7 of file

A

7G or 7gg

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

go to three-quarters of the way through the file

A

75% (you can use percentages!)

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

move cursor to the top of the screen

A

H (remember “highest”)

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

move cursor to the middle of the screen

A

M

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

move cursor to the bottom of the screen

A

L (remember “lowest”)

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

turn line numbers on/off

A

‘nu’ ‘number’ ‘nonu’ ‘nonumber’ :set nu, :set number/:set nonu, :set nonumber (also :# will just show you your current line number without turning on numbering)

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

turn on/off line number and percentage in the status bar

A

‘ru’ ‘ruler’ ‘noru’ ‘noruler’ (e.g. “:set ruler”)

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

scroll whole page at a time (name for both directions)

A

CTRL-F / CTRL-B (remember “Forward”/”Backward”)

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

scroll half a page at a time (name for both directions)

A

CTRL-D/CTRL-U (remember “Down”/”Up”)

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

scroll one line at a time (name for both directions)

A

CTRL-E (down) / CTRL-Y (up)

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

move the LINE with the cursor in middle of visible screen

A

zz

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
put the line with the cursor at the top of the screen
zt
26
put the line with the cursor at the bottom of the screen
zb
27
search (forward and backward)
/ forward ? backward
28
go to next/previous search result
n/N (note that "next" could be either forward or backward depending on whether / or ? is used)
29
setting to always make searches case-insensitive / sensitive (also, what is the default?)
'ic' 'ignorecase' 'noic' 'noignorecase' e.g. ":set ic" (default is 'noignorecase', so searches are case-sensitive by default)
30
use the current word under the cursor and search forward/backward (like "/" or "?")
* (forward), # (backward)
31
SEARCH for the third next word under the cursor
3* (used with count)
32
turn off search highlighting temporarily
:noh :nohlsearch (command)
33
turn off search highlighting permanently
'nohls' 'nohlsearch' e.g. ":set nohls"
34
enable/disable display of search matches while you're still typing (this is on by default)
'is' 'incsearch' 'nois' 'noincsearch' :set is/:set nois (this setting is on by default):
35
define a "jump"
anything farther than one line (not including "j" and "k" with count though)
36
jump back and forth between two recent JUMPS
`` (to the actual cursor position in the line) or '' (to the beginning of line)
37
go to older/newer location in jump list
CTRL-O older / CTRL-I newer (also )
38
display list of recent jumps
:ju :jumps
39
mark place under cursor with an "a"
ma (marks can be "a-z")
40
jump to mark "q"
`q or 'q (` for intra-line, ' for beginning of line)
41
display list of marks
:marks (no abbreviated version)
42
clear the jump list of the current window
:cle :clearjumps
43
special mark for cursor position from just before most recent jump
' or ` (e.g. `` or '' to get back to where you were last)
44
special mark for cursor position from when last editing the file
" (e.g. `" or '" to get back to where you were when last editing the file)
45
special marks for the start/end of the last change
[ / ]
46
difference between uppercase and lowercase marks
lowercase marks are specific to one file, whereas uppercase marks are global and can be used from any file
47
see where "F" is marked, see where "M", "C", and "P" are marked
:marks F :marks MCP
48
delete operator
d{motion}
49
delete whole line
dd
50
change whole line (but keep indent) (two ways of doing this!)
cc (or S)
51
delete character under/before cursor
x (same as "dl") / X (same as "dh")
52
delete to end of line
D (same as "d$")
53
change one character
s (same as "cl")
54
replace one character
r{character}
55
replace mode
R
56
repeat last change
.
57
character-based/line-based/block-based visual mode
v / V / CTRL-V
58
change to other side of selection in visual mode
o ("o"ther)
59
change to opposite set of corners when in block-based visual mode
O ("O"ther)
60
re-select the most-recently selected visual area
gv
61
put copied text after/before cursor
p / P
62
put three copies of copied text after cursor
3p
63
swap two characters
xp (simply the commands "x", then "p")
64
copy text specified by a given movement
y{movement} (remember "yank")
65
copy whole line
yy
66
copy to end of line
Y (must be mapped to do so in init.vim, since by default it acts identical to "yy")
67
copy using normal clipboard instead of register, paste using normal clipboard instead of register
"*y "*p (or you can use "+" instead of "*")
68
what "ab" and "aB" text objects represent
"a(" and "a{"
69
change case of one character and move forward
~
70
switch case of current line
g~g~ or g~~
71
lowercase/uppercase the text indicated by a given motion
gu{motion} / gU{motion}
72
make current line uppercase / lowercase
gUgU or gUU gugu or guu
73
make highlighted text lowercase/uppercase in visual mode
u / U
74
append at end of line, insert at beginning of line
A I
75
text objects for an HTML or XML tag block (e.g. ...)
at / it
76
text objects for words, sentences, and paragraphs
iw/aw is/as ip/ap
77
add one to the number under the cursor, add three
CTRL-A 3CTRL-A
78
subtract one from the number under the cursor, subtract three
CTRL-X 3CTRL-X
79
create an incrementing sequence
On separate lines, put "1" "1" "1" "1". Then visually select all lines except the first and execute "g CTRL-A" to create "1" "2" "3" "4".
80
location of init.vim, Linux
~/.config/nvim/init.vim
81
location of init.vim, Windows
~/AppData/Local/nvim/init.vim
82
reset an option to its default state
end with "&", e.g. ":set iskeyword&"
83
what distinguishes a "setting" in the help files
single quotes, e.g. :help 'wrap'
84
how to find help for a visual mode command
prepend "v_", e.g. :help v_u
85
how to find help for an insert mode command
prepend "i_", e.g. :help i_CTRL W
86
how to find help for a command-line command
prepend ":", e.g. :help :quit
87
how to find help for editing text in the command-line
prepend "c_", e.g. :help c_
88
how to find help for a Vim start-up option
prepend "-", e.g. :help -r
89
how to find help for a regular expression
prepend "/", e.g. :help /[
90
how to search for a help topic
type ":help word" and then press CTRL-D to see matching entries for "word" (or use ":helpgrep word")
91
change background to dark/light version of color scheme
'bg' 'background' (e.g. ":set background=dark/light")
92
change color scheme
:colorscheme evening
93
print a physical paper copy of a file, print only a portion of a file
:hardcopy highlight with visual mode before printing
94
settings relating to physical printing of a file
look at settings beginning with 'print*', e.g. 'printdevice' 'printheader' 'printfont' 'printoptions'
95
print to html
:TOhtml
96
disable SYNTAX highlighting for the moment
:syntax clear
97
disable syntax highlighting completely
:syntax disable
98
allow manual turning on and off of syntax highlighting per buffer
:syntax manual, then ":set syntax=ON" (or OFF) on a per-buffer basis
99
force Vim to use a certain type of syntax highlighting for a file
'ft' 'filetype' (e.g. ":set filetype=fortran")
100
see what filetype Vim is currently using for syntax highlighting
:set ft? :set filetype? (with no argument)
101
open Vim with multiple files in horizontal splits, vertical splits
nvim -o file1.txt file2.txt nvim -O file1.txt file2.txt
102
close the current file and open a new one
:edit FILE
103
hide current file and edit another
:hide edit otherfile.txt
104
edit a new set of files from within Vim
:args five.txt six.txt seven.txt
105
view currently open files that were given from arguments
:ar :args
106
edit the next, previous file in the :args list, skip two files forward in :args list
:n :next :N :prev :previous :2next
107
write changes and move to next, previous file in :args list
:wn :wnext (same as ":write", then ":next") :wN :wp :wprevious
108
go to first file in :args list
:fir :first (bonus--can also use ":rewind")
109
go to last file in :args list
:la :last
110
setting to automatically write file when switching to another buffer
'aw' 'autowrite' 'noaw' 'noautowrite' (e.g. ":set autowrite")
111
what is the difference between the argument list and buffers in Vim
the argument list was already present in Vi, but the buffer list was a new addition for Vim
112
add file(s) to the argument list in Vim
:arga :argadd (e.g. ":arga file3.txt file4.txt")
113
remove file(s) from argument list in Vim
:argd :argdelete (e.g. ":argdelete file1.txt" or "*.txt" or "%")
114
edit file N in the argument list
:argu :argument (e.g. ":argu 3" or ":3argu")
115
write and quit all (TWO different command-line commands)
:wqa :xa
116
quit all files
:qa :quitall
117
quit without saving
:q! quit!
118
technical difference between ":wq" and ":x"
":wq" writes and quits no matter what, whereas ":x" writes and quits, but only actually does the "write" if the file was changed
119
uppercase letters to write current file, if modified, and quit
ZZ (same as ":x")
120
uppercase letters to quit without checking for changes
ZQ (same as ":q!")
121
close the current window (command-line command and keybinding)
:clo :close CTRL-W c
122
quit the current window (command-line command and keybinding)
:q :quit CTRL-W q
123
what is the technical difference between ":quit" and ":close"
":quit" will quit Vim if you're in the last open window, whereas ":close" will make sure to leave Vim open
124
jump between the previous file and the current file (back and forth as desired)
CTRL-^ (technically, will jump to the "alternate file", which is the most-recently viewed one)
125
jump to buffer N (command line command and keybinding)
:Nbuf :Nbuffer N CTRL-^
126
how backups work by default in Vim, what option controls this behavior
backup is made, file is overwritten, backup is deleted (this is the behavior of the 'wb' 'writebackup' option)
127
keep backups from being deleted automatically after write
'bk' 'backup' 'nobk' 'nobackup' (e.g. ":set backup")
128
what backup filenames look like by default
"file.txt~" with a tilde
129
setting to make a custom backup-file signifier
'bex' 'backupext' (e.g. ":set backupext=.backup")
130
backup to a specified directory instead of just cwd
'bdir' 'backupdir' (e.g. ":set backupdir=DIRECTORY")
131
how to keep a backup of the original file before any changes were made, also, what is prerequisite for this to work
:set patchmode=.orig (".orig" is the extension); requires 'backupdir' to be set for this to work
132
how to open a file in read-only mode
nvim -R file.txt (bonus! you may also be able to simply use the command "view file.txt" from Linux)
133
what is the difference between "nvim -R file.txt" and "nvim -M file.txt"
"-R" is read-only mode, which will warn before saving, whereas "-M" is even more strict, opening Vim with the 'modifiable' setting switched off
134
how can you remove the read-only setting if you opened a file in read-only mode
:set write (inverse of ":set nowrite"), no shortened version of this option
135
how you can remove the "modifiable" protection and make a file modifiable again
'ma' 'modifiable' 'noma' 'nomodifiable' (e.g. ":set modifiable")
136
how to append to a file instead of simply writing one
:write >> file.txt (append current buffer to file.txt)
137
how to save a copy of the file with a new name, but keep on editing the file with the original name
:write file2.txt
138
save a copy of a file and continue editing the file with the new name
:saveas file2.txt
139
display information about the current file (both command-line command and keybinding)
:f :file CTRL-G
140
split current buffer into two separate (horizontal) windows (command-line command and keybinding)
:sp :split CTRL-W s
141
which window will have the cursor after a horizontal split
the top window
142
which window will have the cursor after a vertical split
the left window
143
create a new split window that is 3 lines high
:3split (note that count must precede the command)
144
split and open a specified file in the new window
:sp :split FILE (e.g. ":split file2.txt")
145
split (horizontally) and open a new file in the new split (command-line command and keybinding)
:new CTRL-W n
146
split the current buffer into two VERTICAL windows (command-line command and keybinding)
:vsp :vsplit CTRL-W v
147
create a vertical split with a specified file
:vsp :vsplit file2.txt
148
create a vertical split with a new file
:vne :vnew
149
hide the current buffer
:hid :hide
150
close all other windows except the current one (command-line command and keybinding)
:on :only CTRL-W o
151
jump from window to window
CTRL-W w
152
move to window to the left, down, up, or to the right
CTRL-W h j k l
153
move to the top window
CTRL-W t
154
move to the bottom window
CTRL-W b
155
rotate all windows downwards/rightwards (clockwise) or upwards/leftwards (counter-clockwise)
CTRL-W r and CTRL-W R
156
swap current window with the next one (or the previous if there is no "next" window)
CTRL-W x
157
swap current window with the third window from the top
3 CTRL-W x (windows increment starting with "1")
158
move window left, down, up, or right
CTRL-W H J K L
159
move current window to a new tab page
CTRL-W T (uppercase "T")
160
move current window to a new tab page before tab three
3 CTRL-W T
161
make all windows the same height and width
CTRL-W =
162
increase/decrease size of window (also, increase/decrease by four lines) (command-line command and keybinding)
:resize +4/-4 CTRL-W +/- and 4 CTRL-W +/-
163
set current window as high as possible, "maximize" (command-line command and keybinding)
:res :resize (with no arguments) CTRL-W _
164
set current window height to a specific number of rows (command line and keybinding), also, a "bonus" shortcut for this
:resize N [N]CTRL-W _ z{nr}
165
make window wider/narrower, make window wider/narrower by three columns (command-line command and keybinding)
:vert :vertical resize +3/-3 CTRL-W >//< (three columns)
166
how to make the new window you're creating appear to the right or below rather than to the default above or left
:rightb :rightbelow / :bel :belowright (bonus FYI, ":lefta :leftabove" / ":abo :aboveleft" are the inverse counterparts of these
167
how to make the new window you're creating all the way at the top and/or to the left, OR bottom and/or right
:to :topleft / :bo :botright (but NOT :bottomright)
168
the two options that will alter the default above/left behavior for window splits
'sb' 'splitbelow' 'nosb' 'nosplitbelow' 'spr' 'splitright' 'nospr' 'nosplitright' (e.g. ":set splitbelow")
169
settings to set the DESIRED (not hard) minimum hight and width of a new window also, what is the default and minimum setting for this
'wh' 'winheight' 'wiw' 'winwidth' e.g. ":set wiw=5" minimum and default setting is "1"
170
settings for the hard minimum height and width to enforce for other windows (besides the new one you're opening)
'wmh' 'winminheight' 'wmw' 'minwinwidth'
171
reasonable values for the 'winminheight' option
0-3, where zero will just be the separator itself (too large a number will cause errors when opening multiple windows)
172
reasonable values for the 'winminwidth' option
0-12, where zero will just be the separator itself (too large a number will cause errors when opening multiple windows)
173
option to automatically resize all windows to have equal spacing among them (default on)
'ea' 'equalalways' 'noea' 'noequalalways'
174
how do you open Vim in diff mode
nvim -d main.c~ main.c (in this example using a backup file as a means of comparison)
175
how do you go into diff mode from within Vim
:vertical diffsplit main.c~ (compare "main.c~" with the file you're currently editing, presumably "main.c")
176
make it so that the two windows no longer scroll together in diff mode
:set noscrollbind ('scb' 'scrollbind' 'noscb' 'noscrollbind')
177
jump to the next/previous change in diff mode, jump three changes forward/back
]c / [c used with a count, 3]c / 3[c
178
in diff mode, replace deleted text when you're in the LEFT window
dp (remember "diff put")
179
in diff mode, remove changes when you're in the RIGHT window
do (remember "diff obtain")
180
open Vim with multiple files in separate tab pages
nvim -p file1.txt file2.txt
181
open a file in a new tab page within Vim
:tabedit FILE
182
open a new tab with an empty window
:tabnew
183
close all tabs except current
:tabonly
184
close current tab
:tabc :tabclose
185
close all tabs except tab number two
:2tabonly OR :tabonly 2
186
go to next tab/previous tab, go to tab number 3 (command-line command and keybindings)
:tabnext :tabprevious gt / gT 3gt ALSO CTRL-/ (works in both normal and insert mode)
187
go to first/last tab page
:tabfirst :tablast
188
make the current tab the last one
:tabm :tabmove (default behaviour of ":tabmove" is to put current tab at the end--":tabmove $" will also work)
189
move current tab left, right, after tab 2, or to the beginning
:-tabmove :+tabmove :2tabmove :0tabmove (also can use ":tabm" for short) (yes, it is fine to put the number after the command as well)
190
split window and jump to alternate file (command-line command and keybinding)
:split # CTRL-W ^
191
start/stop recording a macro
q{register} / q (note that you can paste the contents of the register if you need to tweak something)
192
execute macro, execute macro more than once
@{register} {count}@{register}
193
how does the "g" flag modify the ":substitute" command (i.e. ":s/a/b/g" vs ":s/a/b/")
replace all matches on the line instead of just the first
194
how does the "c" flag modify the ":substitute" command (i.e. ":%s/a/b/c")
confirm
195
what are the confirm options for the substitute "c" flag (i.e. ":%s/a/b/c)
y (yes; make this change) n (no; skip this match) a (all; change all remaining without further confirmation) q (quit; don't make this change either) l (make this the last change)
196
what do CTRL-E and CTRL-Y do in substitute confirm mode
scroll the text one line down/up, as expected
197
command to see the name of the current swap file being used
:sw :swapname
198
command-line flag to start Vim without using swap file
nvim -n file.txt
199
when is the swap file updated by default
after typing 200 characters or when you haven't typed anything for 4 seconds
200
setting to change the number of characters for the interval of writing to the swap file
'uc' 'updatecount' (e.g. ":set updatecount=1000")
201
setting to change the time to wait after idle before writing to swap file
'ut' 'updatetime' (e.g. ":set updatetime=1000" (in milliseconds))
202
turn off writing to swap file
:set updatecount=0 (will turn off writing to swap file completely!)
203
command to write all text for all buffers into swap file(s)
:pre :preserve
204
how to launch Vim to recover a file you were editing (also, what if there was no filename?)
nvim -r FILE nvim -r "" (if no filename)
205
view all swap files found in a directory when starting Vim
nvim -r
206
swap file warning you will get when the swap file is NEWER than the file being opened (meaning, it might have saved some lost work)
YES
207
swap file warning you will get when the file is already opened elsewhere
process ID: 12559 (still running)
208
go to beginning/end of your line when using the command line
CTRL-B / CTRL-E (or / )
209
at command line, complete to longest unambiguous string
CTRL-L (mnemonic, "complete Line")
210
AT COMMAND LINE, show all possible completions based on what you've typed
CTRL-D (mnemonic, "Do this for me..." or "Don't make me work here")
211
at command-line (or search), open up a small window for easier editing
CTRL-F (mnemonic "Fix it up")
212
open up the command-line window (with browsable command/search history)
or q/
213
stop browsing at the command-line window and place the current line ready to execute
CTRL-C
214
delete whole word backward at command-line
CTRL-W
215
delete whole line (and "start over") at command-line
CTRL-U
216
command to just view non-interactive list of command-line / search history
:his :history :history /
217
suspend Vim and go back to command prompt (command-line command and keybinding)
:suspend CTRL-Z
218
if you have suspended Vim, how do you get back to it from the shell
fg
219
how to read the output of a program into Vim
:r :read !{program}
220
send text from Vim to be the input of another program
:w :write !{program}
221
filter text from Vim through an external program
:[range]!{program}
222
view a list of recent files
:bro o :browse oldfiles
223
special mark that is set with the last cursor position and file when exiting Vim
'0 (and these get pushed to '1, '2, '3, etc., cycling through and dropping off after '9) (note this was broken in v0.2.2 and will be fixed for future)
224
difference between a "session" and a "view"
a "session" saves everything (window sizes and positions, mappings, option values), whereas a "view" just saves settings related to just one window (e.g. number/nonumber setting, folds, etc.) also note that making a session saves views on all windows automatically
225
command to save a session
:mks :mksession [my_session.vim] (if omitted, filename will default to Session.vim)
226
restore a session from within Vim
:source my_session.vim
227
restore a session when opening Vim
vim -S my_session.vim
228
command to save a view, also, what are the three ways you can save a view
:mkvie :mkview (unnumbered, let Vim worry about name) :mkview 1-9 (additional nine numbered views possible per file) :mkview my_view.vim (specific file name, can be used on another file)
229
what are modelines
specific lines hardcoded at the beginning and/or end of a file that specify configuration settings
230
what are the default lines that Vim checks for modelines
the first five lines and the last five lines
231
setting to change how many lines to have Vim look for modelines, also, how to turn off modelines
:set modelines=10 :set nomodelines
232
syntax for a modeline
any-text vim:set {option}={value} {option}={value} ... : any-text (if you want other text after the modelines, the ":" tells Vim to stop interpreting the modeline--escape with "\:" if needed)
233
change current working directory globally, for current tab, for current window
:cd :tcd :lcd
234
go to file name under cursor and edit
gf
235
change working directory to directory of current file
:cd %:p:h
236
setting to AUTOMATICALLY set the working directory to be that of the currently open file
'acd' 'autochdir' 'noacd' 'noautochdir' (e.g. ":set autochdir")
237
edit a file from anywhere in the current 'path'
:fin :find (like :edit but will look for file anywhere in current 'path') also :splitfind, :tabfind, etc.
238
"u" in buffer list
an "unlisted" buffer (see :help unlisted-buffer)
239
"%" in buffer list
the current buffer
240
"#" in buffer list
the alternate buffer
241
"a" in buffer list
buffer is loaded and displayed (active)
242
"h" in buffer list
buffer is loaded but hidden
243
"=" in buffer list
buffer is read-only (mnemonic, file contents "equals" what it was when it was loaded)
244
"-" in buffer list
buffer is "not modifiable" (i.e. 'modifiable' is turned off) (mnemonic: if "+" means modified, "-" means "not able to be modified")
245
"+" in buffer list
buffer has been modified
246
command to view buffer list
:ls :buffers
247
switch to buffer 2
:2b :2buffer or :b 2 :buffer 2 (can also type part of filename)
248
list all buffers, including unlisted buffers (like help entries open)
:buffers! (or :ls!)
249
make an abbreviation
:ab :abbreviate jm John Maughan
250
remove an abbreviation
:una :unabbreviate jm
251
clear all abbreviations
:abc :abclear
252
how are abbreviations different from keybindings
abbreviations are triggered when you type a space, whereas keybindings will trigger as soon as the key combination is typed
253
paste text, aligning indent with surrounding indentation
]p
254
indent/unindent the line by 'shiftwidth' spaces (in normal mode)
>> / <
255
indent/unindent current line from insert mode
CTRL-T / CTRL-D (remember "T"ab and "D"elete tab)
256
in insert mode, delete previous word
CTRL-W
257
in insert mode, delete whole line
CTRL-U
258
in insert mode, copy character from above / below the current line
CTRL-Y / CTRL-E
259
in insert mode, paste the contents of a register
CTRL-R{register} (mnemonic "Register")
260
in insert mode, insert a literal character (like a special character)
CTRL-V {character}
261
in insert mode, insert a literal tab (useful for when using SuperTab)
CTRL-I
262
in insert mode, execute a single command and then return to insert mode
CTRL-O {command}
263
in insert mode, insert the text you typed last time you were in insert mode, do this and exit insert mode
CTRL-A CTRL-@
264
when operating on search results, visually select the next/previous match
gn / gN (using these, you don't have to press "n.", because just "." will actually make the change for you!)
265
when operating on search results, delete, change, or make next match uppercase
dgn (delete next match) cgn (change next match) gUgn (make next match uppercase
266
command to turn spell checking on/off
:set spell :set nospell (no abbreviated version of these)
267
custom keybinding (from vimcast) for quickly toggling spell check
{leader}s
268
add word under cursor as a good/wrong word to spellfile, to internal word list
zg / zw zG / gW
269
describe difference between spellfile and internal word list
the spellfile is persistent, whereas the internal word list is discarded when exiting Vim
270
describe what marking a word "wrong" actually does in the spellfile
turns existing entries into comment lines, thus the file only grows in length
271
undo marking a word as "good"/"wrong" in spellfile, in internal word list
zug / zuw zuG / zuW
272
suggest/cancel suggesting correctly spelled words for word under cursor in spell-check mode
z= (CTRL-C to cancel) (mnemonic "what might equal the correct word")
273
trigger spelling completions
CTRL-X s
274
clean up commented lines in spellfile
:runtime /spell/cleanadd.vim
275
command-line commands to add a "good" or "wrong" word to spellfile/internal word list
:spe :spellgood {word} :spellw :spellwrong {word} append a "!" to only add to the internal word list (e.g. :spe! tyger)
276
next/previous misspelled word, also, same but only stop at "wrong" words, skipping rare words or words from another region
]s / [s ]S / [S
277
how to toggle an option in vim
append an exclamation mark "!", e.g. ":set wrap!" to toggle the option back and forth
278
turn off soft wrapping lines longer than the width of the window
'wrap' 'nowrap' (e.g. ":set nowrap") (no shorter form)
279
when soft wrapping is on, wrap lines lines at word breaks instead of in the middle
'lbr' 'linebreak' (bonus: will wrap long lines at a character in 'breakat' option)
280
setting for inserting actual line breaks if lines get longer than a certain length
'tw' 'textwidth', e.g. ":set tw=72" (and 'fo' needs "t" in it)
281
cause wrapped lines to continue visually indented
'bri' 'breakindent' (and 'nobri' 'nobreakindent' of course)
282
cause wrapped lines to show a string of your choosing before the wrapped text (default string is "")
'sbr' 'showbreak', e.g. ":set sbr=>\ " (backslash to escape space)
283
how to treat a setting value like a variable, and why one would do this
prepend an ampersand, e.g. :let &showbreak = '+++ ' this allows you to avoid having to escape spaces
284
turn on/off display of non-print characters
'list' 'nolist'
285
turn on/off line numbering
'nu' 'number' 'nonu' 'nonumber'
286
check if any buffers were changed outside of Vim, and, if 'autoread' is set (it will be by default in Neovim), reload the file
:checkt :checktime
287
trigger word completion, cycle through previous/next completion
CTRL-P, CTRL-P / CTRL-N to cycle backwards/forwards
288
complete whole lines
CTRL-X CTRL-L
289
complete keywords in thesaurus
CTRL-X CTRL-T
290
complete keywords in dictionary
CTRL-X CTRL-D
291
complete file name
CTRL-X CTRL-F
292
show the current state of an option
append a question mark to the setting when using the set command, e.g. ":set number?"
293
jump to matching ), ], or }
%
294
delete specified mark or marks delete marks "a", "b", and "1"delete marks in range from "a" to "z"delete all marks for current buffer
:delm :delmarks:delm a b 1:delm a-z:delm!
295
motion to go to beginning/end of sentence
( / )
296
motion to go to the beginning / end of a paragraph
{ / }
297
setting to change how substitute effects are shown as you type (also, what are the options you can use for it)
'icm' 'inccommand' "" (no feedback), "nosplit" (show effects incrementally, as you type, "split" (show results in preview window) (e.g. ":set icm=nosplit")
298
turn off search wrapping from bottom to top (default is on)
'ws' 'wrapscan' 'nows' 'nowrapscan' (e.g. ":set nowrapscan")
299
four levels of "magic" that can be specified as flags for a regular expression (also, what is the default setting?)
'magic' is set to on by default, and is recommended to be kept to avoid breaking plugins\m (interpret as if 'magic' is set, only [$.*~] have special meaning, the rest have to be escaped with "\" in order to be special)\M (interpret as if 'nomagic' is set, only [$] has special meaning)\v ("very magic", all characters have special meaning except [0-9a-zA-Z_] (like you would expect as normal in Python--you have to escape any special characters you do not want to be treated as special)\V ("very nomagic" only the "\" and the terminating character have special meaning)
300
move up/down one screen line, move to beginning/end of screen line
gk / gj g0, g^, and g$
301
init.vim keybinding to clear search highlighting
CTRL-L
302
init.vim keybinding to toggle spell check
s
303
commentary.vim: comment or uncomment a motion
gc{motion}
304
commentary.vim comment or uncomment [count] lines
[count]gcc
305
commentary.vim: comment or uncomment the visual-mode highlighted lines
{visual}gc
306
commentary.vim: text object for a comment for use in operator pending mode
gc
307
commentary.vim: uncomment the current and adjacent commented lines
gcgc OR gcu
308
commentary.vim: comment or uncomment [range] lines from command line
:[range]Commentary
309
center lines in [range] between [width] columns, also, what are defaults
:ce :center (e.g. ":[range]center [width]" ":3,4ce 50" ":0,$center 40"), default is 'textwidth' or 80 characters if 'textwidth' is 0
310
right-align lines in [range] at [width] columns, also list defaults
:ri :right (e.g. ":[range]right [width]"), default 'textwidth' or 80 if 'textwidth' is 0
311
left-align lines in [range], also list defaults
:le :left (e.g. :[range]left [indent]), default indent is 0
312
what is the difference between gq and gw
"gw" puts the cursor back to its original position and does not use any external program, whereas "gq" leaves the cursor in its new position and will use either 'formatexpr' or 'formatprg' if found in preference over just formatting the text internally
313
how to format the current line, format current paragraph, format N lines
gqgq OR gqq, gqap, [count]gqq (used with count you can do like 3gqgq to format 3 lines) also, you could use "{visual}gq" or "gq{motion}" note that all the same are available with "gw" (e.g. "gwgw" or "gww")
314
how to set Vim to do formatting by use of an external program
'fp' 'formatprg' (e.g. ":set formatprg=yapf"), note that such a program must take input through stdin and send output to stdout
315
how to set the line-ending style in Neovim
'ff' 'fileformat' (e.g. ":set fileformat=dos"), can be "dos" (CRLF) "unix" (LF) or "mac" (CR)
316
view list of digraphs in Vim
:dig :digraphs
317
how to enter a digraph in Vim (two methods)
CTRL-K {char1} {char2} OR turn on 'digraph' option and do {char1} {char2}
318
setting to allow digraphs from insert mode
'dg' 'digraph' 'nodg' 'nodigraph'
319
setting to change the directory for the swap file also, set as same directory as edited file
'dir' 'directory' :set dir=.
320
default location of swap file in Neovim
$XDG_DATA_HOME/nvim/swap
321
where is $XDG_DATA_HOME for Neovim
~/.local/share/nvim ~/AppData/Local/nvim-data
322
where is $XDG_CONFIG_HOME (Linux and Windows)
~/.config/nvim ~/AppData/Local/nvim
323
how to change the number of files that will be remembered for ":browse oldfiles"
'sd' 'shada' with ' paramenter (e.g. ":set shada='25") (may need to wipe your shada file before the change will be reflected)
324
setting that specifies options for how text is formatted
'fo' 'formatoptions'
325
default setting for 'formatoptions'
tcqj
326
format option to auto-wrap text using 'textwidth'
t
327
format option to auto-wrap comments using textwidth (also, how to wrap for comments but NOT for normal text)
c (for comments only, ":set fo-=t" and ":set fo+=c")
328
format option to automatically continue comments when you press , also, format option to continue comments when you use "o" or "O" in normal mode
r (for , mnemonic "Return") o (for "o" and "O")
329
format option to automatically format paragraphs (every time text is added or deleted paragraph will be reformatted)
a (mnemonic "Automatically / Always")
330
format option to recognize numbered lists
n
331
format option to leave long lines alone when you're entering insert mode (if it was already longer than 'textwidth' when you started, leave it alone)
l (lowercase letter "L")
332
describe helpful combinations of format options "" "t" "c" "tc"
"" no automatic formatting (you can still use "gq" for manual formatting)"t" automatically format text, but not comments"c" automatically format comments, but not text"tc" automatically format comments and text
333
format option to make whitespace at end of line signal paragraph continuation
w (mnemonic "whitespace")
334
setting for how many spaces a character looks like on screen, also, what is default
'ts' 'tabstop' default is 8
335
setting for number of "spaces" of width to put in when pressing and when editing text (Vim will then convert to the appropriate number of tabs/spaces)
'sts' 'softtabstop' (e.g. ":set sts=4") 0 is default (which means turned off) NOTE--this will combine tabs and spaces as necessary to reach the value of 'sts' as needed, unless 'expandtab' is also set
336
setting indicating number of spaces to use for each step of autoindent (">>", "<
'sw' 'shiftwidth' default is 8
337
setting to use spaces instead of tabs, also, what is default
'et' 'expandtab' 'noet' 'noexpandtab' default is off
338
command to redo tabs/spaces in file, also, how to replace tabs with spaces
:retab to replace tabs with space, just run this with 'expandtab' turned on
339
display whitespace characters
'list' 'nolist' (no abbreviated versions)
340
setting that controls how ":list" command displays characters
'lcs' 'listchars'
341
open Vim and go to line number 57
nvim +57 file.txt
342
open Vim and search for "something" immediately
nvim +/something file.txt
343
how to make a pattern case sensitive or insensitive
add "\c" anywhere in pattern to make case insensitive or "\C" to make the pattern case sensitive
344
how does 'smartcase' work
'scs' 'smartcase' 'noscs' 'nosmartcase' will make the search case insensitive unless you include a capital letter (when 'ignorecase' is turned on)
345
how to apply a command multiple times to all files in argument list, to all buffers, to all tabs, or to all windows in the current tab
:argdo :bufdo :tabdo :windo
346
option to hide a buffer instead of abandon it when you unload it, also, how will this change behavior
'hid' 'hidden' 'nohid' 'nohidden' vim won't complain and make you add a "!" when you unload a buffer by ":close" or ":quit"; it will just hide them and hope you remember to write all before you quit (it will still warn you if you try to exit Vim with unsaved buffers)
347
how to execute normal mode commands from the command line
:norm :normal the optional "!" ignores mappings
348
how to execute a macro on all buffers
:bufdo normal! @a (the exclamation makes the command not use mappings)
349
format option to allow formatting of comments when using gq
q
350
what symbol designates the default (unnamed) register
"
351
how to paste text from register into command line
CTRL-R{register}
352
how to append to a register instead of overwrite it
use a capital letter, e.g. "B" to append to register "b"
353
buffer that contains the last-used search pattern
/
354
buffer that contains the last-used command-line command
:
355
option to show a column in a different color shade to signal a certain number of columns
'cc' 'colorcolumn' (e.g. ":set colorcolumn=80")
356
setting that controls how to recognize lists when using the "n" formatoption setting
'flp' 'formatlistpat'
357
command restore a view
:lo :loadview [nr]
358
option that controls where views are stored
'vdir' 'viewdir'
359
setting that handles what gets stored in views
'vop' 'viewoptions'
360
move to next/previous function or class definition
]] / [[
361
move forwards to the end / backwards to the end of a function
][ / []
362
setting to set what gets saved in session files
'ssop' 'sessionoptions'
363
warning you will get when you have an old swap file
NEWER than swap file!
364
close current buffer and open a new, blank file
:ene :enew
365
how to set current buffer as read-only
:ro :readonly
366
move cursor to previous (last-accessed) window
CTRL-W p (or CTRL-W CTRL-P)
367
digraph for "en dash"
-N
368
digraph for "em dash"
-M
369
digraph for superscript/subscript numbers
{number}S / {number}s (number can be any of [0-9+=-n()] )
370
digraph for tilde over letter (like "n")
{letter}? (e.g. "n?")
371
digraph for acute accent
{letter}' (e.g. "i'")
372
activate the Vim file browser
:edit . OR :Explore
373
from Vim file browser, display file in horizontal, vertical split, preview window, previous window, or a new tab page
o (horizontally split) v (vertically split) p (preview window) P (previous window) t (new tab page)
374
from Vim file browser, reverse the sort order
r
375
from Vim file browser, change listing style
i
376
from Vim file browser, change the way files are sorted (also, what are the three options)
s name, mod time, size
377
from Vim file browser, change current directory to browser directory
c
378
from Vim file browser, rename the file or directory under cursor
R
379
from Vim file browser, delete file or directory under cursor
D
380
from Vim file browser, make bookmark / goto bookmark
mb / gb
381
from Vim file browser, go to parent directory
-
382
create fold
zf
383
command to create a fold for lines in {range}
:{range}fo :{range}fold
384
open fold / close fold open all folds at cursor / close all folds at cursor
zo / zc zO / zC
385
"reduce" folding / more folding, also, open all folds / close all folds
zr / zm zR / zM
386
disable folding / bring back folding, also, toggle between these two states
zn / zN zi
387
move to start/end of current open fold, what does this do if already at start/end
[z / ]z (if already at start/end, move to start/end of containing fold)
388
move down to the start of the next / up to the beginning of the previous fold
zj / zk
389
delete single fold at cursor line (shift sub-folds up one level) / delete all folds at cursor line recursively (all sub-folds get deleted)
zd / zD
390
delete all folds in window
zE (mnemonic: "eliminate" all folds)
391
setting to make folds automatically open as you scroll over them
'fdo' 'foldopen' (specifically, ":set foldopen=all")
392
setting to automatically close folds as you move out of them
'fcl' 'foldclose' (specifically, ":set foldclose=all")
393
setting to change how folds are handled for the window, what is the default method
'fdm' 'foldmethod' default foldmethod is "manual"
394
how to set folds to be automatic based on indentation
:set fdm=indent
395
how to set folds to be set using 'foldmarker' in your text
:set fdm=marker
396
setting to use filetype-specific syntax to specify folds
:set fdm=syntax
397
setting to automatically define folds in a diff to fold text that has not changed
:set fdm=diff
398
setting to define folds manually
:set fdm=manual
399
display a small left-hand column to visualize folds
'fdc' 'foldcolumn' (e.g. ":set foldcolumn=4") Bonus! You can actually just click on the folds in the foldcolumn to open and close!
400
surround.vim: delete surrounding character
ds" ds) dst
401
surround.vim: change surroundings
cs{from}{to} cs"' cs)]
402
surround.vim: wrap {motion or text object} in desired surroundings
ys{motion or text object}{surrounding} ysiw) yss"
403
surround.vim: wrap whole line in desired surroundings
yss{surrounding}
404
surround.vim: variant to indent surrounded text and place on a line of its own
yS and ySS
405
surround.vim: surround something from visual mode
S{surrounding}
406
surround.vim: how to surround with/without whitespace
opening marks ADD whitespace, closing marks do not
407
jump to tag under cursor
CTRL-]
408
go to preceding tag (keybinding and command-line command)
CTRL-T :pop
409
split window and jump to tag under cursor do same but make window 5 lines high
CTRL-W ] 5CTRL-W ]
410
show list of tags you have traversed through
:tags
411
jump forward three tags
:3tag
412
jump to tag by a specific name
:tag {identifer}
413
command to split window and jump to a specific tag by name
:stag {ident}
414
select among options for the same tag name
:tselect TAGNAME
415
navigate next/previous and first/last when going through tags with same name
:tnext / :tprevious :tfirst / :tlast (:tnext and :tprevious can be used with a count as well, e.g. ":3tnext")
416
cycle through possible tags beginning with a certain word
:tag write_ (cycle through tags beginning with "write_")
417
cycle through possible tags containing pattern
:tag /block (cycle through tags containing the pattern "block")
418
open preview window to display "tag_name"
:ptag tag_name
419
open preview window to display tag under cursor (keybinding)
CTRL-W }
420
close preview window
:pclose
421
edit a file in preview window
:pedit file.txt
422
setting to specify the height of the preview window, also, what is default
'pvh' 'previewheight' default is 12
423
go to definition (two keybindings with related meanings)
gd (supposed to be local) gD (supposed to be global) but for Python, the entire module (including comments) is the namespace
424
undo one change (keybinding and command-line command), also, describe behavior of this
u :u :undo has the effect of walking up the undo tree
425
redo one change (keybinding and command-line command), also describe behavior
CTRL-R :red :redo walk down the undo tree, branching to newest branch
426
go to older/newer time-based text state (keybindings and command-line commands), also, how is this different from "normal" undo
g- / g+ :ea :earlier / :lat :later these will get you to all possible text states, wheras "normal" undo is tree based and will only take you down the newest branch of the undo tree
427
go to older/newer time-based undo by changes in text state, seconds, minutes, hours, days, or file writes
:earlier/later {N}[s/m/h/d/f] (number without a letter will jump older {count} times, whearas appending the appropriate letter will do so by time specifier)
428
go back to the state exactly as it was when you last saved the file
:earlier 1f
429
go back to the state as it was 4 days ago
:earlier 4d
430
go back to the state as it was 3 hours ago
:earlier 3h
431
yankstack.vim: cycle backward/forward through history of yanks
Alt-P / Alt-Shift-P
432
yankstack.vim: view history of yanks
:Yanks
433
where views are stored by default
$XDG_DATA_HOME/nvim/view
434
branch ("or" logic)
\|
435
concat ("and" logic)
\&
436
0 or more as many as possible
*
437
regex; 1 or more as many as possible
\+
438
0 or 1 as many as possible
\?
439
n to m as many as possible
\{n,m}
440
n exactly
\{n}
441
at least n as many as possible
\{n,}
442
0 to m as many as possible
\{,m}
443
n to m as few as possible
\{-n,m}
444
n exactly
\{-n}
445
at least n as few as possible
\{-n,}
446
0 to m as few as possible
\{-,m}
447
0 or more as few as possible
\{-}
448
start-of-line
^
449
end-of-line
$
450
any single character
.
451
beginning of word
\
452
end of word
\>
453
whitespace / not whitespace
\s \S
454
digit / non-digit
\d \D
455
hex digit / non-hex digit
\x \X
456
octal digit / non-octal digit
\o \O
457
word character / non-word character [0-9A-Za-z_]
\w \W
458
alphabetic character / non-alphabetic character
\a \A
459
lowercase character / non-lowercase character
\l \L
460
uppercase character / non-uppercase character
\u \U
461
match character
\t
462
match newline character
\n
463
last given substitute string
~ (no escaping needed)
464
group
\(\)
465
string matched by first group
\1
466
character class (any one of the characters in the class)
[] (no escaping needed)
467
ignore case for whole pattern / match case for whole pattern
\c \C (may be used anywhere in pattern)
468
"very magic" on for the following characters / "very nomagic" on for the following characters "magic" / "nomagic" for the following characters
\v \V \m \M
469
quick help (e.g., quick Python help from Vim)
K
470
show a column on the left of screen that shows open and closed folds
'fdc' 'foldcolumn' (e.g. "set fdc=3") maximum value is 12
471
from Vim file browser, list bookmarks
qb (mnemonic: "query bookmarks)
472
from Vim file browser, go to previous / next folder (walk history backwards / forwards)
u / U
473
scroll [count] characters to the right/left scroll half a screenwidth right/left
[count]zl / [count]zh zL / zH (also can use z and z for single character scrolling)