forked from thesharp/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
363 lines (295 loc) · 10.1 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
""" vim-plug
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 --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
Plug 'junegunn/vim-plug'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/syntastic'
Plug 'tpope/vim-fugitive'
Plug 'squarefrog/tomorrow-night.vim'
Plug 'tomtom/tcomment_vim'
Plug 'vim-python/python-syntax'
Plug 'rodjek/vim-puppet'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'ntpeters/vim-better-whitespace'
Plug 'mattn/webapi-vim'
Plug 'mattn/gist-vim'
Plug 'plasticboy/vim-markdown'
Plug 'benmills/vimux'
Plug 'elzr/vim-json'
Plug 'tpope/vim-obsession'
Plug 'pearofducks/ansible-vim'
Plug 'Raimondi/delimitMate'
Plug 'jlanzarotta/bufexplorer'
Plug 'cespare/vim-toml'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-rhubarb'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'Shougo/deoplete.nvim'
Plug 'zchee/deoplete-go', {'do': 'make'}
Plug 'mileszs/ack.vim'
Plug 'bracki/vim-prometheus'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'tpope/vim-eunuch'
Plug 'lervag/vimtex'
Plug 'tpope/vim-surround'
" Plug 'godlygeek/tabular'
""" Disabled plugins
" Plug 'ctrlpvim/ctrlp.vim'
" Plug 'tpope/vim-markdown'
" Plug 'JamshedVesuna/vim-markdown-preview'
" Plug 'davidhalter/jedi-vim'
" Plug 'chase/vim-ansible-yaml'
" Plug 'rust-lang/rust.vim'
" Plug 'fmoralesc/vim-pad'
" Plug 'Shougo/neocomplete.vim'
" Plug 'Shougo/echodoc.vim'
" Plug 'garbas/vim-snipmate', {'depends': ['MarcWeber/vim-addon-mw-utils', 'tomtom/tlib_vim']}
call plug#end()
""" General stuff
set nocompatible
filetype plugin indent on
set autoread
set backspace=indent,eol,start
set modeline
syntax on
set ruler rulerformat=%40(%<%f\ %m%=%r\ %l\ %c\ %p%%%)
set background=light
set cursorline
set regexpengine=1
set lazyredraw
set updatetime=100
set noshowmode
set clipboard=unnamed
colorscheme tomorrow-night
highlight clear SpellBad
highlight SpellBad ctermfg=009 ctermbg=011 guifg=#ff0000 guibg=#ffff00
let mapleader="\<Space>"
""" Leader bindings
nmap <silent> <Leader>o :only<CR>
nmap <silent> <Leader>q :bd<CR>
nmap <silent> <Leader>h <C-w>h
nmap <silent> <Leader>j <C-w>j
nmap <silent> <Leader>k <C-w>k
nmap <silent> <Leader>l <C-w>l
nmap <Leader>c :copen<CR>
"" Fugitive
nmap <silent> <leader>gs :Gstatus<cr>
nmap <Leader>gd :Gdiff<CR>
nmap <Leader>gl :Glog -- %<CR><CR>:copen<CR>
"" BufExplorer
nmap <silent> <leader>; :BufExplorer<cr>
"" Textmate style indentation
vmap <leader>[ <gv
vmap <leader>] >gv
nmap <leader>[ <<
nmap <leader>] >>
"" fzf
nmap <silent> <leader>f :Files<CR>
nmap <silent> <leader>b :Buffers<CR>
"" NERDTree
nmap <silent> <leader>n :NERDTreeToggle<CR>
nmap <silent> <Leader>F :NERDTreeFind<CR>
"" ack / ag
nmap <leader>a :Ack!<Space>
""" Remap arrows to quickfix-navigation
nnoremap <silent> <Up> :cprevious<CR>
nnoremap <silent> <Down> :cnext<CR>
nnoremap <silent> <Left> :cpfile<CR>
nnoremap <silent> <Right> :cnfile<CR>
""" Jump between splits with C-hjkl
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" tmux/non-tmux home/end hack
let tmux=$TMUX
if tmux != ""
set term=screen-256color
else
set term=xterm-256color
endif
set autoindent
set wildmenu
set wcm=<Tab>
menu Encoding.koi8-r :e ++enc=koi8-r<CR>
menu Encoding.windows-1251 :e ++enc=cp1251<CR>
menu Encoding.cp866 :e ++enc=cp866<CR>
menu Encoding.utf-8 :e ++enc=utf8 <CR>
map <F8> :emenu Encoding.<TAB>
set hlsearch
set incsearch
set nobackup
set title
set showcmd
set ttyfast
set splitbelow
set splitright
" clear highlighted search
noremap <silent> <Leader>s :let @/=""<cr>
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
""" Line numbers settings
map <F5> :set nonumber!<CR>:set foldcolumn=0<CR>
set number
set relativenumber
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
""" Spelling
set spelllang=en_us,ru_ru
set spellfile=$HOME/.vim/spell/ru.utf-8.add
""" Airline
set laststatus=2
let g:airline_powerline_fonts = 1
""" Python settings
" au FileType python setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4 tw=80
au FileType python setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
au FileType python set colorcolumn=80,110
au FileType python setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType python setlocal completeopt-=preview
" au FileType python map <Leader>b :w<CR>:!clear && /usr/bin/env python % <CR>
au FileType python map <Leader>b :w<CR>:call VimuxRunCommandInDir("clear && /usr/bin/env python", 1)<CR>
au FileType python map <Leader>p iimport pdb; pdb.set_trace()<ESC>
let python_highlight_all = 1
let python_highlight_space_errors = 0
" let python_slow_sync = 1
""" HTML settings
au FileType html setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
""" Markdown settings
au FileType markdown setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
autocmd FileType markdown setlocal spell
let g:vim_markdown_folding_disabled = 1
""" gitcommit
autocmd FileType gitcommit setlocal spell
""" mail
autocmd FileType mail setlocal spell
""" RST settings
au FileType rst setlocal tabstop=6 expandtab shiftwidth=3 softtabstop=3
""" JSON settings
au FileType json setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
" au FileType json map <Leader>F :%!python -m json.tool<CR>
""" Puppet settings
au FileType puppet setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
""" Ansible settings
au FileType ansible setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
au FileType yaml.ansible setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
let g:ansible_extra_keywords_highlight = 1
" let g:ansible_options = {'ignore_blank_lines': 0}
""" YAML settings
au FileType yaml setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
""" Ruby settings
au FileType ruby setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
""" XML settings
au FileType xml setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
""" VimL settings
au FileType vim setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
""" Prometheus settings
au FileType prometheus setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
""" TOML settings
au FileType toml setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
""" Go settings
au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
""" Jenkinsfile settings
au FileType Jenkinsfile setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
au FileType groovy setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
""" LaTeX settings
let g:syntastic_tex_checkers = ['chktex']
au FileType tex setlocal tabstop=4 expandtab shiftwidth=2 softtabstop=2
" let g:vimtex_fold_enabled = 1
""" GVIM settings
if has("gui_running")
set guifont=set guifont=Monaco\ for\ Powerline:h12
" autocmd VimEnter * NERDTree
endif
""" NERDtree
" let g:NERDTreeWinPos = "right"
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | wincmd p | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
let NERDTreeIgnore = ['\.pyc$', '^__pycache__$', '^\.git$', '^\.gitmodules$']
let NERDTreeShowHidden = 1
let NERDTreeMinimalUI = 0
""" Snippets
let g:snips_author = 'Ilya Otyutskiy'
let g:snips_email = '[email protected]'
""" Syntastic
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 = 1
"" Python
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_args = '--ignore="E501"'
"" Puppet
let g:syntastic_puppet_puppetlint_args = "--no-documentation-check --no-80chars-check --no-autoloader_layout-check --no-variable_scope-check --fail-on-warnings --no-140chars-check"
"" Gist
let g:gist_post_private = 1
"" JSON
let g:vim_json_syntax_conceal = 0
"" Ansible
let g:syntastic_ansible_checkers = ['ansible_lint']
"" YAML
let g:syntastic_yaml_checkers = ['pyyaml']
""" vim-pad
" let g:pad#default_format = "markdown"
" let g:pad#dir = "~/Dropbox/Notes"
""" golang
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" let g:go_auto_type_info = 1
" let g:go_auto_sameids = 1
let g:go_fmt_command = "goimports"
let g:syntastic_go_checkers = ['gometalinter']
let g:syntastic_go_gometalinter_args = "-D gosec -D gotype -D gotypex --fast -e 'Subprocess launching' -e 'composite literal uses unkeyed fields' -e 'should have a package comment' --min-confidence=0 --cyclo-over=15"
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_list_type = "quickfix"
" deoplete-go settings
let g:deoplete#sources#go#gocode_binary = $GOPATH.'/bin/gocode'
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
""" deoplete
" neocomplete like
" set completeopt+=noinsert
set completeopt-=preview
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" Path to python interpreter for neovim
let g:python3_host_prog = '/usr/local/bin/python3'
" Skip the check of neovim module
let g:python3_host_skip_check = 1
" Run deoplete.nvim automatically
let g:deoplete#enable_at_startup = 1
""" fzf
set rtp+=/usr/local/opt/fzf
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
""" ack / ag
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif