-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
440 lines (355 loc) · 12.3 KB
/
vimrc
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
" Super awesome VIM Configuration -
" - Duane Arnett
" - fortyau.com
" Plugins ----------------------------------------------------------------
" Activate pathogen
" call pathogen#infect()
call plug#begin('~/.vim/plugged')
" Themes
Plug 'kristijanhusak/vim-hybrid-material'
" Make VIM nicer
Plug 'rbgrouleff/bclose.vim' " Close a buffer
Plug 'junegunn/vim-peekaboo'
" Plug 'embear/vim-localvimrc' " Overwrite config per directory
" Plug 'easymotion/vim-easymotion'
" Tim Pope section
Plug 'tpope/vim-obsession' " Better session management
Plug 'tpope/vim-dispatch' " Async operations
Plug 'tpope/vim-fugitive' " Git in vim
Plug 'tpope/vim-surround'
" Git helpers
Plug 'tpope/vim-rhubarb'
Plug 'shumphrey/fugitive-gitlab.vim'
" Auto-correction for writing things
" Plug 'reedes/vim-wordy', { 'for': ['mail', 'markdown', 'text'] }
Plug 'reedes/vim-litecorrect', { 'for': ['mail', 'markdown', 'text'] }
" Editor niceties
Plug 'jiangmiao/auto-pairs'
Plug 'ctrlpvim/ctrlp.vim' | Plug 'FelikZ/ctrlp-py-matcher'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
" Plug 'mileszs/ack.vim'
" Enable for OSX:
" Plug 'rizzatti/dash.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | Plug 'xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
" Plug 'mtscout6/syntastic-local-eslint.vim', { 'for': ['js', 'jsx'] }
Plug 'mbbill/undotree'
Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'janko-m/vim-test'
Plug 'valloric/youcompleteme', { 'do': './install.py --tern-completer' }
Plug 'majutsushi/tagbar'
Plug 'honza/vim-snippets' " Snippets are separated from the engine. Add this if you want them:
Plug 'SirVer/ultisnips' " Track the engine.
Plug 'gko/vim-coloresque', { 'for': ['css', 'scss', 'less'] }
" CSVs
Plug 'chrisbra/csv.vim', { 'for': ['csv'] }
" CSS
Plug 'hail2u/vim-css3-syntax', { 'for': ['css', 'html'] }
" HTML
Plug 'mattn/emmet-vim', { 'for': ['html', 'hbs', 'eelixir', 'js', 'javascript', 'jsx'] }
Plug 'mustache/vim-mustache-handlebars', { 'for': 'hbs' }
" HTML/XML
Plug 'othree/xml.vim', { 'for': ['html', 'xml'] }
" Jade/Pug
" TODO DEPRECATE this...
Plug 'digitaltoad/vim-pug', { 'for': ['jade', 'pug'] }
" SCSS/SASS
Plug 'gcorne/vim-sass-lint', { 'for': ['scss', 'sass'] }
" Coffeescript
" TODO DEPRECATE the cjsx plugin
Plug 'mtscout6/vim-cjsx', { 'for': ['coffee'] }
Plug 'kchmck/vim-coffee-script', { 'for': ['coffee'] }
" Plug 'lukaszkorecki/CoffeeTags', { 'for': ['coffee'] }
" Elixir, erlang, etc
" https://github.com/slashmili/alchemist.vim
Plug 'elixir-lang/vim-elixir', { 'for': ['elixir'] }
Plug 'slashmili/alchemist.vim', { 'for': ['elixir'] }
" Javascript
" Plug 'mxw/vim-jsx', { 'for': ['js', 'javascript', 'jsx'] }
" Plug 'pangloss/vim-javascript', { 'for': ['js', 'javascript', 'jsx'] }
Plug 'heavenshell/vim-jsdoc', { 'for': ['js', 'javascript', 'jsx'] }
Plug 'epilande/vim-react-snippets'
" Crystal lang
Plug 'rhysd/vim-crystal', { 'for': ['crystal'] }
" PHP
Plug 'StanAngeloff/php.vim', { 'for': 'php' }
Plug 'lumiliet/vim-twig', { 'for': 'twig' }
" Java
" TODO ...but first use the eclim plugin...
" TODO conditionally toggle the eclim plugin on and off
" Mail
call plug#end()
" Autocommands for mutt, etc
set spelllang=en_us
au BufRead,BufNewFile *mutt* set filetype=mail
autocmd FileType mail set spell
augroup litecorrect
autocmd!
autocmd FileType markdown,mkd call litecorrect#init()
autocmd FileType mail call litecorrect#init()
augroup END
let syntastic_mode_map = { 'passive_filetypes': ['html'] }
set nocompatible
set noswapfile
set backupcopy=yes
set nobackup
set nocursorcolumn
set nocursorline
set norelativenumber
set foldmethod=manual
set noesckeys
set timeoutlen=1000 ttimeoutlen=0
set clipboard=unnamedplus " - Use the system clipboard inside vim
" -- Display
set title
set number
set ruler
set wrap
set autoindent
set scrolloff=3
set guioptions=T
" -- Default editorconfig
set tabstop=4 softtabstop=0 expandtab shiftwidth=2 smarttab
set nowrap " Disable softwrap
" -- Search
set ignorecase
set smartcase
set incsearch
set hlsearch
let g:ackprg = 'ag --vimgrep'
" -- Beep
set visualbell
set noerrorbells
" Backspace behaves as expected
set backspace=indent,eol,start
set hidden
" Movement...
set iskeyword-=.
" Leader keys mapping
" Uses the bclose script for some more sane buffer management
nnoremap <silent> <Leader>bl :Buffers<CR>
nnoremap <silent> <Leader>bd :Bclose<CR>
nnoremap <Tab> :bnext<CR>:redraw<CR>
nnoremap <S-Tab> :bprevious<CR>:redraw<CR>
let bclose_multiple = 0
" Leader git commands
nnoremap <silent> <Leader>gs :Gstatus<CR>
nnoremap <silent> <Leader>gp :Gpush<CR>
" Leader dispatch commands
nnoremap <silent> <Leader>d :Dispatch
nnoremap <silent> <Leader>b :Dispatch!
" Shows invisibles like we are used to with other editors
set listchars=tab:>-,trail:.,extends:>,precedes:<,nbsp:.
set list
" Show an 80 character vertical rule...
let &colorcolumn=join(range(81,999),",")
let &colorcolumn="80,".join(range(400,999),",")
" Removes trailing spaces on buffer write
function! TrimWhiteSpace()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfunction
autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd BufWritePre * :call TrimWhiteSpace()
" Enable syntax highlighting
syntax enable
" -- Coffee support
" let g:CoffeeAutoTagDisabled=1 " Disables autotaging on save (Default: 0 [false])
" let g:CoffeeAutoTagFile=<filename> " Name of the generated tag file (Default: ./tags)
" let g:CoffeeAutoTagIncludeVars=1 " Includes variables (Default: 0 [false])
" let g:CoffeeAutoTagTagRelative=1 " Sets file names to the relative path from the tag file location to the tag file location (Default: 1 [true])
" -- Themes!
set background=dark
set cursorline
set cursorcolumn
colorscheme hybrid_material
let g:airline_theme="hybrid"
let g:enable_bold_font=1
let g:enable_italic_font=1
"" Enable file specific behavior like syntax highlighting and indentation
filetype on
filetype plugin on
filetype indent on
""" Stagebloc sbt files should be associated with HTML
au BufRead,BufNewFile *.sbt setfiletype html
set guifont=Hack
set antialias
set fillchars=vert:│ " that's a vertical box-drawing character
" Airline
" let g:airline#extensions#tabline#enabled = 1
" air-line
let g:airline_powerline_fonts = 1
" if !exists('g:airline_symbols')
" let g:airline_symbols = {}
" endif
" unicode symbols
"let g:airline_left_sep = '»'
"let g:airline_left_sep = '▶'
"let g:airline_right_sep = '«'
"let g:airline_right_sep = '◀'
"let g:airline_symbols.linenr = '␊'
"let g:airline_symbols.linenr = ''
"let g:airline_symbols.linenr = '¶'
"let g:airline_symbols.branch = '⎇'
"let g:airline_symbols.paste = 'ρ'
"let g:airline_symbols.paste = 'Þ'
"let g:airline_symbols.paste = '∥'
"let g:airline_symbols.whitespace = 'Ξ'
"
"" airline symbols
"let g:airline_left_sep = ''
"let g:airline_left_alt_sep = ''
"let g:airline_right_sep = ''
"let g:airline_right_alt_sep = ''
"let g:airline_symbols.branch = ''
"let g:airline_symbols.readonly = ''
"let g:airline_symbols.linenr = ''
" -- ctrp config
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let g:ctrlp_lazy_update = 150
let g:ctrlp_clear_cache_on_exit = 0
set wildignore+=*/tmp/*,*.so,*.tmp/,*/node_modules,*/dist,*.swp,*.zip,*.beam
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](doc|tmp|.tmp|node_modules|dist)',
\ 'file': '\v\.(exe|so|dll|beam)$',
\ }
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
" -- NERDtree config
let NERDTreeShowHidden=1
let g:NERDTreeIgnore=['\~$', 'vendor', 'tmp', '.tmp', 'dist', 'node_modules', 'bower_components']
let g:tern_map_keys=1 "enable keyboard shortcuts
let g:tern_show_argument_hints='on_hold' "show argument hints
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'qf' : 1,
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'unite' : 1,
\ 'text' : 1,
\ 'vimwiki' : 1,
\ 'pandoc' : 1,
\ 'infolog' : 1,
\ 'mail' : 1
\}
" -- Ultinsnips config
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<Leader><tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" -- Java autocompletion (adding eclim to omnifunc to be picked up by YCM)
let g:EclimCompletionMethod = 'omnifunc'
" -- Prose/lexical autocompletion
" let g:predictive#dict_path = expand($HOME . '/dotfiles/words')
" set dictionary=/usr/share/dict/words
" make test commands execute using dispatch.vim
let test#strategy = "dispatch"
" -- Hot keys
" Really save things when you didn't open the file as sudo
cmap w!! w !sudo tee % > /dev/null
" Disabling the directional keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
" Avoid using the <esc> key
imap ii <Esc>
" Quickly close a pane
nmap qq :q<CR>
" vim-test hotkeys
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
" Managing, rearranging, and opening tabs
nnoremap <silent> <leader>q :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <leader>w :execute 'silent! tabmove ' . (tabpagenr()+1)<CR>
nnoremap <silent> <leader>e :tabedit<CR>
" Leader key to tidy up HTML
nmap <silent> <leader>f :!tidy -mi -html -wrap 0 %<CR>
" Open dash.app under the current cursor for OSX only obviously...
" nmap <C-h> :Dash<CR>
" easily insert blank lines above and below without Insert mode
map <Enter> o<ESC>
map <S-Enter> O<ESC>
" NERDtree toggle
map <C-\> :NERDTreeToggle<CR>
nnoremap <F5> :UndotreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
" FZF setup
" https://github.com/junegunn/fzf.vim
set rtp+=~/.fzf
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" " - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
"" In Neovim, you can set up fzf window using a Vim command
let g:fzf_layout = { 'window': 'enew' }
let g:fzf_layout = { 'window': '-tabnew' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" " CTRL-N and CTRL-P will be automatically bound to next-history and
" " previous-history instead of down and up. If you don't like the change,
" " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
" Syntastic
" Feedback for linters and syntax errors
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_loc_list_height = 4
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint'] " Enable syntastic integration with
let g:syntastic_javascript_eslint_exe = '$(npm bin)/eslint'
let g:syntastic_sass_checkers=["sasslint"] " my default linting files
let g:syntastic_scss_checkers=["sasslint"]
" CTAGS Tagbar config for various languages...
let g:tagbar_type_elixir = {
\ 'ctagstype' : 'elixir',
\ 'kinds' : [
\ 'f:functions',
\ 'functions:functions',
\ 'c:callbacks',
\ 'd:delegates',
\ 'e:exceptions',
\ 'i:implementations',
\ 'a:macros',
\ 'o:operators',
\ 'm:modules',
\ 'p:protocols',
\ 'r:records',
\ 't:tests'
\ ]
\ }