-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheatsheet.txt
202 lines (170 loc) · 6.95 KB
/
cheatsheet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
__ _____ _ _ _____ _____ _ ______ __
|| / ____| | | | __ \|_ _| |/ /___ \ ||
|| | (___ | |__| | |__) | | | | ' / __) | ||
__||__ \___ \| __ | _ / | | | < |__ < __||__
--..-- ____) | | | | | \ \ _| |_| . \ ___) | --..--
|| |_____/|_| |_|_| \_\_____|_|\_\____/ ||
USE VIM OR DIE !
-----------------------------------------------------
|------------ MOST COMMON ...... ---------------------|
-------------------------------------------------------/
<leader><leader> Show opened buffers + grep
| C-d close selected buffer
<leader>bb Show opened buffers
<F10> Show opened buffers (same)
<F9> File tree
<leader>tt File tree
<leader>tg git status tree
<F8> ctags
<leader>cc toggle comment
<leader>cb toggle comment (block)
<leader>fg live grep (strings) requires ripgrep
<leader>ff live grep (files)
<leader>ft live grep (tags)
<leader>fh live grep (help docs)
<leader>? live grep (recent files)
C-/ show helps (while the grep window open)
Ctrl-O Go next/prev on the jump list, this
Ctrl-I is useful when e.g. lsp jump to/back definition
nvim-surround:
Old text Command New text
-------------------------------------------------------
surr*ound_words ysiw) (surround_words)
*make strings ys$" "make strings"
[delete ar*ound me!] ds] delete around me!
remove <b>HTML t*ags</b> dst remove HTML tags
'change quot*es' cs'" "change quotes"
<b>or tag* types</b> csth1<CR> <h1>or tag types</h1>
delete(functi*on calls) dsf function calls
|------------ VCS (git integration).. -----------------|
-------------------------------------------------------/
Gitsigns keymaps
<leader>gs stage hunk (normal or visual)
<leader>gS stage buffer
<leader>gr reset hunk (normal or visual)
<leader>gR reset buffer
<leader>gu undo stage hunk
<leader>gp preview hunk
<leader>gb blame line
<leader>gtb toggle caurrent line blame
<leader>gtd gitsigns
]c Next hunk
[c Next hunk
:Gitsigns diffthis
:Gitsigns diffthis('~')
|------------ Telescope ..-----------------------------|
-------------------------------------------------------/
[ESC] toggle mode (input bar/ items)
C-n/C-p next/previous item
C-x goto, split
C-v goto, vsplit
C-u/C-d scroll up/down preview window
C-q send (not filtered) items to quickfixlist
M-q send all to qflist
These two are helpful to keep track of things
|------------ BOOKMARKS...........---------------------|
-------------------------------------------------------/
NOTE: the bookmarks are cached globally at $HOME/.bookmarks
<leader>ml open bookmark list
<leader>mm toggle bookmark at current line
<leader>me edit bookmark (notes)
<leader>mc clear bookmarks in current buffer
<leader>mn go to next marked location
<leader>mp go to previous marked location
<leader>mx delete all bookmarks
|------------ Markdown and Latex-----------------------|
-------------------------------------------------------/
:MarkdownPreview Markdown
|------------ Misc..... -------------------------------|
-------------------------------------------------------/
:!boxes -d [d] call boxes, (used with selection, d for
design, e.g. cat) requires boxes
ZZ Close a window (exit if close the last)
zz mapped to :update
C-S mapped to :update
:w stop using :w
[,] use these instead of pressing down j/k
ZQ quit
:x = :w
:earlier 5m go back to 5 minutes ago
(reverse the file and jump cursor location)
|------------ Edit.. ----------------------------------|
-------------------------------------------------------/
> add indent for multiple lines (visual)
>> add indent for current line (normal)
< remove indent .. (visual)
u undo
<C-R> redo
vap select around the paragraph
vi( etc..
. repeat last command
D or d$ delete till end of line
C or c$ change till end of line
c switch to insert mode after d
gg=G fix indent (vim built-in)
daw / diw a for around and i for inside, or dip/dap etc.
di( to delete in (), di[, di{, di" etc.
<leader>ss spell check [custom mapping/ plugins]
z= show possible words
:set tw=[n] set textwidth
|------------ Nav/ Matching.. -------------------------|
-------------------------------------------------------/
e end of word
$ end of line
^ beginning of line
w for word
p for para
% match parenthesis
{ / } pre. / next paragraph
zz put current line to center
zt put current line to top
C-e, C-y scroll up/down by line
C-u, C-d scroll up/down by page
<C-g> show current location (in percentage)
gg / G , go to top / Bottom
25% go to 25 percent of file
|------------ Windows / Splits-------------------------|
\------------------------------------------------------/
:sp :vsp split / vertical split
:res [n] resize
<C-W> c close split
<C-W> h/j/k/l nav. splits
<C-W> H/J/K/L move splits around
<C-h><C-j> same [custom mappings]
<C-k><C-l>
RESIZE SPLITS:
:vert/hor res +-[n]
|------------ buffers. --------------------------------|
-------------------------------------------------------/
:ls showbuffer (vim builtin)
:b[n] switch to buffer [n]
<A-TAB> next buffer
<A-S-TAB> Previous buffer
|------------ Search / Replace.------------------------|
-------------------------------------------------------/
/ and ? search forward and backward
R replace mode
r[x] replace all characters in selection with x
:s/old/new/g Replace in line
:%s/old/new/g Replace all in file
:%s/old/new/gc Replace all in file, confirm for each
:sort sort selected lines (by first letter)
|------------ Programming. LSPs.. (DEPRECATED)---------|
-------------------------------------------------------/
K Hover
gd Definition (peek)
gD Declarations
gi Implementation
go type def
gr references
gl diag. float (under cursor or line)
gL diag. current buffer
[d , ]d diag. prev. / next.
C-K help (manual)
K Hover Doc..
<leader>o outline
<F2> Rename
gr
<F4> Code Action
<leader>ca
(completion snips) C-J, C-K jump to next/prev parameter