-
Notifications
You must be signed in to change notification settings - Fork 4
/
evanthegrayt.txt
334 lines (285 loc) · 15.8 KB
/
evanthegrayt.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
*evanthegrayt.txt*
================================================================================
____ _ _ __ _ _ ____ _ _ ____ ___ ____ __ _ _ ____ ~
( ___)( \/ )/__\ ( \( )(_ _)( )_( )( ___)/ __)( _ \ /__\ ( \/ )(_ _) ~
)__) \ //(__)\ ) ( )( ) _ ( )__)( (_-. ) / /(__)\ \ / )( ~
(____) \/(__)(__)(_)\_) (__) (_) (_)(____)\___/(_)\_)(__)(__)(__) (__) ~
================================================================================
ABOUT *evanthegrayt*
Sometimes I forget things. Also, a few people use my vim configuration, so this
will also serve as a way for people to learn my mappings and plugin settings.
Author: Evan Gray <mailto:evanthegrayt@vivaldi.net>
Repo: https://github.com/evanthegrayt/vimfiles
License: MIT License
================================================================================
TABLE OF CONTENTS
Settings ............................................... |evanthegrayt-settings|
Mappings and Commands ..................... |evanthegrayt-mappings-and-commands|
Vim Setting Toggles ............................... |evanthegrayt-vim-toggles|
Custom Functions ............................. |evanthegrayt-custom-functions|
Custom Commands ............................... |evanthegrayt-custom-commands|
Plugin Mappings ............................... |evanthegrayt-plugin-mappings|
Plugin Commands ............................... |evanthegrayt-plugin-commands|
Things to Remember ..................................... |evanthegrayt-remember|
Plugins ................................................. |evanthegrayt-plugins|
================================================================================
SETTINGS *evanthegrayt-settings*
Most of my personal settings are kept in my vimrc file. Modern vim allows you
to keep your vimrc file as "~/.vim/vimrc", instead of "~/.vimrc". For this
reason, my vimrc is kept in the root of this repository.
For settings that require more advanced vimscript, check in the "plugin/" and
"autoload/" directories. They contain commands and functions that are like
mini-plugins. These are described in |evanthegrayt-mappings-and-commands|.
Please note that this repository used to support versions of vim less than 8.0.
This is no longer the case. If you're using an old version of vim, please
upgrade to 8.0+.
================================================================================
MAPPINGS AND COMMANDS *evanthegrayt-mappings-and-commands*
*evanthegrayt-vim-toggles*
Vim setting toggles~
These are mappings that toggle vim's built-in options. All mappings in this
section are performed in normal mode.
Keys Toggles Between~
\tn 'relativenumber' off and on
\ts 'spell' off and spelllang=en_us
\tc 'conceallevel' off and 2
\tC 'colorcolumn' off and columns 81,101,121
\tm 'mouse' "" and "a"
\tf 'foldcolumn' off and 2
*evanthegrayt-custom-functions*
Custom functions~
These are mappings that perform custom functions. For modes, "n" is normal, "v"
is visual, etc.
Mode Keys Descriptions~
n \fi Let vim try to auto-indent the whole file
n \st Remove all trailing whitespace from the current file
n \co List lines containing the word under cursor and jump to match
n ctrl-k Move current line up a line
n ctrl-j Move current line down a line
v ctrl-k Move current selection up a line
v ctrl-j Move current selection down a line
n \p Preview file in browser (html only)
i ctrl-g u Downcase the word currently being typed
i ctrl-g U Upcase the word currently being typed
n \bp Insert a pry breakpoint above current line (ruby only)
*evanthegrayt-custom-commands*
Custom Commands~
Custom command definitions, unrelated to a plugin.
*:Cdc*
:Cdc {directory} Poor man's implementation of my shell plugin "cdc",
linked below. In short, define *g:cdc_dirs* as a
list of directories. You can then use this command
to quickly change the working directory to a
subdirectory of one of the directories in the list.
If I ever add more features, this will probably
become its own plugin.
https://github.com/evanthegrayt/cdc
*:Jira*
:Jira[!] [{issue}]
Open a Jira board or issue. Must define
|g:evanthegrayt_jira_board_url|, which is the URL
of the Jira domain for your projects. With no
arguments, opens the base Jira URL. When {issue} is
specified, that issue will be opened. This is not
case-sensitive. When ! is present, the current line
will be searched for a jira issue. If one is found,
it will be opened. The preferred format is
"ISSUE: [XXX-000]" or "TODO: [XXX-000]", but the
colon and brackets are optional, and the pattern is
case-insensitive.
*:Modeline*
:[{count}]Modeline[!] Add a modeline {count} lines from the top of the
file. If ! is supplied, add a modeline {count}
lines from the bottom of the file.
*:Sloc*
:Sloc Display the number of Source Lines of Code.
*:Standup*
:Standup[!] [{file}] If the StandupMD ruby gem is installed, execute the
gem and open the {file} in a split. If ! is
supplied, open in a vertical split. If {file} is
not supplied, open the current month's file.
https://github.com/evanthegrayt/standup_md
*evanthegrayt-plugin-mappings*
Plugin Mappings~
My custom mappings for plugins. For modes, "n" is normal, "v" is visual, etc.
CtrlP~
n \be Explore open buffers
n \bm Explore most recently used files
n \bt Explore tags
n \bb Explore tags of current buffer
n ctrl-] Jump to tag definition
v ctrl-] Jump to tag definition
Netrw~
n \nt Open Netrw (:Ntree)
Rainbow~
n \rt Toggle whether plugin is enabled
IndentLine~
n \it Toggle whether plugin is enabled
GitGutter~
n \gt Toggle whether plugin is enabled
n \gu Undo the hunk under the cursor
Tagbar~
n \TT Toggle the tagbar pane
RestConsole~
n \rq Run a rest query (only in .rest files)
n \rc Close the response buffer if it exists
DadBod~
n \dbq Run the query under the cursor (only in .sql files)
v \dbq Run the visually selected query (only in .sql files)
*evanthegrayt-plugin-commands*
Plugin Commands~
My custom commands for plugins.
*:Ri*
:Ri[!] Open RI search prompt in a split. If ! is supplied,
will open in a vertical split.
================================================================================
THINGS I WANT TO REMEMBER *evanthegrayt-remember*
Random things I learn that I want to have quick access to remember. Things in
this section are subject to be removed as I commit them to memory.
Command Completion~
In command-line mode, <c-d> will show all completions for a command at once.
Global~
Delete all lines matching a pattern, or NOT matching a pattern. You can also
pass a range to delete the matching line, and the one(s) before or after it.
Raw VimScript can also be used.
>
:g/pattern/d
:v/pattern/d
:g/pattern/-1d
:g/^/if line(".") % 2 == 0 | d
:g/^/if strlen(getline(".")) < 3 | d
<
Make a table of contents for markdown. The "t" command copies, "m" moves.
>
:g/^##/t 1
:g/^/m 1
<
Pattern Matching/Regex~
Find all methods with two arguments and swap the arguments.
>
:%s/\v^\s*def\s+\w+\(\s*\zs(\w+)\s*,\s*(\w+)\ze\s*\)/\2, \1
<
Use "gn" to visually select the next match, and "gN" to select the previous.
Lookarounds~
Further reading:
https://www.rexegg.com/regex-lookarounds.html
https://vim.fandom.com/wiki/Regex_lookahead_and_lookbehind
>
| Perl | Vim
Positive Lookahead | (?=foo) | (atom)\@=
Positive Lookbehind | (?<=foo) | (atom)\@<=
Negative Lookahead | (?!foo) | (atom)\@!
Negative Lookbehind | (?<!foo) | (atom)\@<!
<
For example, to find function definitions that are not followed by a "!":
>
\v^function(!)@!
<
Lookarounds should be fairly uncommon in vimscript due to the "\zs" and "\ze"
operators. For example, to find all non-leading double whitespace:
>
\v\S\zs\s{2,}
<
Registers~
Use your most recent yank/delete in insert/command mode. For example, press / to
search, then '<c-r>"' as your search pattern.
Use '<c-r>=' in insert or command mode to evaluate an expression in-place.
>
<c-r>=getcwd()
<
Changes~
Use "g;" and "g," to jump through the change list.
Help docs I can never find~
|mark-motions| to see how advanced jumps work.
|filename-modifiers| to see how to manipulate a file path.
|cmdline-special| to see how to grab things under the cursor.
|ins-completion| to learn vim's built-in completion.
|:Cfilter| to filter the quickfix/loclist.
|pattern| to learn about vim's regex engine.
|sub-replace-special| for help with substitution.
================================================================================
PLUGINS *evanthegrayt-plugins*
This is a list of the plugins I use. You can hit "CTRL-]" on an item in the
left column to view its help documentation. If the item doesn't have its own
help documentation, then the syntax color will probably be the same color as
the URL, meaning this is the tag definition (see repeat as example). I did
this so I could easily jump to this list (":h repeat"), hit "gx" on the URL
to open the project in a browser, and read the README in the repository.
Plugin/Helptag URL~
|branch-sessions| https://github.com/evanthegrayt/vim-branch-sessions
|easteregg| https://github.com/evanthegrayt/vim-easteregg
*easteregg-airline* https://github.com/evanthegrayt/vim-easteregg-airline
|lovehandle| https://github.com/evanthegrayt/vim-lovehandle
|noteworthy| https://github.com/evanthegrayt/vim-noteworthy
|update-plugins| https://github.com/evanthegrayt/vim-update-plugins
|abolish| https://github.com/tpope/vim-abolish
|bundler| https://github.com/tpope/vim-bundler
|capslock| https://github.com/tpope/vim-capslock
|commentary| https://github.com/tpope/vim-commentary
|dadbod| https://github.com/tpope/vim-dadbod
|dispatch| https://github.com/tpope/vim-dispatch
|dotenv| https://github.com/tpope/vim-dotenv
*endwise* https://github.com/tpope/vim-endwise
|eunuch| https://github.com/tpope/vim-eunuch
|ft-git| https://github.com/tpope/vim-git
|fugitive| https://github.com/tpope/vim-fugitive
|jdaddy| https://github.com/tpope/vim-jdaddy
|obsession| https://github.com/tpope/vim-obsession
|projectionist| https://github.com/tpope/vim-projectionist
|rails| https://github.com/tpope/vim-rails
|rake| https://github.com/tpope/vim-rake
|rbenv| https://github.com/tpope/vim-rbenv
*repeat* https://github.com/tpope/vim-repeat
|rhubarb| https://github.com/tpope/vim-rhubarb
|rsi| https://github.com/tpope/vim-rsi
|scriptease| https://github.com/tpope/vim-scriptease.git
|speeddating| https://github.com/tpope/vim-speeddating
|surround| https://github.com/tpope/vim-surround
|vinegar| https://github.com/tpope/vim-vinegar
|airline| https://github.com/vim-airline/vim-airline
|ale| https://github.com/dense-analysis/ale
*bats* https://github.com/vim-scripts/bats.vim
*bats-syntax* https://github.com/aliou/bats.vim.git
*blade* https://github.com/jwalton512/vim-blade
|composer| https://github.com/noahfrederick/vim-composer
|csapprox| https://github.com/vim-scripts/CSApprox
|ctrlp| https://github.com/ctrlpvim/ctrlp.vim
*ctrlp-tjump* https://github.com/ivalkeen/vim-ctrlp-tjump
|dbml| https://github.com/jidn/vim-dbml
|easymotion| https://github.com/easymotion/vim-easymotion
|ferret| https://github.com/wincent/ferret
|ft-csv| https://github.com/chrisbra/csv.vim
|fugitive-gitlab| https://github.com/shumphrey/fugitive-gitlab.vim.git
|gitgutter| https://github.com/airblade/vim-gitgutter
|graphql| https://github.com/jparise/vim-graphql.git
|gutentags| https://github.com/ludovicchabant/vim-gutentags
|haskell-vim.txt| https://github.com/neovimhaskell/haskell-vim
|indent-object| https://github.com/michaeljsmith/vim-indent-object
|indentline.txt| https://github.com/Yggdroot/indentLine
*javascript* https://github.com/pangloss/vim-javascript
|laravel| https://github.com/noahfrederick/vim-laravel
|man| https://github.com/vim-utils/vim-man
|move.txt| https://github.com/matze/vim-move
*php-complete* https://github.com/shawncplus/phpcomplete.vim
|previm| https://github.com/previm/previm
|rainbow| https://github.com/luochen1990/rainbow
|ReplaceWithRegister.vim| https://github.com/inkarkat/vim-ReplaceWithRegister
|reply| https://github.com/rhysd/reply.vim
*ri* https://github.com/danchoi/ri.vim
|rooter| https://github.com/airblade/vim-rooter
|splitjoin| https://github.com/AndrewRadev/splitjoin.vim
*sql-heredoc* https://github.com/aliou/sql-heredoc.vim
*syntax-extra* https://github.com/justinmk/vim-syntax-extra
*vim-json* https://github.com/elzr/vim-json
|supertab| https://github.com/ervandew/supertab
|tabular| https://github.com/godlygeek/tabular
|tagbar| https://github.com/majutsushi/tagbar
*tagbar-markdown* https://github.com/lvht/tagbar-markdown
*textobj-erb* https://github.com/whatyouhide/vim-textobj-erb
|textobj-rubyblock| https://github.com/nelstrom/vim-textobj-rubyblock
|textobj-user| https://github.com/kana/vim-textobj-user
|undotree.txt| https://github.com/mbbill/undotree
|vim-jsx-pretty| https://github.com/MaxMEllon/vim-jsx-pretty
|vim-markdown| https://github.com/plasticboy/vim-markdown
|vim-rest-console| https://github.com/diepm/vim-rest-console
|visual-increment| https://github.com/vim-scripts/visual-increment