-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvimrc
More file actions
325 lines (284 loc) · 9.2 KB
/
Copy pathvimrc
File metadata and controls
325 lines (284 loc) · 9.2 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
source ~/.vim/bundle/pathogen/autoload/pathogen.vim
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on
set guioptions+=c
set guioptions-=T
set guioptions-=l
set guioptions-=r
set guioptions-=L
set guioptions-=R
if $TERM == 'xterm-256color' || $TERM == 'rxvt-unicode-256color'
colorscheme PaperColor
set cursorline
endif
set nocompatible
set history=500
set title
set nobackup
set backspace=indent,eol,start
set relativenumber
set number
set ruler
set showmatch
set hlsearch
set autoindent
set incsearch
set ignorecase
set smartcase
set nowrap
set list
set listchars=tab:\|\ ,trail:·,precedes:<,extends:>
set foldmethod=indent
set foldnestmax=2
set nofoldenable
set completeopt=menuone
set wildmenu
set lazyredraw
set scrolloff=1
set sidescrolloff=6
set nospell
set spelllang=en,es
set path+=/usr/local/include,**
set pastetoggle=<F10>
autocmd BufEnter README,TODO,BUGS setlocal filetype=text
autocmd BufEnter PLAN,NOTES,*.notes setlocal filetype=notes
autocmd BufEnter *.sls setlocal filetype=yaml
autocmd FileType c,cpp setlocal foldmethod=syntax cinoptions=(0,g0,N-s,:0,l1,t0 | compiler gcc
autocmd FileType go setlocal foldmethod=syntax formatoptions+=ro suffixesadd=.go
autocmd FileType haskell setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=2 foldmethod=indent
autocmd FileType cabal,yaml setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType text,notes,markdown,rst,tex,mail setlocal textwidth=72 formatoptions+=2l colorcolumn=+1
autocmd FileType text,notes,markdown,rst,tex,mail setlocal expandtab tabstop=2 shiftwidth=2 spell
autocmd FileType gitcommit setlocal expandtab tabstop=2 shiftwidth=2 spell
autocmd FileType help setlocal nospell
autocmd FileType haskell noremap <buffer> <silent> K :execute '!hoogle search --color --info' shellescape(expand('<cWORD>')) '\| less -R'<Enter>
" NERDTree plugin:
let NERDTreeMinimalUI = 1
" Startify plugin:
let startify_custom_header = readfile(split(&runtimepath, ",")[0] . '/logo.txt')
let startify_change_to_dir = 0
" fzf plugin:
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'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment']
\ }
" Clang plugin:
let clang_cpp_options = '-std=c++14 -stdlib=libc++'
" Grepper plugin:
let grepper = {}
let grepper.tools = ['git', 'grep']
" Gutentags plugin:
let gutentags_ctags_executable_haskell = 'vim-hasktags'
let gutentags_ctags_executable_go = 'vim-gotags'
let gutentags_project_info = [
\ {'type': 'haskell', 'glob': '*.cabal'},
\ {'type': 'go', 'glob': '*.go'},
\ {'type': 'go', 'glob': '*/*.go'}
\ ]
" Ale plugin:
let ale_lint_delay = 5000
let ale_lint_on_enter = 0
let ale_linters = {
\ 'haskell': ['cabal-repl', 'my-ghc', 'hlint'],
\ 'rust': ['cargo'],
\ }
let ale_fix_on_save = 1
let ale_fixers = {
\ 'haskell': ['hindent'],
\ 'rust': ['rustfmt'],
\ }
call ale#fix#registry#Add('hindent', 'ale#fixers#hindent#Fix', ['haskell'], 'Haskell pretty printer')
" Racer plugin:
let racer_experimental_completer = 1
autocmd FileType rust nmap gd <Plug>(rust-def)
autocmd FileType rust nmap gs <Plug>(rust-def-split)
autocmd FileType rust nmap gx <Plug>(rust-def-vertical)
autocmd FileType rust nmap <leader>gd <Plug>(rust-doc)
" Sneak plugin:
let sneak#label = 1
" Vim-go plugin:
let go_auto_type_info = 1
let go_fmt_fail_silently = 1
let go_fmt_command = 'goimports'
" haskell-vim plugin:
let haskell_enable_quantification = 1
let haskell_indent_guard = 4
let haskell_indent_if = 4
let haskell_indent_case = 4
let haskell_indent_in = 1
let haskell_indent_before_where = 2
let haskell_indent_after_bare_where = 2
" Tagbar plugin:
let tagbar_compact = 1
let tagbar_type_haskell = {
\ 'ctagsbin' : 'hasktags',
\ 'ctagsargs' : '-x -c -o-',
\ 'kinds' : [
\ 'm:modules:0:1',
\ 'd:data:0:1',
\ 'd_gadt:data gadt:0:1',
\ 'nt:newtype:0:1',
\ 'c:classes:0:1',
\ 'i:instances:0:1',
\ 'cons:constructors:0:1',
\ 'c_gadt:constructor gadt:0:1',
\ 'c_a:constructor accessors:1:1',
\ 't:type names:0:1',
\ 'pt:pattern types:0:1',
\ 'pi:pattern implementations:0:1',
\ 'ft:function types:0:1',
\ 'fi:function implementations:0:1',
\ 'o:others:0:1'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 'm' : 'module',
\ 'd' : 'data',
\ 'd_gadt' : 'd_gadt',
\ 'c_gadt' : 'c_gadt',
\ 'nt' : 'newtype',
\ 'cons' : 'cons',
\ 'c_a' : 'accessor',
\ 'c' : 'class',
\ 'i' : 'instance'
\ },
\ 'scope2kind' : {
\ 'module' : 'm',
\ 'data' : 'd',
\ 'newtype' : 'nt',
\ 'cons' : 'c_a',
\ 'd_gadt' : 'c_gadt',
\ 'class' : 'ft',
\ 'instance' : 'ft'
\ }
\ }
let tagbar_type_rust = {
\ 'ctagstype' : 'rust',
\ 'kinds' : [
\ 'T:types,type definitions',
\ 'f:functions,function definitions',
\ 'g:enum,enumeration names',
\ 's:structure names',
\ 'm:modules,module names',
\ 'c:consts,static constants',
\ 't:traits',
\ 'i:impls,trait implementations',
\ ]
\ }
match Todo /TODO\|FIXME\|XXX\|FUCKME/
inoremap jk <Esc>
inoremap kj <Esc>:w<Enter>
noremap <C-j> 6j
noremap <C-k> 6k
noremap <silent> <C-Up> :wincmd k<Enter>
noremap <silent> <C-Down> :wincmd j<Enter>
noremap <silent> <C-Left> :wincmd h<Enter>
noremap <silent> <C-Right> :wincmd l<Enter>
noremap <silent> <F1> :NERDTreeToggle<Enter>
noremap <silent> <F2> :write<Enter>
noremap <silent> <F3> :nohlsearch<Enter>
noremap <silent> <F4> :make<Enter>
noremap <silent> <F5> :shell<Enter>
noremap <silent> <F6> :if <SID>ToggleAutoHighlight()<Bar>set hlsearch<Bar>else<Bar>nohlsearch<Bar>endif<Enter>
noremap <silent> <F7> :TagbarToggle<Enter>
noremap <silent> <F8> :lvimgrep /TODO\\|FIXME\\|XXX\\|FUCKME/j %<Enter>:lopen<Enter>
noremap <silent> <F9> :checktime<Enter>
noremap <silent> <F11> :Spaces<Enter>
noremap <silent> <F12> :SpellThis<Enter>
" Corrects current word spelling with the first suggestion
autocmd FileType text,notes,markdown,rst,tex,mail,gitcommit noremap <buffer> <silent> <Leader>s 1z=
" Formats current paragraph
autocmd FileType text,notes,markdown,rst,tex,mail,gitcommit noremap <buffer> <silent> <Leader>p gwap
" Open fzf in different modes
noremap <silent> <Space> :Buffers<Enter>
noremap <silent> <C-p> :Files<Enter>
noremap <silent> <Leader>P :Tags<Enter>
" Open location list window
noremap <silent> <Leader><Space> :lopen<Enter>
" Enter in interactive mode of EasyAlign plugin
vnoremap <silent> <Enter> :EasyAlign<Enter>
" Adds spaces around current block of lines
noremap <silent> <Leader><Enter> :call <SID>AddSpaces()<Enter>
" Removes spaces around current block of lines
noremap <silent> <Leader><BS> :call <SID>RemoveSpaces()<Enter>
" Collapses current block of blank lines to one
noremap <silent> <Leader><Del> :call <SID>CollapseSpaces()<Enter>
nnoremap <Leader>g :Grepper -open -switch<Enter>
nnoremap <Leader>* :Grepper -open -switch -cword<Enter>
" Shows double and trailing spaces
command Spaces silent normal / \{2}\|\s\+$\|\n\{3}/<Enter>
function s:AddSpaces() range
let separation = 2
let blanks = repeat([''], separation)
call append(a:lastline, blanks)
call append(a:firstline - 1, blanks)
endfunction
function s:RemoveSpaces()
if getline('.') == ''
let fromline = prevnonblank(line('.')) + 1
let toline = nextnonblank(line('.')) - 1
call s:DeleteLines(fromline, toline, 0)
return
endif
let toline = search('^$', 'bnW')
if toline != 0
let fromline = prevnonblank(toline) + 1
call s:DeleteLines(fromline, toline)
endif
let fromline = search('^$', 'nW')
if fromline != 0
let toline = nextnonblank(fromline) - 1
call s:DeleteLines(fromline, toline)
endif
endfunction
function s:CollapseSpaces()
if getline('.') != ''
return
endif
if line('.') > 1 && getline(line('.') - 1) == ''
let toline = line('.') - 1
let fromline = prevnonblank(toline) + 1
call s:DeleteLines(fromline, toline)
endif
if line('.') < line('$') && getline(line('.') + 1) == ''
let fromline = line('.') + 1
let toline = nextnonblank(fromline) - 1
call s:DeleteLines(fromline, toline)
endif
endfunction
function s:DeleteLines(fromline, toline, ...)
let toline = a:toline < 1 ? line('$') : a:toline
silent execute a:fromline . ',' . toline . 'delete'
if a:0 == 0 || a:0 == 1 && a:1
normal ``
endif
endfunction
function s:ToggleAutoHighlight()
if exists('#auto_highlight')
autocmd! auto_highlight
augroup! auto_highlight
augroup END
set updatetime&
return 0
else
augroup auto_highlight
autocmd!
autocmd CursorHold * let @/ = '\V\<' . escape(expand('<cword>'), '\') . '\>'
augroup END
set updatetime=200
return 1
endif
endfunction