-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
414 lines (334 loc) · 11.6 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
406
407
408
409
410
411
412
413
414
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ====================
set mmp=5000
" set nonumber "Line numbers are good
set relativenumber
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom
set showmode "Show current mode down the bottom
set novisualbell "No sounds
set autoread "Reload files changed outside vim
" Try to make vim syntax highlight faster
" See: https://github.com/fatih/vim-go/issues/145
set nocursorcolumn
syntax sync minlines=256
set re=1
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
"turn on syntax highlighting
syntax on
" The mapleader has to be set before vundle starts loading all
" the plugins.
let mapleader="\<Space>"
" =============== Vundle Initialization ===============
" This loads all the plugins
" Use Vundle plugin to manage all other plugins
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Bundle 'Raimondi/delimitMate'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb'
Plugin 'w0rp/ale'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'altercation/vim-colors-solarized'
Plugin 'klen/python-mode'
Plugin 'tomasr/molokai'
Plugin 'mileszs/ack.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'edkolev/tmuxline.vim'
Plugin 'benmills/vimux'
Plugin 'ryanoasis/vim-devicons'
Plugin 'machakann/vim-sandwich'
Plugin 'fatih/vim-go'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-unimpaired'
Plugin 'kylef/apiblueprint.vim'
Plugin 'nelstrom/vim-markdown-folding'
call vundle#end() " required
"Dash
nmap <Leader>da <Plug>DashSearch
"ALE
let g:ale_sign_warning = '⚠'
let g:ale_sign_error = '✗'
let g:ale_linters = {'python': ['flake8', 'pylint'],'go': ['golint', 'go vet', 'goimports']}
let g:ale_python_pylint_executable = 'python'
let g:airline#extensions#ale#enabled = 1
"ctrlp
nnoremap <C-@> :CtrlPBuffer<CR>
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" let g:go_debug_address = 'dev.aborilov.ru:2345'
"vim-go
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <Leader>hd <Plug>(go-doc)
au FileType go nmap <Leader>re <Plug>(go-referrers)
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>e <Plug>(go-rename)
au FileType go nnoremap <leader>g :GoDef<CR>
au FileType go nmap <Leader>gt <Plug>(go-test-func)
au FileType go nmap <Leader>ge :GoIfErr<CR>
au FileType go nmap <Leader>gi <Plug>(go-install ./...)
" au FileType go nmap <Leader>rr :GoDecls<CR>
au FileType go nmap <Leader>dr :GoDeclsDir<CR>
au Filetype go nmap <leader>ga <Plug>(go-alternate-edit)
au Filetype go nmap <leader>gah <Plug>(go-alternate-split)
au Filetype go nmap <leader>gav <Plug>(go-alternate-vertical)
let g:go_fmt_command = "goimports"
let g:go_auto_type_info = 1
let g:go_doc_popup_window = 1
let g:go_rename_command = 'gopls'
set pyxversion=3
set encoding=utf-8
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
"xkbswitch
let g:XkbSwitchEnabled = 1
"vimux
" Run the current file with python
function! VimuxSlime()
call VimuxSendText(@v)
call VimuxSendKeys("Enter")
endfunction
map <Leader>rp :call VimuxRunCommand("clear; python " . bufname("%"))<CR>
map <Leader>dp :!./.deploy.sh<CR>
vmap <Leader>vs "vy :call VimuxSlime()<CR>
nmap <Leader>vs ggVG"vy :call VimuxSlime()<CR>
" nmap <Leader>vs vip<Leader>pp<CR>
" Run last command executed by VimuxRunCommand
map <Leader>vl :VimuxRunLastCommand<CR>
"airline
let g:airline_powerline_fonts = 1
"syntastic
" let g:syntastic_python_checkers = ['pyflakes', 'pep8']
" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" let g:go_list_type = "quickfix"
" Ack
nnoremap <leader>a :Ack!<space>
let g:ackprg = 'ack --ignore-dir=vendor --smart-case --nogroup --nocolor --column'
"vim-indent-guides
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_guide_size=1
let g:indent_guides_start_level=2
"pymode
let g:pymode = 0
let g:pymode_run = 1
let g:pymode_rope = 1
let g:pymode_rope_completion = 0
let g:pymode_rope_complete_on_dot = 0
let g:pymode_lint = 0
let g:pymode_lint_checkers = ["pylint"]
let g:pymode_lint_on_write = 1
let g:pymode_folding = 0
let g:pymode_syntax = 0
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
let g:pymode_lint_ignore="C0111"
nnoremap <leader>lf :PymodeLintAuto<CR>
nnoremap <leader>lc :PymodeLint<CR>
"YouCompleteMe
set completeopt-=preview
" set completeopt+=preview
" set omnifunc=syntaxcomplete#Complete
" nnoremap <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
" let g:ycm_server_python_interpreter = '/usr/local/bin/python3'
"NerdTree
let g:NERDTreeQuitOnOpen=1
map <C-k><C-b> :NERDTreeToggle<CR>
"TagList
let g:Tlist_Close_On_Select = 1
let g:Tlist_GainFocus_On_ToggleOpen = 1
let g:Tlist_File_Fold_Auto_Close = 1
nnoremap <leader>t :TlistToggle<CR>
set tags+=./tags;/
"NerdCommenter
let g:NERDSpaceDelims=1
let g:NERDDefaultAlign = 'left'
let g:NERDCommentEmptyLines = 1
let NERDTreeIgnore = ['__pycache__', '.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', 'whoosh_index',
\ 'xapian_index', '.*.pid', 'monitor.py', '.*-fixtures-.*.json',
\ '.*\.o$', 'db.db', 'tags.bak', '.*\.pdf$', '.*\.mid$',
\ '.*\.midi$']
"DelimitMate
imap <C-K> <Plug>delimitMateS-Tab
" ================ Turn Off Swap Files ==============
set noswapfile
set nobackup
set nowb
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" ================ Indentation ======================
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
filetype plugin on
filetype indent on
" Display tabs and trailing spaces visually
set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮
set showbreak=↪
" From Steve Losh
" ===========================================
" Save when losing focus
au FocusLost * :silent! wall
" Resize splits when the window is resized
au VimResized * :wincmd =
" Only show cursorline in the current window and in normal mode.
augroup cline
au!
au WinLeave,InsertEnter * set nocursorline
au WinEnter,InsertLeave * set cursorline
augroup END
" Trailing whitespace {{{
" Only shown when not in insert mode so I don't go insane.
augroup trailing
au!
au InsertEnter * :set listchars-=trail:⌴
au InsertLeave * :set listchars+=trail:⌴
augroup END
" Make sure Vim returns to the same line when you reopen a file.
" Thanks, Amit
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" Wrap
nnoremap <leader>W :set wrap!<cr>
" Toggle line numbers
nnoremap <leader>n :setlocal number!<cr>
" Clean trailing whitespace
nnoremap <leader>ww mz:%s/\s\+$//<cr>:let @/=''<cr>`z
" Diffoff
nnoremap <leader>D :diffoff!<cr>
" Keep the cursor in place while joining lines
nnoremap J mzJ`z
" Split line (sister to [J]oin lines)
" The normal use of S is covered by cc, so don't worry about shadowing it.
nnoremap S i<cr><esc>^mwgk:silent! s/\v +$//<cr>:noh<cr>`w
" Sudo to write
cnoremap w!! w !sudo tee % >/dev/null
" Unfuck my screen
nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
" Use sane regexes.
nnoremap / /\v
vnoremap / /\v
" Don't move on *
nnoremap * *<c-o>
" Keep search matches in the middle of the window.
nnoremap n nzzzv
nnoremap N Nzzzv
" Same when jumping around
nnoremap g; g;zz
nnoremap g, g,zz
nnoremap <c-o> <c-o>zz
noremap <leader>v <C-w>v
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
" ================ Folds ============================
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
" ================ Completion =======================
set wildmode=list:longest
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore+=.hg,.git,.svn " Version control
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set wildignore+=*.spl " compiled spelling word lists
set wildignore+=*.sw? " Vim swap files
set wildignore+=migrations " Django migrations
set wildignore+=*.pyc " Python byte code
set wildignore+=*.orig " Merge resolution files
set wildignore+=log/**
set wildignore+=tmp/**
" ================ Scrolling ========================
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
set incsearch " Find as you type search
set hlsearch " Highlight search terms
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
" ================ Others ========================
" set colorcolumn=79
let loaded_matchparen = 0
set showtabline=0
set ruler
set title
" set matchpairs+=<:>
set laststatus=2
set showmatch
set matchtime=2
set esckeys
set magic
set cursorline
set guifont=Inconsolata\ LGC\ for\ Powerline\ Plus\ Nerd\ File\ Types\ Mono:h14
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
" set t_Co=256
" let g:solarized_termcolors=256
set background=dark
try
colorscheme solarized
catch
colorscheme default
endtry
hi Cursor guibg=Green
vnoremap < <gv
vnoremap > >gv
" Press Space to turn off highlighting and clear any message already displayed.
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
map <C-q> :bd<CR>
nnoremap <leader>st :Gstatus<CR>
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
nnoremap <leader>w :w<CR>
nnoremap Q <nop>
" Acts in command line line in bash
:cnoremap <C-a> <Home>
:cnoremap <C-b> <Left>
:cnoremap <C-f> <Right>
:cnoremap <C-d> <Delete>
set timeoutlen=250
" Only show linenumber in the current window
augroup nline
au!
au WinLeave * set nonumber | set norelativenumber
au WinEnter * set number | set relativenumber
augroup END
au FileType yaml setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
au FileType yml setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
" autocmd FileType *
" \if &omnifunc != '' |
" \call SuperTabChain(&omnifunc, "<c-p>") |
" \call SuperTabSetDefaultCompletionType("<c-x><c-u>") |
" \endif