-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
executable file
·362 lines (273 loc) · 8.81 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
""" setup Vundle """
set nocompatible " be iMproved, required
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'morhetz/gruvbox'
Plugin 'flazz/vim-colorschemes'
Plugin 'chriskempson/base16-vim'
Plugin 'wlangstroth/vim-racket'
Plugin 'PotatoesMaster/i3-vim-syntax'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'nanotech/jellybeans.vim'
Plugin 'mbbill/desertEx'
Plugin 'croaker/mustang-vim'
Plugin 'vim-scripts/xoria256.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'airblade/vim-gitgutter'
Plugin 'rking/ag.vim'
Plugin 'mileszs/ack.vim'
Plugin 'junegunn/fzf.vim'
Plugin 'bkad/CamelCaseMotion'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-repeat'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'JamshedVesuna/vim-markdown-preview'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'wincent/Command-T'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdcommenter'
" python
Plugin 'python-mode/python-mode'
Plugin 'majutsushi/tagbar'
" PlantUML
Plugin 'scrooloose/vim-slumlord'
Plugin 'aklt/plantuml-syntax'
" vim table
Plugin 'dhruvasagar/vim-table-mode'
" vim drawIt
Plugin 'vim-scripts/DrawIt'
" csv "
Plugin 'chrisbra/csv.vim'
Plugin 'rust-lang/rust.vim'
" YouCompleteMe
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
call vundle#end()
filetype plugin indent on
""" key mappings """
inoremap jk <Esc>
" python environment variable
let $PYTHONPATH='/usr/lib/python3.6/site-packages'
set fileformats="unix,dox,mac"
set fileencodings="utf-8,cp1251,kio8-r,cp866"
" Enable a nice big viminfo file
set viminfo='1000,f1,:1000,/1000
set history=1000
set undolevels=1000
" Number of spaces that a <Tab> in the file counts for.
set tabstop=4
" Number of spaces to use for each step of (auto)indent.
set shiftwidth=4
" When on, a <Tab> in front of a line inserts blanks
" according to 'shiftwidth'. 'tabstop' is used in other.
set expandtab
" When on, a <Tab> in front of a line inserts blanks
" according to 'shiftwidth'. 'tabstop' is used in other
" places.
set smarttab
" toggles paste option(switch vim in paste mod).
set pastetoggle=<F2>
" Show (partial) command in status line.
set showcmd
" Highlight matching parens
set showmatch
" When there is a previous search pattern, highlight all
" its matches.
set hlsearch
" While typing a search command, show immediately where the
" so far typed pattern matches.
set incsearch
" Ignore case in search patterns.
set ignorecase
" Override the 'ignorecase' option if the search pattern
" contains upper case characters.
set smartcase
" Baskspace over everything.
set backspace=indent,eol,start
" Copy indent from current line when starting a new line
set autoindent
" C style indents.
set cindent
" lazy screen redrawing when executing scripts.
set lazyredraw
" Minimal number of screen lines to keep above and below
" the cursor.
set scrolloff=3
set nowrap
autocmd FileType text setlocal textwidth=80
" enable folds
set foldenable
" always show the status line
set laststatus=2
" Always display the tabline, even if there is only one tab
set showtabline=2
" Hide the default mode text (e.g. -- INSERT -- below the statusline)
set noshowmode
set statusline=%t%m%r%h%w\ %10{&encoding}\ %20b,0x%B\ %10l,%v\ %10p%%
" Enable alternative keyboard layout (C-^ to switch)
set keymap=russian-jcuken
"set keymap=ukrainian-jcuken
set iminsert=0
set imsearch=0
" File and path autocompletion
set path+=**
set wildignore=*.o,*.pyc,*.class,*.d,*/.git/*,*/node_modules/*,.DS_Store
set wildmenu
" Show trailing whitespaces
match ErrorMsg '\s\+$'
" Enable spell cheking for certain types of files
autocmd FileType gitcommit setlocal spell
autocmd FileType text setlocal spell
autocmd FileType plaintex setlocal spell
autocmd FileType tex setlocal spell
" autocompletion mode(list all and complete to general on first <Tab> then full completion)
set wildmode=list:longest,full
set wildmenu
" Syntax highlighting
syntax on
" filetype settings
filetype on
filetype indent on
filetype plugin on
" completion that works in macro
set wildcharm=<Tab>
menu Exec.racket :w<Cr>:!racket -u % <Cr>
map <F7> :tabp
map <F8> :tabn
map <F4> :emenu Exec.<Tab>
menu Encoding.koi8-r :e ++enc=koi8-r<CR>
menu Encoding.cp1251 :e ++enc=cp1251<CR>
menu Encoding.cp866 :e ++enc=cp866<CR>
menu Encoding.ucs-2le :e ++enc=ucs-2le<CR>
menu Encoding.utf-8 :e ++enc=utf-8<CR>
menu SetSpell.ru :set spl=ru spell<CR>
menu SetSpell.en :set spl=en spell<CR>
menu SetSpell.uk :set spl=uk spell<CR>
menu SetSpell.off :set nospell<CR>
" on/off highligh search match
map <F3> :set hlsearch! <Cr>
if !has('gui_running')
" 256 color mode
set t_Co=256
" for gruvbox colorscheme in terminal(disable when gui)
let g:gruvbox_italic=0
" disable mouse capture in terminal
set mouse=
else
" No toolbar, menu or scrollbars in the GUI
set guioptions-=m
set guioptions-=T
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
set lines=9999 columns=9999
endif
colorscheme gruvbox
set background=dark
"hi Normal guibg=NONE ctermbg=NONE
"hi NonText ctermbg=none
" make, commpiler for different systems.
if has('win32')
set makeprg=nmake
compiler msvc
else
set makeprg=make
compiler gcc
endif
" safely alias commads
fun! SetupCommandAlias(from, to)
exec 'cnoreabbrev <expr> '.a:from
\ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
\ .'? ("'.a:to.'") : ("'.a:from.'"))'
endfun
call SetupCommandAlias("W","w")
call SetupCommandAlias("Q","q")
call SetupCommandAlias("Wq","wq")
call SetupCommandAlias("WQ","wq")
""" Syntastic setup """
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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
""" vim-gutter """
set updatetime=250
""" vim-airline """
let g:airline_powerline_fonts = 1
""" ag.vim """
let g:ag_prg="/usr/bin/ag --vimgrep"
""" camelcasemotion """
map <silent> gw <Plug>CamelCaseMotion_w
map <silent> gb <Plug>CamelCaseMotion_b
map <silent> ge <Plug>CamelCaseMotion_e
omap <silent> giw <Plug>CamelCaseMotion_iw
omap <silent> gib <Plug>CamelCaseMotion_ib
omap <silent> gie <Plug>CamelCaseMotion_ie
xmap <silent> giw <Plug>CamelCaseMotion_iw
xmap <silent> gib <Plug>CamelCaseMotion_ib
xmap <silent> gie <Plug>CamelCaseMotion_ie
""" Vim Markdown """"
let g:vim_markdown_folding_disabled = 1
""" Vim Markdown Preview """
let vim_markdown_preview_github=1
let vim_markdown_preview_use_xdg_open=1
""" NERDCommenter """
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
""" NERDTree """
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
""" PlantUML """
let g:plantuml_executable_script = "/opt/plantuml/plantuml.jar"
let g:slumlord_plantuml_jar_path = "/opt/plantuml/plantuml.jar"
autocmd BufRead,BufNewFile *.puml setfiletype plantuml | set filetype=plantuml
""" Keybindings """
let mapleader = ','
" remove trailing whitespaces
nnoremap <leader>rtw :%s/\s\+$//e<CR>
" Easier keyboard mappings for keyboard layout switching
inoremap <C-Space> <C-^>
nnoremap <C-Space> a<C-^><Esc>
" insert blank lines before/after current
nmap <leader>O O<Esc>j
nmap <leader>o o<Esc>k
" split movements
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
""" YouCompleteMe
" python
let g:ycm_python_binary_path = '/usr/bin/python3'
" rust
let g:ycm_rust_src_path = '/mnt/shared/rust/rust-src/src'
let g:syntastic_rust_rustc_exe = 'cargo check'
let g:syntastic_rust_rustc_fname = ''
let g:syntastic_rust_rustc_args = '--'
let g:syntastic_rust_checkers = ['rustc']
" nnoremap <leader>gd :YcmCompleter GoToDefinitionElseDeclaration<CR>
nnoremap <leader>gd :YcmCompleter GoTo<CR>
nnoremap <leader>rr :YcmCompleter RefactorRename
nnoremap <leader>gt :YcmCompleter GetType<CR>
nnoremap <leader>gq :YcmCompleter GetDoc<CR>
""" NERDTree """
nnoremap <leader>on :NERDTreeToggle<CR>
""" TAGBar """
nmap <leader>ot :TagbarToggle<CR>