-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
executable file
·453 lines (342 loc) · 12.9 KB
/
.vimrc
File metadata and controls
executable file
·453 lines (342 loc) · 12.9 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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
scriptencoding utf-8
set nocompatible
" Install vim-plug if not already installed
if has("user_commands")
let vim_plug_source_file=expand('~/.vim/autoload/plug.vim')
if !filereadable(vim_plug_source_file)
echo "Installing vim-plug plugin manager..."
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
endif
syntax on " enable syntax-highlighting
" GUI and Terminal VIM options {{{
if has("gui_running")
" Disable all GUI elements and enable console based dialogs for simple queries
set guioptions=gc
" Default font for GUI Vim
set guifont=DroidSansMonoForPowerlinePlusNerdFileTypesPlusPomicons:h13
else
set t_Co=256
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
set t_ut=
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
endif
" }}}
" Mouse {{{
if has('mouse')
set mouse=a " Enable mouse support
set mousemodel=popup " Use the mouse for copy/paste with popup in gui vim
set mousehide " Hide cursor while typing
if exists("$TMUX")
if has('nvim')
else
" Tmux knows the extended mouse mode
set ttymouse=xterm2
endif
endif
endif
" }}}
" Multibyte {{{
if has('multi_byte')
set listchars=trail:·,tab:»·,eol:¶,extends:→,precedes:←,nbsp:×
" Vertical split chars
set fillchars=stl:\ ,stlnc:\ ,vert:│
if has("linebreak")
let &sbr = nr2char(8618).' ' " Show ↪ at the beginning of wrapped lines
endif
endif
" }}}
" Autocmd {{{
if has("autocmd")
" Enable file type detection.
filetype plugin indent on
" Python indentation
" About nosmartindent please look this link
" http://stackoverflow.com/questions/2063175/vim-insert-mode-comments-go-to-start-of-line
au FileType python setl nosmartindent tw=79 wrap linebreak nolist
" JavaScript indentation
au FileType javascript setlocal expandtab shiftwidth=2 tabstop=2
au FileType vim setlocal expandtab shiftwidth=2 tabstop=2
" Remember cursor position
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
" }}}
" Use ag over grep {{{
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
endif
" }}}
" Store undofile in to fixed location {{{
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
" This is only present in 7.3+
set undofile
" Store undo files in to fixed location
set undodir=/var/tmp//,/tmp//,.
endif
" }}}
" Store swap files in to fixed location
set noswapfile
set directory=/var/tmp//,/tmp//,.
" Store backup files in to fixed location
set nobackup
set backupdir=/var/tmp//,/tmp//,.
" This will set your path variable to current directory
" (from which you launched vim) and to all directories
" under current directory recursively.
set path=.,,**
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
" Disable timeout for Esc key
set ttimeout ttimeoutlen=0 notimeout
set ttyfast " Optimize for fast terminal connections
set lazyredraw " Don't redraw while executing macros (good performance config)
" Autocomplete options:
" longest: do not select the first candidate
" preview: removed includes display of documentation
set completeopt=menuone,longest
set confirm " Get a dialog when :q, :w, or :wq fails
let mapleader = "," " Map leader
let maplocalleader = "_" " Local leader
set hlsearch " Highlight search terms (very useful!)
set incsearch " Show search matches while typing
set display+=lastline " Display lastline instead of @
set laststatus=2 " Enable statusline
set magic " For regular expressions turn magic on
set ignorecase " Searches are Non Case-sensitive
set smartcase " Do smart case matching when searching
set showcmd " Show incomplete cmds down the bottom
set title " Show title
set acd " Vim will change the current working directory whenever you open a file
set autoread " Reload files changed outside automatically
" Use space instead of tab
set tabstop=4 shiftwidth=4 expandtab
set backspace=2 " Make backspace work like most other apps
set smarttab " Be smart when using tabs
set autoindent " Enable auto indent
set smartindent " Smart indent
set wrap " Enable word wrap
set noerrorbells visualbell t_vb= " No annoying sound on errors
set encoding=utf8 " Default encoding
set termencoding=utf-8 " Terminal encoding
set fileencodings=utf8,cp1251 " Supported file encodings
set number " Enable line numbers
set ruler " Always display cursor position
set hidden " A buffer becomes hidden when it is abandoned
set noautochdir " Change the current working directory whenever you open a file
set wildmenu " Turn on the Wild menu
set wildmode=list:longest,list:full " Wildmenu configuration
set wildignore+=*.o,*.pyc,*.jpg,*.png,*.gif,*.db,*.obj,.git " Ignore compiled files
set conceallevel=2 " Conceal level
set modelines=1 " Make Vim only use folding settings for current file
call plug#begin('~/.vim/plugged')
" Lean & mean status/tabline for vim that's light as air
Plug 'bling/vim-airline'
" Airline themes moved to separate repo
Plug 'vim-airline/vim-airline-themes'
" Plug to toggle, display and navigate marks
Plug 'kshenoy/vim-signature'
" Icons support
" Adds font icons (glyphs ★♨☢) to programming languages,
" libraries, and web developer filetypes for:
" NERDTree, vim-airline, ctrlp, unite, lightline.vim, vimfiler, and flagship
Plug 'ryanoasis/vim-devicons'
" An extensible & universal comment vim-plugin that also handles embedded
" filetypes
Plug 'tomtom/tcomment_vim'
" Syntax checking hacks for vim
Plug 'scrooloose/syntastic'
" Plug which shows a git diff in the gutter (sign column)
" and stages/reverts hunks.
Plug 'airblade/vim-gitgutter'
" a Git wrapper so awesome, it should be illegal
Plug 'tpope/vim-fugitive'
" Jedi for comfortable development with python
" TODO: jedi 0.9.0 library has issue with imports
" I'll fix this issue by using stable jedi version (0.8.1):
Plug 'davidhalter/jedi-vim'
" A nicer Python indentation style for vim.
Plug 'hynek/vim-python-pep8-indent'
" Color scheme
Plug 'jonathanfilip/vim-lucius'
" Javascript indenter (HTML indent is included)
Plug 'lukaszb/vim-web-indent'
" Aliev scripts collection for comfortable work (Bclose with confirm)
Plug 'aliev/vim-comfortable'
" A tree explorer plugin for vim.
Plug 'scrooloose/nerdtree'
" A command-line fuzzy finder written in Go
Plug 'junegunn/fzf', {'do': 'yes \| ./install'}
Plug 'junegunn/fzf.vim'
" Plug to display the indention levels with thin vertical lines
Plug 'Yggdroot/indentLine'
" True Sublime Text style multiple selections for Vim
Plug 'terryma/vim-multiple-cursors'
" Improved incremental searching for Vim
Plug 'haya14busa/incsearch.vim'
"Buffer bye (:Bdelete)
"Plugin 'moll/vim-bbye'
" Vim to REPL
Plug 'jpalardy/vim-slime'
" Vim and tmux integration
Plug 'christoomey/vim-tmux-navigator'
" Autoclose strings
Plug 'tpope/vim-surround'
" Jinja2 syntax
Plug 'Glench/Vim-Jinja2-Syntax'
" Autoclose pair symbols
Plug 'Raimondi/delimitMate'
" Autoformatters for my shiny new code
" for puthon need to install pip install autopep8
Plug 'Chiel92/vim-autoformat'
" Support snippets engine and library
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Allows you to use <Tab> for all your insert completion needs
Plug 'ervandew/supertab'
call plug#end()
" | Fugitive.vim | {{{
set diffopt+=vertical
" }}}
" | vim-airline | {{{
let g:airline_powerline_fonts = 1 " Use airline fonts
" If you want to auto-completion to work stable in older vim, disable this option
let g:airline#extensions#tabline#enabled = 1
" Airline tabline settings
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_section_c = '%t'
" }}}
" | jedi-vim | {{{
let g:jedi#popup_on_dot = 1
let g:jedi#show_call_signatures = 2
let g:jedi#use_tabs_not_buffers = 0
" let g:jedi#smart_auto_mappings = 0
" }}}
" | indentLine | {{{
" Make indent line faster
let g:indentLine_faster=1
" IndentLine character For use this feature please install patched font from repository root
let g:indentLine_char= '│'
" }}}
" | vim-devicons | {{{
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
" }}}
" | syntastic | {{{
" Syntax check mode for python (pip install pylama)
let g:syntastic_python_checkers = ['flake8', 'pylint']
" Syntax check mode for javascript (npm install jslint)
let g:syntastic_javascript_checkers = ['jslint']
" Make syntastic auto update the location list and make it also check
" when the file opens
let g:syntastic_always_populate_loc_list=1
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=0
" }}}
" | nerdtree | leader+e, leader+E{{{
let NERDTreeMinimalUI = 1
let NERDTreeIgnore = ['\.pyc$']
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd FileType nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('gitignore', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('bashrc', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('bashprofile', 'Gray', 'none', '#686868', '#151515')
nnoremap <silent> <Leader>e :NERDTreeToggle<CR>
nnoremap <silent> <Leader>E :NERDTreeFind<CR>
" }}}
" | ultisnips | {{{
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger='<tab>'
let g:UltiSnipsJumpBackwardTrigger='<s-tab>'
" }}}
" | incsearch.vim | / ? g/ n N * # g* g# | {{{
let g:incsearch#auto_nohlsearch = 1
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" }}}
" | vim-gitgutter | {{{
let g:gitgutter_max_signs=10000
" | Goto file with line number under cursor | gf | {{{
nnoremap gf gF
" }}}
" | Function keys toggles | {{{
map <F7> :setlocal spell! spelllang=en_us,ru_ru<CR>
set pastetoggle=<F2>
" }}}
" | Paste multiple lines | y, p | {{{
vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]
" }}}
" | List toggle | leader+l | {{{
nnoremap <silent> <Leader>l :set list!<CR>
" }}}
" | Close the current buffer and move to the previous one | leader+w | {{{
nnoremap <silent> <leader>w :bp <BAR> bd #<CR>}}}"
" }}}
" | Quickly jump by declarations list | :BTags |{{{
nnoremap <silent> <Leader>s :BTags<CR>
" }}}
" | Buffer list | leader+b | {{{
nnoremap <silent> <Leader>b :Buffers<CR>
" }}}
" | Open files in splits | leader+f, leader+v | {{{
nnoremap <silent> <Leader>f :Files<CR>
" }}}
" | Search word under cursor by using Ag | leader + a | {{{
noremap <silent><Leader>a :Ag <C-R>=expand("<cword>")<CR><CR>
" }}}
" | Color options | {{{
set background=dark
try
colors lucius
catch /^Vim\%((\a\+)\)\=:E185/
endtry
" Disable colors for folding column
hi FoldColumn ctermbg=NONE guibg=NONE
" Sign colors
hi! link SignColumn FoldColumn
" Disable background and foreground for vertical split
hi vertsplit ctermbg=NONE guibg=NONE
hi! link Folded ColorColumn
hi! link Error SpellBad
" }}}
" | Vim-slime | {{{
let g:slime_target = "tmux"
let g:slime_python_ipython = 1
" }}}
set noshowmode " Suppress mode change messages
" vim:foldmethod=marker:foldlevel=0
" set foldmethod=indent " Folding method by default
" set foldlevel=3 " Folding level
" vim:foldmethod=marker:foldlevel=0:tabstop=2:shiftwidth=2