forked from dilawar/vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
405 lines (338 loc) · 12.5 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
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-fugitive'
Bundle 'vim-scripts/DrawIt'
Bundle 'vim-scripts/DoxygenToolkit.vim'
Bundle 'vim-scripts/check-mutt-attachments.vim'
Bundle 'itchyny/calendar.vim'
Bundle 'tpope/vim-dispatch'
Bundle 'godlygeek/tabular'
Bundle "heavenshell/vim-pydocstring"
Bundle 'vimwiki/vimwiki'
Bundle "tpope/vim-obsession"
Bundle "stanangeloff/php.vim"
Bundle "posva/vim-vue"
" Google Codefmt
" (The latter must be installed before it can be used.)
Bundle 'google/vim-maktaba'
Bundle 'google/vim-codefmt'
" Also add Glaive, which is used to configure codefmt's maktaba flags. See
" `:help :Glaive` for usage.
Bundle 'google/vim-glaive'
" ...
call vundle#end()
" the glaive#Install() should go after the "call vundle#end()"
call glaive#Install()
" Optional: Enable codefmt's default mappings on the <Leader>= prefix.
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar /path/to/google-java-format-VERSION-all-deps.jar"
" phpstan
Bundle "phpstan/vim-phpstan"
" CloseTag
Bundle "alvan/vim-closetag"
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.vue,*.php'
"" beware of using python-mode with jedihttps://github.com/davidhalter/jedi-vim/issues/163
"Bundle 'davidhalter/jedi-vim'
"let g:jedi#auto_initialization = 1
"let g:jedi#popup_on_dot = 0
" clang-format'
" Bundle "rhysd/vim-clang-format"
" Grammarous
" Most of this config is from here:
" https://github.com/icyd/nvim.init/blob/7b7348a4f6e54769837226715aef7607e4885661/config/plugins.vimrc
Bundle "rhysd/vim-grammarous"
let g:grammarous#disabled_rules={
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES'],
\ 'help' : ['WHITESPACE_RULE', 'EN_QUOTES', 'SENTENCE_WHITESPACE', 'UPPERCASE_SENTENCE_START'],
\ }
" let g:grammarous#use_vim_spelllang=1
" let g:grammarous#languagetool_cmd = 'languagetool'
" let g:grammarous#use_vim_spelllang = 1
" let g:grammarous#enable_spell_check = 1
nnoremap <silent> <buffer><leader>zg :GrammarousCheck<CR>
nnoremap <silent> <buffer><leader>zr :GrammarousReset<CR>
nmap <buffer>gn <Plug>(grammarous-move-to-next-error)
nmap <buffer>gp <Plug>(grammarous-move-to-previous-error)
nmap <buffer>gr <Plug>(grammarous-move-to-info-window)r
nmap <buffer>gF <Plug>(grammarous-move-to-info-window)f
nmap <buffer>gR <Plug>(grammarous-move-to-info-window)R
Bundle "dpelle/vim-LanguageTool"
let g:languagetool_jar='~/.vim/bundle/vim-grammarous/misc/LanguageTool-4.1/languagetool-commandline.jar'
let g:languagetool_lang='en'
" csv .
Bundle 'chrisbra/csv.vim'
let g:csv_no_conceal = 1
" vim-cmake
Bundle "vhdirk/vim-cmake"
" tcomment slows things down quite a lot.
" Bundle "tomtom/tcomment_vim"
Bundle "ctrlpvim/ctrlp.vim"
Bundle 'chrisbra/unicode.vim'
Bundle 'easymotion/vim-easymotion'
Bundle 'lepture/vim-jinja'
Bundle 'flazz/vim-colorschemes'
" Turn TeX symbols into unicode.
Bundle 'dilawar/vim-unicoder'
" This script increase/descreses etc a selected column
Bundle 'vim-scripts/VisIncr'
Bundle "junegunn/vim-easy-align"
" c-support
Bundle 'WolfgangMehner/c-support'
Bundle 'bling/vim-airline'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" pweave support.
Bundle 'coyotebush/vim-pweave'
""" Syntastic
" Bundle 'vim-syntastic/syntastic'
" 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_ignore_files = ['\m^/usr/', '\m\c\.h$']
" let g:syntastic_cpp_compiler_options = ' -std=c++14 '
" let g:syntastic_python_checkers = ['pyflakes', 'flake8', 'pylint'] " ['flake8', 'pylint']
" let g:syntastic_python_pylint_args = '-E'
" let g:syntastic_tex_checkers = ['chktex']
" let g:syntastic_php_checkers = ['php']
" let g:syntastic_tex_chktex_args = '-n1 -n2 -n3 -n8 -n10 -n11 -n12 -n17 -n25 -n26 -n36 -n37'
" let g:syntastic_aggregate_errors = 1
" let g:syntastic_mode_map = {
" \ "mode": "passive",
" \ "active_filetypes": ["ruby", "php"],
" \ "passive_filetypes": ["python"] }
" map <F8> :SyntasticCheck<CR>
" ALE
" Bundle "w0rp/ale"
let g:airline#extensions#ale#enabled = 1
" let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_cpp_gcc_options = '-std=c++14'
let g:ale_tex_chktex_options = '-n26 -n18'
let g:ale_linters = {
\ 'python' : [ 'pyflakes'],
\ 'php' : [ 'psalm', 'php'],
\}
"" Fakeclip
Bundle "kana/vim-fakeclip"
Bundle 'ervandew/supertab'
" vimtex
Bundle 'lervag/vimtex'
" vim alternate
let g:alternateSearchPath="sfr:../source,sfr:../src,sfr:../include,sfr:../inc"
" shift+tab insert literal tab
inoremap <S-Tab> <C-V><Tab>
colorscheme default
filetype plugin on
filetype plugin indent on
syntax on
set hidden
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set smartcase " Do smart case matching
set incsearch " Incremental search
set mouse=v " Enable mouse usage (all modes)
set number
set ruler
set hlsearch
set autoindent
set smartindent
set encoding=utf-8
set fileencoding=utf-8
syntax enable
set complete-=k
set history=10000
" Spellfile;
set spellfile=$HOME/.vim/en.utf-8.add
" Mappings
source $HOME/.vim/mymappings.vim
au BufNewFile *.snw read ~/Scripts/template.snw
au BufRead,BufNewFile *.nw set filetype=noweb
au BufRead,BufNewFile *.cu set filetype=cpp
au BufRead,BufNewFile *.vue setlocal iskeyword+=- |
\ setlocal ts=2 sw=2
au BufRead,BufNewFile *.php setlocal ts=4 sw=4
au BufRead,BufNewFile *.js setlocal ts=3 sw=3
au BufRead,BufNewFile *.scad set filetype=openscad
au BufRead,BufNewFile *.snw set filetype=noweb
au BufRead,BufNewFile *.w set filetype=noweb
au BufRead,BufNewFile *.nw set spell spelllang=en
au BufRead,BufNewFile *.blog set filetype=markdown
au BufRead,BufNewFile *.labnote set filetype=tex
au BufRead,BufNewFile *.csv set filetype=csv
au BufRead,BufNewFile *.asy set filetype=cpp
au BufRead,BufNewFile *.yacml set filetype=dot
au BufRead,BufNewFile *.ino set filetype=cpp
au BufRead,BufNewFile *.gnu,*.gnuplot,*.plt,*.gpi set filetype=gnuplot
au BufRead,BufNewFile *.lyx set syntax=lyx foldmethod=syntax foldcolumn=3
au BufRead,BufNewFile wscript set filetype=python
au BufRead *.lyx syntax sync fromstart
au BufRead,BufNewFile *.jinja2,*.jinja set ft=jinja
au BufRead,BufNewFile *.pandoc setlocal filetype=pandoc
au BufRead,BufNewFile *.pandoc setlocal spell spelllang=en
let noweb_backend="tex"
let noweb_language="haskell"
let noweb_fold_code=1
au BufRead,BufNewFile *.tex set spell spelllang=en
au BufEnter *.tex set nosmartindent
" Blog related setting.
au BufRead,BufNew *.blog setlocal spell spelllang=en
au BufRead,BufNew *.blog setlocal complete+=k
au BufRead,BufNew *.md setlocal spell spelllang=en
au BufRead,BufNew *.markdown setlocal complete+=k
au BufRead,BufNew *.markdown setlocal spell spelllang=en
" On tmp files do not wrap lines by inserting newline, wrap it without newline.
au BufRead,BufNew *.tmp setlocal wrap linebreak nolist
au BufRead,BufNew *.txt setlocal wrap linebreak nolist
au BufNewFile *.vhd read ~/.vim/template/template.vhd
" au BufRead,BufNewFile *.bsv set filetype=verilog
au BufRead,BufNewFile *.bsv set syntax=bsv
au BufRead,BufNewFile *.max set filetype=maxima nospell
au BufRead,BufNewFile *.maxima set filetype=maxima nospell
au BufRead,BufNewFile *.mac set filetype=maxima nospell
au BufRead,BufNewFile *.maxima set filetype=maxima nospell
au BufRead,BufNewFile *.mc set filetype=maxima nospell
au BufRead,BufNewFile *.rules set filetype=make
au BufRead,BufNewFile *.tex set filetype=tex
set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!
let g:haddock_docdir= "/usr/share/doc/ghc/html/"
source $HOME/.vim/methods.vim
""indent guide
"Bundle 'nathanaelkane/vim-indent-guides'
"hi IndentGuidesOdd ctermbg=white
"hi IndentGuidesEven ctermbg=lightgrey
"let g:indent_guides_enable_on_vim_startup = 1
"let g:indent_guides_guide_size=1
" let g:indentLine_char="⁞"
" The very heavy plugin.
" Bundle 'Valloric/YouCompleteMe'
" default
set softtabstop=2
set shiftwidth=2
set expandtab
set smarttab
set textwidth=80
set colorcolumn=81
set wrap
set iskeyword+=_
set autoread
set showmatch
set errorbells
set backspace=2 "
" Create backup of all files.
set backup
set backupdir=~/vim-backup/,./.backup,/tmp,.
set undofile
let vimDir = '$HOME/.vim/'
let myUndoDir=expand(vimDir . '/undodir')
call system('mkdir -p ' . myUndoDir)
let &undodir = myUndoDir
set undofile
"" Read pdf file in vim
command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> -
command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> - |fmt -csw78
" clipboard
set clipboard=unnamedplus
""" When xlipboard support is not available
:command -range Cz :silent :<line1>,<line2>w !xsel -i -b
:command -range Cx :silent :<line1>,<line2>w !xsel -i -p
:command -range Cv :silent :<line1>,<line2>w !xsel -i -s
:cabbrev cv Cv
:cabbrev cz Cz
:cabbrev cx Cx
:command -range Pz :silent :r !xsel -o -b
:command -range Px :silent :r !xsel -o -p
:command -range Pv :silent :r !xsel -o -s
:cabbrev pz Pz
:cabbrev px Px
:cabbrev pv Pv
augroup nonvim
au!
au BufRead *.png,*.jpg,*.pdf,*.gif,*.xls* sil exe "!open " . shellescape(expand("%:p")) | bd | let &ft=&ft
au BufRead *.ppt*,*.doc*,*.rtf let g:output_pdf = shellescape(expand("%:r") . ".pdf")
au BufRead *.ppt*,*.doc*,*.rtf sil exe "!/home/dilawar/Scripts/any2pdf " . shellescape(expand("%:p"))
au BufRead *.ppt*,*.doc*,*.rtf sil exe "!open " . g:output_pdf | bd | let &ft=&ft
augroup end
" For mac
set clipboard=unnamed
" Diffdir options
let g:DirDiffExcludes = "CVS,*.class,*.exe,.*.swp,*/.git/*"
" Syntastic is very slow with pylint
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" Calendar
let g:calendar_google_calendar = 1
let g:calendar_google_task = 1
" Nerd Commentor
Bundle 'scrooloose/nerdcommenter'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Doxygen
let g:DoxygenToolkit_briefTag_pre="@Synopsis "
let g:DoxygenToolkit_paramTag_pre="@Param "
let g:DoxygenToolkit_returnTag="@Returns "
let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
let g:DoxygenToolkit_authorName="Dilawar Singh <[email protected]>"
let g:DoxygenToolkit_licenseTag="GNU-GPL v3"
" Pandoc
Bundle "vim-pandoc/vim-pandoc-syntax"
Bundle "vim-pandoc/vim-pandoc"
Bundle "vim-pandoc/vim-pandoc-after"
let g:pandoc#biblio#use_bibtool=1
let g:pandoc#modules#disabled=[ "folding", "formatting" ]
let g:pandoc#formatting#mode="sA"
let g:pandoc#spell#enabled=1
let g:pandoc#after#modules#enabled=["supertab"]
let g:pandoc#syntax#conceal#use = 0
" VIMRC
set shortmess=a
set cmdheight=2
" wildcard
set wildmode=longest,list,full
set wildmenu
set conceallevel=0
""" SnipMate
""" NOTE: Using ultisnips
Bundle 'SirVer/ultisnips'
let g:snips_author="Dilawar Singh"
let g:snips_email="[email protected]"
let g:tex_conceal = "" " Otherwise keep screwing up my tex.
"let g:UltiSnipsExpandTrigger="<C-Space>"
"let g:UltiSnipsJumpForwardTrigger="<C-Space>"
"let g:UltiSnipsJumpBackwardTrigger="<C-Shift><C-Space>"
" If you want :UltiSnipsEdit to split your window.
"let g:UltiSnipsExpandTrigger="<nop>"
function ExpandSnippetOrCarriageReturn()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
else
return "\<CR>"
endif
endfunction
inoremap <expr> <CR> pumvisible() ? "<C-R>=ExpandSnippetOrCarriageReturn()<CR>" : "\<CR>"
" Python related settings
au BufNewFile,BufRead *.py set comments+=b:#\'
let g:pymode_lint_write=0
let g:pymode_lint=0
" SOURCE: https://vim.fandom.com/wiki/Insert_current_filename
:inoremap \fn <C-R>=expand("%:t")<CR>