-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
248 lines (207 loc) · 6.51 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
" Vim configuration file.
"
" Unless otherwise stated:
" Copyright (c) 2015 Francesco Montesano
" The MIT License (MIT)
" use 256 colors
set t_Co=256
" get the distro name {{{
let g:distro = system(". /etc/os-release; echo -n $NAME")
" }}}
" vim-plug settings {{{
" fetch plug.vim is does not exists
" from https://github.com/junegunn/vim-plug/wiki/faq#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.vim/plugged')
" load always
Plug 'tpope/vim-fugitive'
Plug 'ervandew/supertab'
Plug 'scrooloose/syntastic'
Plug 'szw/vim-ctrlspace'
Plug 'bling/vim-airline'
Plug 'mhinz/vim-signify'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'majutsushi/tagbar'
Plug 'Valloric/MatchTagAlways'
Plug 'ryanoasis/vim-devicons'
Plug 'EinfachToll/DidYouMean'
Plug 'flazz/vim-colorschemes'
Plug 'sk1418/HowMuch'
Plug 'hashivim/vim-vagrant'
Plug 'rust-lang/rust.vim'
" On-demand loading
" action
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
Plug 'AndrewRadev/linediff.vim', { 'on': 'Linediff' }
Plug 'godlygeek/tabular', { 'on': 'Tabularize' }
Plug 'qualiabyte/vim-colorstepper', { 'on': ['<Plug>ColorstepPrev', '<Plug>ColorstepNext'] }
" file type
Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'] }
" Plug 'Glench/Vim-Jinja2-Syntax', { 'for': ['jinja', 'html'] }
Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
Plug 'plasticboy/vim-markdown' " , { 'for': 'markdown' }
Plug 'tmhedberg/SimpylFold', { 'for': 'python' }
Plug 'davidhalter/jedi-vim', { 'for': 'python' }
Plug 'Matt-Deacalion/vim-systemd-syntax', { 'for': 'systemd' }
Plug 'vim-scripts/CountJump', { 'for': 'tex' }
Plug 'vim-latex/vim-latex', { 'for': ['tex', 'bib'] }
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'matze/vim-ini-fold', { 'for': 'cfg' }
" file name
Plug 'tmux-plugins/vim-tmux', { 'for': 'tmux'}
" never activate those
" allow to use rst with tagbar, but it's only a python file
Plug 'jszakmeister/rst2ctags', { 'for': 'nofiletype'}
" keep it for reference, but not install now
" Plug 'salsifis/vim-transpose'
" Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer' }
call plug#end()
" }}}
" general configuration options{{{
" add the line number
set number
set hidden
set cursorline
" filetype plugin indent on
" indentation
set autoindent " indent automatic
set smartindent " and smart
" syntax color
let fortran_free_source=1
syntax on
" enable spelling. In codes checks only string and comments
set spell
" set default line width
set textwidth=80
" never use tabs and set default tab to 4 spaces
set expandtab
set tabstop=4
set shiftwidth=4
set shiftround
" disable beep and flash
set vb t_vb=
" enable the ruler at the lower right corner
set ruler
" When a bracket is inserted, briefly jump to the matching one.
set showmatch
" The 'scrolloff' (scroll offset) option determines the number of context
" lines you would like to see above and below the cursor.
set scrolloff=5
" always have status line
set laststatus=2
" save file with old undos so that it is possible to go back in the history
set undofile
"}}}
" When editing a file, always jump to the last cursor position{{{
" from the docs
" http://vimdoc.sourceforge.net/htmldoc/eval.html#last-position-jump
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
"}}}
" vim-latex settings {{{
set grepprg=grep\ -nH\ --color\ $*
let g:tex_flavor='latex'
" smart indentation in latex
let g:tex_indent_items = 1
let g:tex_indent_brace = 0
"}}}
" Simply Fold plugin: enable preview {{{
let g:SimpylFold_docstring_preview = 1
"}}}
" undotree map {{{
noremap <F4> :UndotreeToggle<CR>
"}}}
" clang complete setting {{{
if g:distro ==? "Ubuntu"
let g:clang_library_path=split(expand('/usr/lib/llvm-*/lib/libclang.so*'))[-1]
elseif g:distro ==? "openSUSE"
" let g:clang_library_path='/usr/lib64'
let g:clang_complete_loaded=0
endif
let g:clang_use_library=1
let g:clang_complete_copen=1
let g:clang_hl_errors=1
let g:clang_snippets=1
"let g:clang_periodic_quickfix=1
let g:clang_close_preview=1
nnoremap <F7> :call g:ClangUpdateQuickFix() <CR>
imap <F7> <ESC> <F7>
let g:clang_jumpto_declaration_key='<leader>d'
let g:clang_jumpto_declaration_in_preview_key='<leader>dw'
" }}}
" syntastic settings {{{
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" python
let g:syntastic_python_checkers = ['flake8', 'pycodestyle', 'pyflakes', 'python', 'mypy']
" c++
let g:syntastic_cpp_compiler = 'clang++'
" html
let g:syntastic_html_checkers = ['validator']
" javascript
let g:syntastic_javascript_checkers = ['jshint']
" yaml configuration language
let g:syntastic_yaml_checkers = ['yamlxs']
" let g:syntastic_debug = 3
" sphinx
" let g:syntastic_rst_checkers = ['sphinx']
nnoremap <F7> :Errors <CR>
imap <F7> <ESC> <F7>
" }}}
" tagbar settings {{{
nnoremap <F8> :TagbarToggle<CR>
imap <F8> <ESC> <F8>
" rst2ctags settings
let g:tagbar_type_rst = {
\ 'ctagstype': 'rst',
\ 'ctagsbin' : '~/.vim/plugged/rst2ctags/rst2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '|',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0,
\ }
" }}}
" vim-airline setting {{{
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_close_button = 0
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tmuxline#enabled = 1
" }}}
" ctrlspace settings {{{
" hi link CtrlSpaceNormal Normal
" hi link CtrlSpaceSelected Visual
let g:CtrlSpaceSaveWorkspaceOnExit = 1
let g:CtrlSpaceSaveWorkspaceOnSwitch = 1
let g:CtrlSpaceLoadLastWorkspaceOnStart = 1
"}}}
" non installed {{{
" YouCompleteMe setting {{{
" let g:ycm_global_ycm_extra_conf = './plugged/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
" let g:ycm_goto_buffer_command = 'new-tab'
" let g:ycm_complete_in_comments = 1
" let g:ycm_collect_identifiers_from_comments_and_strings = 1
" noremap <leader>d :YcmCompleter GoTo<CR>
" noremap <leader>dc :YcmCompleter GoToDeclaration<CR>
" noremap <leader>df :YcmCompleter GoToDefinition<CR>
" }}}
" }}}