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
Q

put the line with the cursor at the top of the screen

A

zt

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

put the line with the cursor at the bottom of the screen

A

zb

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

search (forward and backward)

A

/ forward ? backward

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

go to next/previous search result

A

n/N (note that “next” could be either forward or backward depending on whether / or ? is used)

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

setting to always make searches case-insensitive / sensitive (also, what is the default?)

A

‘ic’ ‘ignorecase’ ‘noic’ ‘noignorecase’ e.g. “:set ic” (default is ‘noignorecase’, so searches are case-sensitive by default)

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

use the current word under the cursor and search forward/backward (like “/” or “?”)

A
  • (forward), # (backward)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

SEARCH for the third next word under the cursor

A

3* (used with count)

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

turn off search highlighting temporarily

A

:noh :nohlsearch (command)

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

turn off search highlighting permanently

A

‘nohls’ ‘nohlsearch’ e.g. “:set nohls”

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

enable/disable display of search matches while you’re still typing (this is on by default)

A

‘is’ ‘incsearch’ ‘nois’ ‘noincsearch’ :set is/:set nois (this setting is on by default):

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

define a “jump”

A

anything farther than one line (not including “j” and “k” with count though)

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

jump back and forth between two recent JUMPS

A

`` (to the actual cursor position in the line) or ‘’ (to the beginning of line)

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

go to older/newer location in jump list

A

CTRL-O older / CTRL-I newer (also )

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

display list of recent jumps

A

:ju :jumps

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

mark place under cursor with an “a”

A

ma (marks can be “a-z”)

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

jump to mark “q”

A

q or 'q ( for intra-line, ‘ for beginning of line)

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

display list of marks

A

:marks (no abbreviated version)

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

clear the jump list of the current window

A

:cle :clearjumps

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

special mark for cursor position from just before most recent jump

A

’ or ` (e.g. `` or ‘’ to get back to where you were last)

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

special mark for cursor position from when last editing the file

A

” (e.g. `” or ‘” to get back to where you were when last editing the file)

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

special marks for the start/end of the last change

A

[ / ]

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

difference between uppercase and lowercase marks

A

lowercase marks are specific to one file, whereas uppercase marks are global and can be used from any file

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

see where “F” is marked, see where “M”, “C”, and “P” are marked

A

:marks F :marks MCP

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

delete operator

A

d{motion}

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

delete whole line

A

dd

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

change whole line (but keep indent) (two ways of doing this!)

A

cc (or S)

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

delete character under/before cursor

A

x (same as “dl”) / X (same as “dh”)

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

delete to end of line

A

D (same as “d$”)

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

change one character

A

s (same as “cl”)

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

replace one character

A

r{character}

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

replace mode

A

R

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

repeat last change

A

.

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

character-based/line-based/block-based visual mode

A

v / V / CTRL-V

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

change to other side of selection in visual mode

A

o (“o”ther)

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

change to opposite set of corners when in block-based visual mode

A

O (“O”ther)

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

re-select the most-recently selected visual area

A

gv

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

put copied text after/before cursor

A

p / P

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

put three copies of copied text after cursor

A

3p

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

swap two characters

A

xp (simply the commands “x”, then “p”)

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

copy text specified by a given movement

A

y{movement} (remember “yank”)

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

copy whole line

A

yy

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

copy to end of line

A

Y (must be mapped to do so in init.vim, since by default it acts identical to “yy”)

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

copy using normal clipboard instead of register, paste using normal clipboard instead of register

A

y “p (or you can use “+” instead of “*”)

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

what “ab” and “aB” text objects represent

A

“a(“ and “a{“

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

change case of one character and move forward

A

~

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

switch case of current line

A

g~g~ or g~~

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

lowercase/uppercase the text indicated by a given motion

A

gu{motion} / gU{motion}

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

make current line uppercase / lowercase

A

gUgU or gUU gugu or guu

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

make highlighted text lowercase/uppercase in visual mode

A

u / U

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

append at end of line, insert at beginning of line

A

A I

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

text objects for an HTML or XML tag block (e.g. …)

A

at / it

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

text objects for words, sentences, and paragraphs

A

iw/aw is/as ip/ap

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

add one to the number under the cursor, add three

A

CTRL-A 3CTRL-A

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

subtract one from the number under the cursor, subtract three

A

CTRL-X 3CTRL-X

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

create an incrementing sequence

A

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”.

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

location of init.vim, Linux

A

~/.config/nvim/init.vim

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

location of init.vim, Windows

A

~/AppData/Local/nvim/init.vim

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

reset an option to its default state

A

end with “&”, e.g. “:set iskeyword&”

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

what distinguishes a “setting” in the help files

A

single quotes, e.g. :help ‘wrap’

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

how to find help for a visual mode command

A

prepend “v_”, e.g. :help v_u

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

how to find help for an insert mode command

A

prepend “i_”, e.g. :help i_CTRL W

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

how to find help for a command-line command

A

prepend “:”, e.g. :help :quit

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

how to find help for editing text in the command-line

A

prepend “c_”, e.g. :help c_

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

how to find help for a Vim start-up option

A

prepend “-“, e.g. :help -r

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

how to find help for a regular expression

A

prepend “/”, e.g. :help /[

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

how to search for a help topic

A

type “:help word” and then press CTRL-D to see matching entries for “word” (or use “:helpgrep word”)

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

change background to dark/light version of color scheme

A

‘bg’ ‘background’ (e.g. “:set background=dark/light”)

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

change color scheme

A

:colorscheme evening

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

print a physical paper copy of a file, print only a portion of a file

A

:hardcopy highlight with visual mode before printing

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

settings relating to physical printing of a file

A

look at settings beginning with ‘print*’, e.g. ‘printdevice’ ‘printheader’ ‘printfont’ ‘printoptions’

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

print to html

A

:TOhtml

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

disable SYNTAX highlighting for the moment

A

:syntax clear

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

disable syntax highlighting completely

A

:syntax disable

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

allow manual turning on and off of syntax highlighting per buffer

A

:syntax manual, then “:set syntax=ON” (or OFF) on a per-buffer basis

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

force Vim to use a certain type of syntax highlighting for a file

A

‘ft’ ‘filetype’ (e.g. “:set filetype=fortran”)

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

see what filetype Vim is currently using for syntax highlighting

A

:set ft? :set filetype? (with no argument)

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

open Vim with multiple files in horizontal splits, vertical splits

A

nvim -o file1.txt file2.txt nvim -O file1.txt file2.txt

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

close the current file and open a new one

A

:edit FILE

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

hide current file and edit another

A

:hide edit otherfile.txt

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

edit a new set of files from within Vim

A

:args five.txt six.txt seven.txt

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

view currently open files that were given from arguments

A

:ar :args

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

edit the next, previous file in the :args list, skip two files forward in :args list

A

:n :next :N :prev :previous :2next

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

write changes and move to next, previous file in :args list

A

:wn :wnext (same as “:write”, then “:next”) :wN :wp :wprevious

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

go to first file in :args list

A

:fir :first (bonus–can also use “:rewind”)

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

go to last file in :args list

A

:la :last

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

setting to automatically write file when switching to another buffer

A

‘aw’ ‘autowrite’ ‘noaw’ ‘noautowrite’ (e.g. “:set autowrite”)

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

what is the difference between the argument list and buffers in Vim

A

the argument list was already present in Vi, but the buffer list was a new addition for Vim

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

add file(s) to the argument list in Vim

A

:arga :argadd (e.g. “:arga file3.txt file4.txt”)

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

remove file(s) from argument list in Vim

A

:argd :argdelete (e.g. “:argdelete file1.txt” or “*.txt” or “%”)

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

edit file N in the argument list

A

:argu :argument (e.g. “:argu 3” or “:3argu”)

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

write and quit all (TWO different command-line commands)

A

:wqa :xa

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

quit all files

A

:qa :quitall

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

quit without saving

A

:q! quit!

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

technical difference between “:wq” and “:x”

A

“:wq” writes and quits no matter what, whereas “:x” writes and quits, but only actually does the “write” if the file was changed

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

uppercase letters to write current file, if modified, and quit

A

ZZ (same as “:x”)

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

uppercase letters to quit without checking for changes

A

ZQ (same as “:q!”)

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

close the current window (command-line command and keybinding)

A

:clo :close CTRL-W c

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

quit the current window (command-line command and keybinding)

A

:q :quit CTRL-W q

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

what is the technical difference between “:quit” and “:close”

A

“:quit” will quit Vim if you’re in the last open window, whereas “:close” will make sure to leave Vim open

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

jump between the previous file and the current file (back and forth as desired)

A

CTRL-^ (technically, will jump to the “alternate file”, which is the most-recently viewed one)

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

jump to buffer N (command line command and keybinding)

A

:Nbuf :Nbuffer N CTRL-^

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

how backups work by default in Vim, what option controls this behavior

A

backup is made, file is overwritten, backup is deleted (this is the behavior of the ‘wb’ ‘writebackup’ option)

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

keep backups from being deleted automatically after write

A

‘bk’ ‘backup’ ‘nobk’ ‘nobackup’ (e.g. “:set backup”)

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

what backup filenames look like by default

A

“file.txt~” with a tilde

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

setting to make a custom backup-file signifier

A

‘bex’ ‘backupext’ (e.g. “:set backupext=.backup”)

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

backup to a specified directory instead of just cwd

A

‘bdir’ ‘backupdir’ (e.g. “:set backupdir=DIRECTORY”)

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

how to keep a backup of the original file before any changes were made, also, what is prerequisite for this to work

A

:set patchmode=.orig (“.orig” is the extension); requires ‘backupdir’ to be set for this to work

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

how to open a file in read-only mode

A

nvim -R file.txt (bonus! you may also be able to simply use the command “view file.txt” from Linux)

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

what is the difference between “nvim -R file.txt” and “nvim -M file.txt”

A

“-R” is read-only mode, which will warn before saving, whereas “-M” is even more strict, opening Vim with the ‘modifiable’ setting switched off

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

how can you remove the read-only setting if you opened a file in read-only mode

A

:set write (inverse of “:set nowrite”), no shortened version of this option

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

how you can remove the “modifiable” protection and make a file modifiable again

A

‘ma’ ‘modifiable’ ‘noma’ ‘nomodifiable’ (e.g. “:set modifiable”)

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

how to append to a file instead of simply writing one

A

:write&raquo_space; file.txt (append current buffer to file.txt)

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

how to save a copy of the file with a new name, but keep on editing the file with the original name

A

:write file2.txt

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

save a copy of a file and continue editing the file with the new name

A

:saveas file2.txt

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

display information about the current file (both command-line command and keybinding)

A

:f :file CTRL-G

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

split current buffer into two separate (horizontal) windows (command-line command and keybinding)

A

:sp :split CTRL-W s

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

which window will have the cursor after a horizontal split

A

the top window

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

which window will have the cursor after a vertical split

A

the left window

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

create a new split window that is 3 lines high

A

:3split (note that count must precede the command)

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

split and open a specified file in the new window

A

:sp :split FILE (e.g. “:split file2.txt”)

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

split (horizontally) and open a new file in the new split (command-line command and keybinding)

A

:new CTRL-W n

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

split the current buffer into two VERTICAL windows (command-line command and keybinding)

A

:vsp :vsplit CTRL-W v

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

create a vertical split with a specified file

A

:vsp :vsplit file2.txt

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

create a vertical split with a new file

A

:vne :vnew

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

hide the current buffer

A

:hid :hide

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

close all other windows except the current one (command-line command and keybinding)

A

:on :only CTRL-W o

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

jump from window to window

A

CTRL-W w

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

move to window to the left, down, up, or to the right

A

CTRL-W h j k l

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

move to the top window

A

CTRL-W t

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

move to the bottom window

A

CTRL-W b

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

rotate all windows downwards/rightwards (clockwise) or upwards/leftwards (counter-clockwise)

A

CTRL-W r and CTRL-W R

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

swap current window with the next one (or the previous if there is no “next” window)

A

CTRL-W x

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

swap current window with the third window from the top

A

3 CTRL-W x (windows increment starting with “1”)

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

move window left, down, up, or right

A

CTRL-W H J K L

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

move current window to a new tab page

A

CTRL-W T (uppercase “T”)

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

move current window to a new tab page before tab three

A

3 CTRL-W T

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

make all windows the same height and width

A

CTRL-W =

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

increase/decrease size of window (also, increase/decrease by four lines) (command-line command and keybinding)

A

:resize +4/-4 CTRL-W +/- and 4 CTRL-W +/-

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

set current window as high as possible, “maximize” (command-line command and keybinding)

A

:res :resize (with no arguments) CTRL-W _

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

set current window height to a specific number of rows (command line and keybinding), also, a “bonus” shortcut for this

A

:resize N [N]CTRL-W _ z{nr}

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

make window wider/narrower, make window wider/narrower by three columns (command-line command and keybinding)

A

:vert :vertical resize +3/-3 CTRL-W >//< (three columns)

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

how to make the new window you’re creating appear to the right or below rather than to the default above or left

A

:rightb :rightbelow / :bel :belowright (bonus FYI, “:lefta :leftabove” / “:abo :aboveleft” are the inverse counterparts of these

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

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

A

:to :topleft / :bo :botright (but NOT :bottomright)

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

the two options that will alter the default above/left behavior for window splits

A

‘sb’ ‘splitbelow’ ‘nosb’ ‘nosplitbelow’ ‘spr’ ‘splitright’ ‘nospr’ ‘nosplitright’ (e.g. “:set splitbelow”)

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

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

A

‘wh’ ‘winheight’ ‘wiw’ ‘winwidth’ e.g. “:set wiw=5” minimum and default setting is “1”

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

settings for the hard minimum height and width to enforce for other windows (besides the new one you’re opening)

A

‘wmh’ ‘winminheight’ ‘wmw’ ‘minwinwidth’

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

reasonable values for the ‘winminheight’ option

A

0-3, where zero will just be the separator itself (too large a number will cause errors when opening multiple windows)

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

reasonable values for the ‘winminwidth’ option

A

0-12, where zero will just be the separator itself (too large a number will cause errors when opening multiple windows)

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

option to automatically resize all windows to have equal spacing among them (default on)

A

‘ea’ ‘equalalways’ ‘noea’ ‘noequalalways’

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

how do you open Vim in diff mode

A

nvim -d main.c~ main.c (in this example using a backup file as a means of comparison)

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

how do you go into diff mode from within Vim

A

:vertical diffsplit main.c~ (compare “main.c~” with the file you’re currently editing, presumably “main.c”)

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

make it so that the two windows no longer scroll together in diff mode

A

:set noscrollbind (‘scb’ ‘scrollbind’ ‘noscb’ ‘noscrollbind’)

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

jump to the next/previous change in diff mode, jump three changes forward/back

A

]c / [c used with a count, 3]c / 3[c

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

in diff mode, replace deleted text when you’re in the LEFT window

A

dp (remember “diff put”)

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

in diff mode, remove changes when you’re in the RIGHT window

A

do (remember “diff obtain”)

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

open Vim with multiple files in separate tab pages

A

nvim -p file1.txt file2.txt

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

open a file in a new tab page within Vim

A

:tabedit FILE

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

open a new tab with an empty window

A

:tabnew

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

close all tabs except current

A

:tabonly

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

close current tab

A

:tabc :tabclose

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

close all tabs except tab number two

A

:2tabonly OR :tabonly 2

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

go to next tab/previous tab, go to tab number 3 (command-line command and keybindings)

A

:tabnext :tabprevious gt / gT 3gt ALSO CTRL-/ (works in both normal and insert mode)

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

go to first/last tab page

A

:tabfirst :tablast

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

make the current tab the last one

A

:tabm :tabmove (default behaviour of “:tabmove” is to put current tab at the end–“:tabmove $” will also work)

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

move current tab left, right, after tab 2, or to the beginning

A

:-tabmove :+tabmove :2tabmove :0tabmove (also can use “:tabm” for short) (yes, it is fine to put the number after the command as well)

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

split window and jump to alternate file (command-line command and keybinding)

A

:split # CTRL-W ^

191
Q

start/stop recording a macro

A

q{register} / q (note that you can paste the contents of the register if you need to tweak something)

192
Q

execute macro, execute macro more than once

A

@{register} {count}@{register}

193
Q

how does the “g” flag modify the “:substitute” command (i.e. “:s/a/b/g” vs “:s/a/b/”)

A

replace all matches on the line instead of just the first

194
Q

how does the “c” flag modify the “:substitute” command (i.e. “:%s/a/b/c”)

A

confirm

195
Q

what are the confirm options for the substitute “c” flag (i.e. “:%s/a/b/c)

A

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
Q

what do CTRL-E and CTRL-Y do in substitute confirm mode

A

scroll the text one line down/up, as expected

197
Q

command to see the name of the current swap file being used

A

:sw :swapname

198
Q

command-line flag to start Vim without using swap file

A

nvim -n file.txt

199
Q

when is the swap file updated by default

A

after typing 200 characters or when you haven’t typed anything for 4 seconds

200
Q

setting to change the number of characters for the interval of writing to the swap file

A

‘uc’ ‘updatecount’ (e.g. “:set updatecount=1000”)

201
Q

setting to change the time to wait after idle before writing to swap file

A

‘ut’ ‘updatetime’ (e.g. “:set updatetime=1000” (in milliseconds))

202
Q

turn off writing to swap file

A

:set updatecount=0 (will turn off writing to swap file completely!)

203
Q

command to write all text for all buffers into swap file(s)

A

:pre :preserve

204
Q

how to launch Vim to recover a file you were editing (also, what if there was no filename?)

A

nvim -r FILE nvim -r “” (if no filename)

205
Q

view all swap files found in a directory when starting Vim

A

nvim -r

206
Q

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)

A

YES

207
Q

swap file warning you will get when the file is already opened elsewhere

A

process ID: 12559 (still running)

208
Q

go to beginning/end of your line when using the command line

A

CTRL-B / CTRL-E (or / )

209
Q

at command line, complete to longest unambiguous string

A

CTRL-L (mnemonic, “complete Line”)

210
Q

AT COMMAND LINE, show all possible completions based on what you’ve typed

A

CTRL-D (mnemonic, “Do this for me…” or “Don’t make me work here”)

211
Q

at command-line (or search), open up a small window for easier editing

A

CTRL-F (mnemonic “Fix it up”)

212
Q

open up the command-line window (with browsable command/search history)

A

or q/

213
Q

stop browsing at the command-line window and place the current line ready to execute

A

CTRL-C

214
Q

delete whole word backward at command-line

A

CTRL-W

215
Q

delete whole line (and “start over”) at command-line

A

CTRL-U

216
Q

command to just view non-interactive list of command-line / search history

A

:his :history :history /

217
Q

suspend Vim and go back to command prompt (command-line command and keybinding)

A

:suspend CTRL-Z

218
Q

if you have suspended Vim, how do you get back to it from the shell

A

fg

219
Q

how to read the output of a program into Vim

A

:r :read !{program}

220
Q

send text from Vim to be the input of another program

A

:w :write !{program}

221
Q

filter text from Vim through an external program

A

:[range]!{program}

222
Q

view a list of recent files

A

:bro o :browse oldfiles

223
Q

special mark that is set with the last cursor position and file when exiting Vim

A

‘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
Q

difference between a “session” and a “view”

A

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
Q

command to save a session

A

:mks :mksession [my_session.vim] (if omitted, filename will default to Session.vim)

226
Q

restore a session from within Vim

A

:source my_session.vim

227
Q

restore a session when opening Vim

A

vim -S my_session.vim

228
Q

command to save a view, also, what are the three ways you can save a view

A

: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
Q

what are modelines

A

specific lines hardcoded at the beginning and/or end of a file that specify configuration settings

230
Q

what are the default lines that Vim checks for modelines

A

the first five lines and the last five lines

231
Q

setting to change how many lines to have Vim look for modelines, also, how to turn off modelines

A

:set modelines=10 :set nomodelines

232
Q

syntax for a modeline

A

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
Q

change current working directory globally, for current tab, for current window

A

:cd :tcd :lcd

234
Q

go to file name under cursor and edit

A

gf

235
Q

change working directory to directory of current file

A

:cd %:p:h

236
Q

setting to AUTOMATICALLY set the working directory to be that of the currently open file

A

‘acd’ ‘autochdir’ ‘noacd’ ‘noautochdir’ (e.g. “:set autochdir”)

237
Q

edit a file from anywhere in the current ‘path’

A

:fin :find (like :edit but will look for file anywhere in current ‘path’) also :splitfind, :tabfind, etc.

238
Q

“u” in buffer list

A

an “unlisted” buffer (see :help unlisted-buffer)

239
Q

”%” in buffer list

A

the current buffer

240
Q

”#” in buffer list

A

the alternate buffer

241
Q

“a” in buffer list

A

buffer is loaded and displayed (active)

242
Q

“h” in buffer list

A

buffer is loaded but hidden

243
Q

”=” in buffer list

A

buffer is read-only (mnemonic, file contents “equals” what it was when it was loaded)

244
Q

”-“ in buffer list

A

buffer is “not modifiable” (i.e. ‘modifiable’ is turned off) (mnemonic: if “+” means modified, “-“ means “not able to be modified”)

245
Q

”+” in buffer list

A

buffer has been modified

246
Q

command to view buffer list

A

:ls :buffers

247
Q

switch to buffer 2

A

:2b :2buffer or :b 2 :buffer 2 (can also type part of filename)

248
Q

list all buffers, including unlisted buffers (like help entries open)

A

:buffers! (or :ls!)

249
Q

make an abbreviation

A

:ab :abbreviate jm John Maughan

250
Q

remove an abbreviation

A

:una :unabbreviate jm

251
Q

clear all abbreviations

A

:abc :abclear

252
Q

how are abbreviations different from keybindings

A

abbreviations are triggered when you type a space, whereas keybindings will trigger as soon as the key combination is typed

253
Q

paste text, aligning indent with surrounding indentation

A

]p

254
Q

indent/unindent the line by ‘shiftwidth’ spaces (in normal mode)

A

> > / <

255
Q

indent/unindent current line from insert mode

A

CTRL-T / CTRL-D (remember “T”ab and “D”elete tab)

256
Q

in insert mode, delete previous word

A

CTRL-W

257
Q

in insert mode, delete whole line

A

CTRL-U

258
Q

in insert mode, copy character from above / below the current line

A

CTRL-Y / CTRL-E

259
Q

in insert mode, paste the contents of a register

A

CTRL-R{register} (mnemonic “Register”)

260
Q

in insert mode, insert a literal character (like a special character)

A

CTRL-V {character}

261
Q

in insert mode, insert a literal tab (useful for when using SuperTab)

A

CTRL-I

262
Q

in insert mode, execute a single command and then return to insert mode

A

CTRL-O {command}

263
Q

in insert mode, insert the text you typed last time you were in insert mode, do this and exit insert mode

A

CTRL-A CTRL-@

264
Q

when operating on search results, visually select the next/previous match

A

gn / gN (using these, you don’t have to press “n.”, because just “.” will actually make the change for you!)

265
Q

when operating on search results, delete, change, or make next match uppercase

A

dgn (delete next match) cgn (change next match) gUgn (make next match uppercase

266
Q

command to turn spell checking on/off

A

:set spell :set nospell (no abbreviated version of these)

267
Q

custom keybinding (from vimcast) for quickly toggling spell check

A

{leader}s

268
Q

add word under cursor as a good/wrong word to spellfile, to internal word list

A

zg / zw zG / gW

269
Q

describe difference between spellfile and internal word list

A

the spellfile is persistent, whereas the internal word list is discarded when exiting Vim

270
Q

describe what marking a word “wrong” actually does in the spellfile

A

turns existing entries into comment lines, thus the file only grows in length

271
Q

undo marking a word as “good”/”wrong” in spellfile, in internal word list

A

zug / zuw zuG / zuW

272
Q

suggest/cancel suggesting correctly spelled words for word under cursor in spell-check mode

A

z= (CTRL-C to cancel) (mnemonic “what might equal the correct word”)

273
Q

trigger spelling completions

A

CTRL-X s

274
Q

clean up commented lines in spellfile

A

:runtime /spell/cleanadd.vim

275
Q

command-line commands to add a “good” or “wrong” word to spellfile/internal word list

A

:spe :spellgood {word} :spellw :spellwrong {word} append a “!” to only add to the internal word list (e.g. :spe! tyger)

276
Q

next/previous misspelled word, also, same but only stop at “wrong” words, skipping rare words or words from another region

A

]s / [s ]S / [S

277
Q

how to toggle an option in vim

A

append an exclamation mark “!”, e.g. “:set wrap!” to toggle the option back and forth

278
Q

turn off soft wrapping lines longer than the width of the window

A

‘wrap’ ‘nowrap’ (e.g. “:set nowrap”) (no shorter form)

279
Q

when soft wrapping is on, wrap lines lines at word breaks instead of in the middle

A

‘lbr’ ‘linebreak’ (bonus: will wrap long lines at a character in ‘breakat’ option)

280
Q

setting for inserting actual line breaks if lines get longer than a certain length

A

‘tw’ ‘textwidth’, e.g. “:set tw=72” (and ‘fo’ needs “t” in it)

281
Q

cause wrapped lines to continue visually indented

A

‘bri’ ‘breakindent’ (and ‘nobri’ ‘nobreakindent’ of course)

282
Q

cause wrapped lines to show a string of your choosing before the wrapped text (default string is “”)

A

‘sbr’ ‘showbreak’, e.g. “:set sbr=>\ “ (backslash to escape space)

283
Q

how to treat a setting value like a variable, and why one would do this

A

prepend an ampersand, e.g. :let &showbreak = ‘+++ ‘ this allows you to avoid having to escape spaces

284
Q

turn on/off display of non-print characters

A

‘list’ ‘nolist’

285
Q

turn on/off line numbering

A

‘nu’ ‘number’ ‘nonu’ ‘nonumber’

286
Q

check if any buffers were changed outside of Vim, and, if ‘autoread’ is set (it will be by default in Neovim), reload the file

A

:checkt :checktime

287
Q

trigger word completion, cycle through previous/next completion

A

CTRL-P, CTRL-P / CTRL-N to cycle backwards/forwards

288
Q

complete whole lines

A

CTRL-X CTRL-L

289
Q

complete keywords in thesaurus

A

CTRL-X CTRL-T

290
Q

complete keywords in dictionary

A

CTRL-X CTRL-D

291
Q

complete file name

A

CTRL-X CTRL-F

292
Q

show the current state of an option

A

append a question mark to the setting when using the set command, e.g. “:set number?”

293
Q

jump to matching ), ], or }

A

%

294
Q

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

A

:delm :delmarks:delm a b 1:delm a-z:delm!

295
Q

motion to go to beginning/end of sentence

A

( / )

296
Q

motion to go to the beginning / end of a paragraph

A

{ / }

297
Q

setting to change how substitute effects are shown as you type (also, what are the options you can use for it)

A

‘icm’ ‘inccommand’ “” (no feedback), “nosplit” (show effects incrementally, as you type, “split” (show results in preview window) (e.g. “:set icm=nosplit”)

298
Q

turn off search wrapping from bottom to top (default is on)

A

‘ws’ ‘wrapscan’ ‘nows’ ‘nowrapscan’ (e.g. “:set nowrapscan”)

299
Q

four levels of “magic” that can be specified as flags for a regular expression (also, what is the default setting?)

A

‘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
Q

move up/down one screen line, move to beginning/end of screen line

A

gk / gj g0, g^, and g$

301
Q

init.vim keybinding to clear search highlighting

A

CTRL-L

302
Q

init.vim keybinding to toggle spell check

A

s

303
Q

commentary.vim: comment or uncomment a motion

A

gc{motion}

304
Q

commentary.vim comment or uncomment [count] lines

A

[count]gcc

305
Q

commentary.vim: comment or uncomment the visual-mode highlighted lines

A

{visual}gc

306
Q

commentary.vim: text object for a comment for use in operator pending mode

A

gc

307
Q

commentary.vim: uncomment the current and adjacent commented lines

A

gcgc OR gcu

308
Q

commentary.vim: comment or uncomment [range] lines from command line

A

:[range]Commentary

309
Q

center lines in [range] between [width] columns, also, what are defaults

A

:ce :center (e.g. “:[range]center [width]” “:3,4ce 50” “:0,$center 40”), default is ‘textwidth’ or 80 characters if ‘textwidth’ is 0

310
Q

right-align lines in [range] at [width] columns, also list defaults

A

:ri :right (e.g. “:[range]right [width]”), default ‘textwidth’ or 80 if ‘textwidth’ is 0

311
Q

left-align lines in [range], also list defaults

A

:le :left (e.g. :[range]left [indent]), default indent is 0

312
Q

what is the difference between gq and gw

A

“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
Q

how to format the current line, format current paragraph, format N lines

A

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
Q

how to set Vim to do formatting by use of an external program

A

‘fp’ ‘formatprg’ (e.g. “:set formatprg=yapf”), note that such a program must take input through stdin and send output to stdout

315
Q

how to set the line-ending style in Neovim

A

‘ff’ ‘fileformat’ (e.g. “:set fileformat=dos”), can be “dos” (CRLF) “unix” (LF) or “mac” (CR)

316
Q

view list of digraphs in Vim

A

:dig :digraphs

317
Q

how to enter a digraph in Vim (two methods)

A

CTRL-K {char1} {char2} OR turn on ‘digraph’ option and do {char1} {char2}

318
Q

setting to allow digraphs from insert mode

A

‘dg’ ‘digraph’ ‘nodg’ ‘nodigraph’

319
Q

setting to change the directory for the swap file also, set as same directory as edited file

A

‘dir’ ‘directory’ :set dir=.

320
Q

default location of swap file in Neovim

A

$XDG_DATA_HOME/nvim/swap

321
Q

where is $XDG_DATA_HOME for Neovim

A

~/.local/share/nvim ~/AppData/Local/nvim-data

322
Q

where is $XDG_CONFIG_HOME (Linux and Windows)

A

~/.config/nvim ~/AppData/Local/nvim

323
Q

how to change the number of files that will be remembered for “:browse oldfiles”

A

‘sd’ ‘shada’ with ‘ paramenter (e.g. “:set shada=’25”) (may need to wipe your shada file before the change will be reflected)

324
Q

setting that specifies options for how text is formatted

A

‘fo’ ‘formatoptions’

325
Q

default setting for ‘formatoptions’

A

tcqj

326
Q

format option to auto-wrap text using ‘textwidth’

A

t

327
Q

format option to auto-wrap comments using textwidth (also, how to wrap for comments but NOT for normal text)

A

c (for comments only, “:set fo-=t” and “:set fo+=c”)

328
Q

format option to automatically continue comments when you press , also, format option to continue comments when you use “o” or “O” in normal mode

A

r (for , mnemonic “Return”) o (for “o” and “O”)

329
Q

format option to automatically format paragraphs (every time text is added or deleted paragraph will be reformatted)

A

a (mnemonic “Automatically / Always”)

330
Q

format option to recognize numbered lists

A

n

331
Q

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)

A

l (lowercase letter “L”)

332
Q

describe helpful combinations of format options “” “t” “c” “tc”

A

”” 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
Q

format option to make whitespace at end of line signal paragraph continuation

A

w (mnemonic “whitespace”)

334
Q

setting for how many spaces a character looks like on screen, also, what is default

A

‘ts’ ‘tabstop’ default is 8

335
Q

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)

A

‘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
Q

setting indicating number of spaces to use for each step of autoindent (“»”, “<

A

‘sw’ ‘shiftwidth’ default is 8

337
Q

setting to use spaces instead of tabs, also, what is default

A

‘et’ ‘expandtab’ ‘noet’ ‘noexpandtab’ default is off

338
Q

command to redo tabs/spaces in file, also, how to replace tabs with spaces

A

:retab to replace tabs with space, just run this with ‘expandtab’ turned on

339
Q

display whitespace characters

A

‘list’ ‘nolist’ (no abbreviated versions)

340
Q

setting that controls how “:list” command displays characters

A

‘lcs’ ‘listchars’

341
Q

open Vim and go to line number 57

A

nvim +57 file.txt

342
Q

open Vim and search for “something” immediately

A

nvim +/something file.txt

343
Q

how to make a pattern case sensitive or insensitive

A

add “\c” anywhere in pattern to make case insensitive or “\C” to make the pattern case sensitive

344
Q

how does ‘smartcase’ work

A

‘scs’ ‘smartcase’ ‘noscs’ ‘nosmartcase’ will make the search case insensitive unless you include a capital letter (when ‘ignorecase’ is turned on)

345
Q

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

A

:argdo :bufdo :tabdo :windo

346
Q

option to hide a buffer instead of abandon it when you unload it, also, how will this change behavior

A

‘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
Q

how to execute normal mode commands from the command line

A

:norm :normal the optional “!” ignores mappings

348
Q

how to execute a macro on all buffers

A

:bufdo normal! @a (the exclamation makes the command not use mappings)

349
Q

format option to allow formatting of comments when using gq

A

q

350
Q

what symbol designates the default (unnamed) register

A

351
Q

how to paste text from register into command line

A

CTRL-R{register}

352
Q

how to append to a register instead of overwrite it

A

use a capital letter, e.g. “B” to append to register “b”

353
Q

buffer that contains the last-used search pattern

A

/

354
Q

buffer that contains the last-used command-line command

A

:

355
Q

option to show a column in a different color shade to signal a certain number of columns

A

‘cc’ ‘colorcolumn’ (e.g. “:set colorcolumn=80”)

356
Q

setting that controls how to recognize lists when using the “n” formatoption setting

A

‘flp’ ‘formatlistpat’

357
Q

command restore a view

A

:lo :loadview [nr]

358
Q

option that controls where views are stored

A

‘vdir’ ‘viewdir’

359
Q

setting that handles what gets stored in views

A

‘vop’ ‘viewoptions’

360
Q

move to next/previous function or class definition

A

]] / [[

361
Q

move forwards to the end / backwards to the end of a function

A

][ / []

362
Q

setting to set what gets saved in session files

A

‘ssop’ ‘sessionoptions’

363
Q

warning you will get when you have an old swap file

A

NEWER than swap file!

364
Q

close current buffer and open a new, blank file

A

:ene :enew

365
Q

how to set current buffer as read-only

A

:ro :readonly

366
Q

move cursor to previous (last-accessed) window

A

CTRL-W p (or CTRL-W CTRL-P)

367
Q

digraph for “en dash”

A

-N

368
Q

digraph for “em dash”

A

-M

369
Q

digraph for superscript/subscript numbers

A

{number}S / {number}s (number can be any of [0-9+=-n()] )

370
Q

digraph for tilde over letter (like “n”)

A

{letter}? (e.g. “n?”)

371
Q

digraph for acute accent

A

{letter}’ (e.g. “i’”)

372
Q

activate the Vim file browser

A

:edit . OR :Explore

373
Q

from Vim file browser, display file in horizontal, vertical split, preview window, previous window, or a new tab page

A

o (horizontally split) v (vertically split) p (preview window) P (previous window) t (new tab page)

374
Q

from Vim file browser, reverse the sort order

A

r

375
Q

from Vim file browser, change listing style

A

i

376
Q

from Vim file browser, change the way files are sorted (also, what are the three options)

A

s name, mod time, size

377
Q

from Vim file browser, change current directory to browser directory

A

c

378
Q

from Vim file browser, rename the file or directory under cursor

A

R

379
Q

from Vim file browser, delete file or directory under cursor

A

D

380
Q

from Vim file browser, make bookmark / goto bookmark

A

mb / gb

381
Q

from Vim file browser, go to parent directory

A

-

382
Q

create fold

A

zf

383
Q

command to create a fold for lines in {range}

A

:{range}fo :{range}fold

384
Q

open fold / close fold open all folds at cursor / close all folds at cursor

A

zo / zc zO / zC

385
Q

“reduce” folding / more folding, also, open all folds / close all folds

A

zr / zm zR / zM

386
Q

disable folding / bring back folding, also, toggle between these two states

A

zn / zN zi

387
Q

move to start/end of current open fold, what does this do if already at start/end

A

[z / ]z (if already at start/end, move to start/end of containing fold)

388
Q

move down to the start of the next / up to the beginning of the previous fold

A

zj / zk

389
Q

delete single fold at cursor line (shift sub-folds up one level) / delete all folds at cursor line recursively (all sub-folds get deleted)

A

zd / zD

390
Q

delete all folds in window

A

zE (mnemonic: “eliminate” all folds)

391
Q

setting to make folds automatically open as you scroll over them

A

‘fdo’ ‘foldopen’ (specifically, “:set foldopen=all”)

392
Q

setting to automatically close folds as you move out of them

A

‘fcl’ ‘foldclose’ (specifically, “:set foldclose=all”)

393
Q

setting to change how folds are handled for the window, what is the default method

A

‘fdm’ ‘foldmethod’ default foldmethod is “manual”

394
Q

how to set folds to be automatic based on indentation

A

:set fdm=indent

395
Q

how to set folds to be set using ‘foldmarker’ in your text

A

:set fdm=marker

396
Q

setting to use filetype-specific syntax to specify folds

A

:set fdm=syntax

397
Q

setting to automatically define folds in a diff to fold text that has not changed

A

:set fdm=diff

398
Q

setting to define folds manually

A

:set fdm=manual

399
Q

display a small left-hand column to visualize folds

A

‘fdc’ ‘foldcolumn’ (e.g. “:set foldcolumn=4”) Bonus! You can actually just click on the folds in the foldcolumn to open and close!

400
Q

surround.vim: delete surrounding character

A

ds” ds) dst

401
Q

surround.vim: change surroundings

A

cs{from}{to} cs”’ cs)]

402
Q

surround.vim: wrap {motion or text object} in desired surroundings

A

ys{motion or text object}{surrounding} ysiw) yss”

403
Q

surround.vim: wrap whole line in desired surroundings

A

yss{surrounding}

404
Q

surround.vim: variant to indent surrounded text and place on a line of its own

A

yS and ySS

405
Q

surround.vim: surround something from visual mode

A

S{surrounding}

406
Q

surround.vim: how to surround with/without whitespace

A

opening marks ADD whitespace, closing marks do not

407
Q

jump to tag under cursor

A

CTRL-]

408
Q

go to preceding tag (keybinding and command-line command)

A

CTRL-T :pop

409
Q

split window and jump to tag under cursor do same but make window 5 lines high

A

CTRL-W ] 5CTRL-W ]

410
Q

show list of tags you have traversed through

A

:tags

411
Q

jump forward three tags

A

:3tag

412
Q

jump to tag by a specific name

A

:tag {identifer}

413
Q

command to split window and jump to a specific tag by name

A

:stag {ident}

414
Q

select among options for the same tag name

A

:tselect TAGNAME

415
Q

navigate next/previous and first/last when going through tags with same name

A

:tnext / :tprevious :tfirst / :tlast (:tnext and :tprevious can be used with a count as well, e.g. “:3tnext”)

416
Q

cycle through possible tags beginning with a certain word

A

:tag write_ (cycle through tags beginning with “write_”)

417
Q

cycle through possible tags containing pattern

A

:tag /block (cycle through tags containing the pattern “block”)

418
Q

open preview window to display “tag_name”

A

:ptag tag_name

419
Q

open preview window to display tag under cursor (keybinding)

A

CTRL-W }

420
Q

close preview window

A

:pclose

421
Q

edit a file in preview window

A

:pedit file.txt

422
Q

setting to specify the height of the preview window, also, what is default

A

‘pvh’ ‘previewheight’ default is 12

423
Q

go to definition (two keybindings with related meanings)

A

gd (supposed to be local) gD (supposed to be global) but for Python, the entire module (including comments) is the namespace

424
Q

undo one change (keybinding and command-line command), also, describe behavior of this

A

u :u :undo has the effect of walking up the undo tree

425
Q

redo one change (keybinding and command-line command), also describe behavior

A

CTRL-R :red :redo walk down the undo tree, branching to newest branch

426
Q

go to older/newer time-based text state (keybindings and command-line commands), also, how is this different from “normal” undo

A

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
Q

go to older/newer time-based undo by changes in text state, seconds, minutes, hours, days, or file writes

A

: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
Q

go back to the state exactly as it was when you last saved the file

A

:earlier 1f

429
Q

go back to the state as it was 4 days ago

A

:earlier 4d

430
Q

go back to the state as it was 3 hours ago

A

:earlier 3h

431
Q

yankstack.vim: cycle backward/forward through history of yanks

A

Alt-P / Alt-Shift-P

432
Q

yankstack.vim: view history of yanks

A

:Yanks

433
Q

where views are stored by default

A

$XDG_DATA_HOME/nvim/view

434
Q

branch (“or” logic)

A

|

435
Q

concat (“and” logic)

A

\&

436
Q

0 or more as many as possible

A

*

437
Q

regex; 1 or more as many as possible

A

+

438
Q

0 or 1 as many as possible

A

\?

439
Q

n to m as many as possible

A

{n,m}

440
Q

n exactly

A

{n}

441
Q

at least n as many as possible

A

{n,}

442
Q

0 to m as many as possible

A

{,m}

443
Q

n to m as few as possible

A

{-n,m}

444
Q

n exactly

A

{-n}

445
Q

at least n as few as possible

A

{-n,}

446
Q

0 to m as few as possible

A

{-,m}

447
Q

0 or more as few as possible

A

{-}

448
Q

start-of-line

A
449
Q

end-of-line

A

$

450
Q

any single character

A

.

451
Q

beginning of word

A

\

452
Q

end of word

A

>

453
Q

whitespace / not whitespace

A

\s \S

454
Q

digit / non-digit

A

\d \D

455
Q

hex digit / non-hex digit

A

\x \X

456
Q

octal digit / non-octal digit

A

\o \O

457
Q

word character / non-word character [0-9A-Za-z_]

A

\w \W

458
Q

alphabetic character / non-alphabetic character

A

\a \A

459
Q

lowercase character / non-lowercase character

A

\l \L

460
Q

uppercase character / non-uppercase character

A

\u \U

461
Q

match character

A

\t

462
Q

match newline character

A

\n

463
Q

last given substitute string

A

~ (no escaping needed)

464
Q

group

A

()

465
Q

string matched by first group

A

\1

466
Q

character class (any one of the characters in the class)

A

[] (no escaping needed)

467
Q

ignore case for whole pattern / match case for whole pattern

A

\c \C (may be used anywhere in pattern)

468
Q

“very magic” on for the following characters / “very nomagic” on for the following characters “magic” / “nomagic” for the following characters

A

\v \V \m \M

469
Q

quick help (e.g., quick Python help from Vim)

A

K

470
Q

show a column on the left of screen that shows open and closed folds

A

‘fdc’ ‘foldcolumn’ (e.g. “set fdc=3”) maximum value is 12

471
Q

from Vim file browser, list bookmarks

A

qb (mnemonic: “query bookmarks)

472
Q

from Vim file browser, go to previous / next folder (walk history backwards / forwards)

A

u / U

473
Q

scroll [count] characters to the right/left scroll half a screenwidth right/left

A

[count]zl / [count]zh zL / zH (also can use z and z for single character scrolling)