forked from frioux/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
369 lines (278 loc) · 8.28 KB
/
vimrc
File metadata and controls
369 lines (278 loc) · 8.28 KB
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
if has('win32')
let &runtimepath = substitute(&runtimepath, '\(\~\|'.$USER.'\)/vimfiles\>', '\1/.vim', 'g')
endif
runtime bundle/pathogen/autoload/pathogen.vim
call pathogen#infect()
if has('python3')
call pathogen#infect('bundle-python/{}')
endif
if has('lua')
call pathogen#infect('bundle-lua/{}')
endif
if has('nvim')
call pathogen#infect('bundle-nvim/{}')
endif
let g:deoplete#enable_at_startup = 1
"{{{Auto Commands
set formatprg=fmt\ -w80
augroup vimrc
autocmd!
au VimEnter * set vb t_vb=
au FileType perl let b:dispatch = 'perl %'
au FileType perl setlocal formatprg=perltidy
au FileType go setlocal formatprg=gofmt
au FileType sml setlocal commentstring=(*\ %s\ *)
au FileType racket setlocal commentstring=;\ %s
au FileType tf setlocal commentstring=#\ %s
au BufReadPost *.rkt,*.rktl setlocal filetype=racket
au FileType racket setlocal lisp
au FileType racket setlocal autoindent
au FileType markdown let b:lost_regex = '\v^#'
au FileType help setlocal nolist
au BufWritePre /tmp/* setlocal noundofile
au BufWritePre /run/shm/* setlocal noundofile
augroup END
"}}}
"{{{Misc Settings
set conceallevel=2
" PERSISTENT UNDO
set undofile
set history=10000
if has('nvim')
set viminfo='100,\"100,n~/.nviminfo
else
set viminfo='100,\"100,n~/.viminfo
endif
set matchpairs+=<:>
if has('termguicolors')
set termguicolors
endif
" Necessary for lots of cool vim things
set nocompatible
" This shows what you are typing as a command. I love this!
set showcmd
" Needed for Syntax Highlighting and stuff
filetype on
filetype plugin on
filetype plugin indent on
syntax enable
" Who doesn't like autoindent?
set autoindent
" Spaces are better than a tab character
set expandtab
" Who wants an 8 character tab? Not me!
set sw=3
set ts=3
set tw=80
" Cool tab completion stuff
set wildmenu
set wildmode=full
" Case insensitive wild menu
set wildignorecase
" Line Numbers PWN!
set number
" Ignoring case is a fun trick
set ignorecase
" And so is Artificial Intelligence!
set smartcase
" This is totally awesome - remap jk to escape in insert mode. You'll never type jk anyway, so it's great!
inoremap jk <Esc>
" Incremental searching is sexy
set incsearch
" Highlight things that we find with the search
set hlsearch
" allow selection of nothing
set virtualedit=block
" I never use octal (or hex?) so only treat numbers like decimals
set nrformats=
" }}}
"{{{Look and Feel
if has('termguicolors') && $COLORTERM == 'truecolor'
set termguicolors
if len($TMUX) > 0
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
endif
if has("gui_running")
colorscheme solarized
else
if has('termguicolors') && &termguicolors == 1
colorscheme solarized8_dark_high
else
colorscheme elflord
endif
endif
"Status line gnarliness
set laststatus=2
" }}}
"{{{ Mappings
if has('nvim')
tnoremap <Esc> <C-\><C-n>
tnoremap <C-v><Esc> <Esc>
endif
" toppost
nnoremap <silent> <Leader>tp :%!top-post<CR>ggI
vnoremap <silent> <Leader>tp :!top-post<CR>
" Edit vimrc \ev
nnoremap <silent> <Leader>ev :split $MYVIMRC<CR>
" Up and down are more logical with g..
nnoremap <silent> k gk
nnoremap <silent> j gj
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
noremap N Nzz
noremap n nzz
" http://learnvimscriptthehardway.stevelosh.com/chapters/04.html
nnoremap <c-u> viwU
inoremap <c-u> <esc>viwUi
" Testing
set completeopt=longest,menuone,preview
set complete-=i
" Swap ; and : Convenient.
nnoremap ; :
vnoremap ; :
" Make %% represent the dir of the current buffer
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
set pastetoggle=<F12>
nmap gV `[v`]
nnoremap <leader>ts :r !date "+\%FT\%T\%:z"<CR>
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
nnoremap <silent> <leader>DD :exe ":profile start profile.log"<cr>:exe ":profile func *"<cr>:exe ":profile file *"<cr>
nnoremap <silent> <leader>DP :exe ":profile pause"<cr>
nnoremap <silent> <leader>DC :exe ":profile continue"<cr>
nnoremap <silent> <leader>DQ :exe ":profile pause"<cr>:noautocmd wqa!<cr>
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
"}}}
" {{{ airline settings
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
if has('win32')
set listchars=tab:-\ ,nbsp:~
let g:airline_left_sep = '>'
let g:airline_right_sep = '<'
let g:airline_symbols.linenr = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.whitespace = '='
else
set listchars=tab:▸\ ,nbsp:~
let g:airline_left_sep = '▶'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = ''
let g:airline_symbols.branch = '⎇ '
let g:airline_symbols.whitespace = 'Ξ'
endif
" }}}
set list
" {{{ ale settings
"
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
" }}}
" {{{ ctrlp settings
function! DirCtrlP()
let g:ctrlp_working_path_mode = 0
CtrlP
endfunction
function! FileRelCtrlP()
let g:ctrlp_working_path_mode = 'c'
CtrlP
endfunction
let g:ctrlp_abbrev = {
\ "abbrevs": [
\ {
\ "pattern": "^lib:",
\ "expanded": "^lib/"
\ },
\ {
\ "pattern": "^t:",
\ "expanded": "^t/"
\ }
\ ]
\ }
" put ctrlp matcher on top, ordering top to bottom
let g:ctrlp_match_window = 'top,order:ttb,min:5,max:30'
" search with regexen by default
let g:ctrlp_regexp = 1
call denite#custom#option('_', 'direction', 'aboveleft')
nnoremap <silent> <F3> :Denite file_rec<CR>
nnoremap <silent> <F4> :DeniteBufferDir file_rec<CR>
nnoremap <silent> <F5> :Denite buffer<CR>
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
let g:ctrlp_use_caching = 0
" }}}
let g:jshintprg="hint"
" hopefully can get these into unimpaired
" (https://github.com/tpope/vim-unimpaired/issues/63)
nnoremap [oy :setlocal syntax=on<cr>
nnoremap ]oy :setlocal syntax=off<cr>
nnoremap coy :if exists("g:syntax_on") \| setlocal syntax=off \| else \| setlocal syntax=on \| endif<CR>
nnoremap [oM :Matchmaker<cr>
nnoremap ]oM :Matchmaker!<cr>
nnoremap coM :MatchmakerToggle<CR>
nnoremap [oW :EnableWhitespace<cr>
nnoremap ]oW :DisableWhitespace<cr>
nnoremap coW :ToggleWhitespace<cr>
nnoremap [oS :let b:syntastic_mode = 'active'<cr>
nnoremap ]oS :let b:syntastic_mode = 'passive'<cr>
nnoremap coS :SyntasticToggleMode<cr>
nnoremap [oQ :let g:qs_enable = 1<cr>
nnoremap ]oQ :let g:qs_enable = 0<cr>
nnoremap coQ :QuickScopeToggle<cr>
nnoremap [oN :NeoCompleteEnable<cr>
nnoremap ]oN :NeoCompleteDisable<cr>
nnoremap coN :NeoCompleteToggle<CR>
function! CycleColors()
let mycolors = []
if has('termguicolors') && &termguicolors
let mycolors += ['solarized8_dark_high', 'solarized8_light_high']
endif
let mycolors += [ 'elflord', 'desert' ]
let colordict = {}
let index = 0
while index < len(mycolors) - 1
let item = mycolors[index]
let colordict[item] = mycolors[index+1]
let index += 1
endwhile
let colordict[mycolors[-1]] = mycolors[0]
if has_key(g:, 'colors_name') && has_key(colordict, g:colors_name)
let nextColor = colordict[g:colors_name]
else
let nextColor = mycolors[0]
endif
execute ':colorscheme ' . nextColor
endfunction
nnoremap <F12> :call CycleColors()<cr>
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
set directory=$HOME/.vvar/swap
set undodir=$HOME/.vvar/undo
" vp doesn't replace paste buffer
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
vmap <silent> <expr> p <sid>Repl()
let perl_no_subprototype_error = 1
function! ZRPod()
let path = substitute(substitute(@%, '\(app/lib/\|\.pm\)', '', 'g'), '/', '::', 'g')
let url = 'https://pod.ziprecruiter.com/?' . path
let command = "firefox '" . url . "'"
execute ":!" command
endfunction
command! Pod call ZRPod()
let g:qs_highlight_on_keys = [ 'f', 'F', 't', 'T' ]
command! Gdiffs cexpr system('git diff \| diff-hunk-list')
command! GLdiffs lexpr system('git diff \| diff-hunk-list')
command! CountMatches %s///gn
let g:fugitive_gitlab_domains = ['https://git.ziprecruiter.com']
command! -nargs=1 Gg :Grepper -tool git -query <args>
" vim: foldmethod=marker