-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc_plugin
299 lines (248 loc) · 8.63 KB
/
.vimrc_plugin
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
" Airline config (Must be set before loading plugin)
let g:airline_powerline_fonts = 1
let g:airline#extensions#bufferline#enabled = 2
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#show_buffers = 1
let g:airline#extensions#tabline#show_tabs = 1
let g:airline#extensions#tabline#buffer_min_count = 0
let g:airline#extensions#tabline#formatter = 'unique_tail'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ }
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.branch = ''
let g:airline_left_alt_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.maxlinenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = '∄'
let g:airline_symbols.whitespace = 'Ξ'
func AirlineFancy()
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.branch = ''
AirlineRefresh
endfunc
command! AirlineFancy call AirlineFancy()
func AirlineCompatible()
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.branch = '⎇'
AirlineRefresh
endfunc
command! AirlineCompatible call AirlineCompatible()
" Assign filetype to airline's public api function
" call airline#parts#define_function('filetype', 'airline#parts#filetype')
" function! AirlineInit()
" " Assign the filetype function to section a
" let g:airline_section_a = airline#section#create(['filetype'])
" endfunction
" autocmd User AirlineAfterInit call AirlineInit()
" Font configuration
if has("win32")
set guifont=Powerline_Consolas:h8:cANSI
else
"set guifont=Monospace\ 9
"set guifont=Consolas\ 8
"set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 12
set guifont=Liberation\ Mono\ for\ Powerline\ 21
endif
"Latex
let g:tex_flavor='latex'
" Toggle quickfix
let g:lt_location_list_toggle_map = '<F4>'
let g:lt_quickfix_list_toggle_map = '<F5>'
let g:lt_height = 15
" Key bindings
" ===========================================================================
nmap <F2> :CtrlPMRUFiles<CR>
nmap <F3> :NERDTreeToggle<CR>
nmap <F8> :Compile<CR>
nmap <F10> :call VimCommanderToggle()<CR>
nmap <leader><F2> :CtrlPMixed<CR>
nmap <leader><F3> :TagbarToggle<CR>
nmap <leader>b :CtrlPBuffer<CR>
nmap <leader>x :BD<cr>
nmap <leader>§ :set rnu! rnu? <cr>
" Expand / decrease selection
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" Remap to use tag plugin if installed
if executable("gtags")
nmap <leader>gt :GtagsCursor<CR>]
elseif executable("cscope")
let g:cscope_silent = 1
" Minimum key mappings
nnoremap <leader>fa :call CscopeFindInteractive(expand('<cword>'))<CR>
nnoremap <leader>l :call ToggleLocationList()<CR>
" s: Find this C symbol
nnoremap <leader>fs :call CscopeFind('s', expand('<cword>'))<CR>
" g: Find this definition
nnoremap <leader>fg :call CscopeFind('g', expand('<cword>'))<CR>
" d: Find functions called by this function
nnoremap <leader>fd :call CscopeFind('d', expand('<cword>'))<CR>
" c: Find functions calling this function
nnoremap <leader>fc :call CscopeFind('c', expand('<cword>'))<CR>
" t: Find this text string
nnoremap <leader>ft :call CscopeFind('t', expand('<cword>'))<CR>
" e: Find this egrep pattern
nnoremap <leader>fe :call CscopeFind('e', expand('<cword>'))<CR>
" f: Find this file
nnoremap <leader>ff :call CscopeFind('f', expand('<cword>'))<CR>
" i: Find files #including this file
nnoremap <leader>fi :call CscopeFind('i', expand('<cword>'))<CR>
endif
" Autocommands
" ===========================================================================
" Treat Qt stylesheets as CSS files
au BufNewFile,BufRead *.qss set filetype=css
"
" Use bitbake highlighting for OE-lite recipes
au BufNewFile,BufRead *.oe set filetype=bitbake
" Autochdir confuses plugins. This is a workaround
au BufEnter * silent! lcd %:p:h
" Markdown syntax
au BufNewFile,BufReadPost *.md set filetype=markdown
" Disable parenthesis highlighting for some file formats
au FileType python let g:loaded_matchparen=1
" Always wrap in vimdiff
au VimEnter * if &diff | execute 'windo set wrap' | endif
" Plugin configurations
" ===========================================================================
" Clang format
nmap <tab> :.ClangFormat<CR>
" VCSCommands standard mappings conflicts with NERD-commenter
let VCSCommandDisableMappings = 1
" PyMode Config
let g:pymode_options_colorcolumn = 0
let g:pymode_folding = 0
let g:pymode_lint = 1
let g:pymode_lint_on_write = 1
let g:pymode_lint_message = 1
let g:pymode_lint_checker = "pyflakes,pep8"
let g:pymode_lint_ignore = "E501,E303,W0611,W391,E265,E401,W602,C901,W293"
let g:pymode_lint_slow_sync = 0
let g:pymode_trim_whitespaces = 0
let g:pymode_rope = 0
" Syntastic config
let g:syntastic_cpp_compiler_options = "-std=c++11 -Wall -Wextra -Wpedantic"
let g:syntastic_mode_map = {"mode": "passive"}
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
" Tab completion
if has('nvim')
let g:deoplete#sources#clang#libclang_path = "/usr/lib/x86_64-linux-gnu/libclang.so"
let g:deoplete#sources#clang#clang_header = "/usr/lib/clang"
let g:deoplete#enable_at_startup = 1
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ deoplete#mappings#manual_complete()
else
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
endif
" Neomake check on write
" au BufWritePost *.c,*.h,*.cpp,*.hpp Neomake
" Speed up easytags
"let g:easytags_syntax_keyword = 'always'
"let g:gutentags_modules = ['ctags', 'cscope']
" Speed up TagBar
set updatetime=1000
" Latexbox config
au FileType tex nnoremap <buffer> <leader><F3> :LatexTOCToggle<CR>
let g:LatexBox_split_side = 'rightbelow'
let g:LatexBox_latexmk_options = '-pdflatex="pdflatex -synctex=1 %O %S"'
let g:LatexBox_latexmk_async=1
" Faster CtrlP
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
" Latex-suite requires grep to always return filename
set grepprg=grep\ -nH\ $*
" Set normal make (If changed by lvimrc)
"set makeprg=make!
" Taglist
let Tlist_Use_Right_Window = 1
" Autopairs
let g:AutoPairsMapCR = 0
" Better color for matching parenthesis
au BufRead * hi MatchParen ctermbg=none ctermfg=yellow
" NERDTree
let g:NERDTreeShowHidden = 1
let g:NERDTreeAutoCenter = 1
let g:NERDTreeHijackNetrw = 0
" Auto refresh NERDTree
function! IsNTOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
func! NERDTreeRefresh()
if &modifiable && IsNTOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunc
au BufEnter *.* call NERDTreeRefresh()
" NERDCommenter
let g:NERDSpaceDelims = 1
" Signify
let g:signify_vcs_list = [ 'svn' ]
" Custom Async compilation
func MakeThis()
copen 15
exe 'cd ' . g:make_this_path
if has('nvim') && g:make_this_async == 1
exec "AsyncRun " . g:make_this_cmd
else
let &makeprg=g:make_this_cmd
make
endif
endfunc
command! Compile call MakeThis()
" Load plugins
exec load_vimplug_config
" Reconfigure some airline secions
let g:airline_section_y = ''
let g:airline_section_z = '%p%%'
" Hide some airline sections when window is too small
call airline#parts#define_minwidth('filetype', 150)
call airline#parts#define_minwidth('branch', 150)
" Color scheme
colorscheme neverland
" Popup menu configuration
highlight Pmenu ctermbg=237 ctermfg=248
highlight PmenuSel ctermbg=243 ctermfg=226