-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
366 lines (306 loc) · 9.42 KB
/
init.vim
File metadata and controls
366 lines (306 loc) · 9.42 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
call plug#begin('~/.vim/plugged')
" Initialize plugin system
Plug 'junegunn/vim-easy-align'
" Ctrl-P
Plug 'kien/ctrlp.vim'
" BufExplorer
Plug 'jlanzarotta/bufexplorer'
" Golang
Plug 'fatih/vim-go'
Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
Plug 'nsf/gocode', { 'rtp': 'nvim', 'do': '~/.config/nvim/plugged/gocode/nvim/symlink.sh' }
" Neomake
Plug 'neomake/neomake'
" YCompleteMe
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
" Autopair
Plug 'jiangmiao/auto-pairs'
" Scala
Plug 'derekwyatt/vim-scala'
Plug 'ensime/ensime-vim', { 'do': ':UpdateRemotePlugins' }
"Syntastic
Plug 'vim-syntastic/syntastic'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Ag the_silver_searcher
Plug 'Numkil/ag.nvim'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" Git wrapper for vim
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'jreybert/vimagit'
" Projectile analog.
Plug 'joonty/vim-sauce'
" Surrounds char/word/sentence by tag/symbols/parantheses
Plug 'tpope/vim-surround'
" Deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
"PHP
Plug 'padawan-php/deoplete-padawan', { 'do': 'composer install' }
Plug 'evidens/vim-twig'
Plug 'vim-scripts/smarty-syntax'
Plug 'qbbr/vim-symfony'
Plug 'udalov/kotlin-vim'
" Indent guidelines
Plug 'Yggdroot/indentLine'
" Airline
"Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes'
Plug 'dracula/vim'
" Emmet!
Plug 'mattn/emmet-vim'
" Colorschemes
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'rakr/vim-one'
Plug 'nanotech/jellybeans.vim'
"NERDComennter
Plug 'scrooloose/nerdcommenter'
" Ruby
Plug 'tpope/vim-rake'
Plug 'tpope/vim-rails'
call plug#end()
nmap <C-F5> <Esc>:BufExplorer<cr>
vmap <C-F5> <esc>:BufExplorer<cr>
imap <C-F5> <esc>:BufExplorer<cr>
" F6 - предыдущий буфер
nmap <C-F6> :bp<cr>
vmap <C-F6> <esc>:bp<cr>i
imap <C-F6> <esc>:bp<cr>i
" F7 - следующий буфер
nmap <C-F7> :bn<cr>
vmap <C-F7> <esc>:bn<cr>i
imap <C-F7> <esc>:bn<cr>i
" Disable Arrow keys. Don't even think about them
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" UI
if $TERM == "xterm-256 color"
set t_Co=256
endif
set background=dark
syntax on
color jellybeans
set expandtab
set termguicolors
set number relativenumber
set t_ut=
set tabstop=4
set shiftwidth=4
set nojoinspaces
set colorcolumn=120
set cursorline
set showcmd
set backspace=indent,eol,start
set hidden
set title "Coding Session :)"
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set autoread
let g:indentLine_color_term = 239
" When writing a buffer.
call neomake#configure#automake('w')
" When writing a buffer, and on normal mode changes (after 750ms).
call neomake#configure#automake('nw', 750)
" When reading a buffer (after 1s), and when writing.
call neomake#configure#automake('rw', 1000)
let g:deoplete#enable_at_startup = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$|(certificate_storage|node_modules|bower|vendor|cache)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
" Golang
au FileType go set noexpandtab
au FileType go set shiftwidth=4
au FileType go set softtabstop=4
au FileType go set tabstop=4
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_auto_sameids = 1
let g:go_fmt_command = "goimports"
let g:go_auto_type_info = 1
" Error and warning signs.
let g:ale_sign_error = '⤫'
let g:ale_sign_warning = '⚠'
au FileType go nmap <leader>gt :GoDeclsDir<cr>
" GoTest
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)
au FileType go nmap <F10> :GoTest -short<cr>
au FileType go nmap <F9> :GoCoverageToggle -short<cr>
au FileType go nmap <F12> <Plug>(go-def)
" Disable deoplete when in multi cursor mode
function! Multiple_cursors_before()
let b:deoplete_disable_auto_complete = 1
endfunction
function! Multiple_cursors_after()
let b:deoplete_disable_auto_complete = 0
endfunction
let g:go_addtags_transform = "snakecase"
let g:go_snippet_engine = "neosnippet"
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
" Error and warning signs.
call deoplete#custom#set('go', 'rank', 9999)
" ========================================= Leader
let mapleader="\<SPACE>"
nnoremap <Leader>o :CtrlP<CR>
nnoremap <Leader>ob :CtrlPBuffer
" nnoremap <Leader><Space> :CtrlSpace<CR>
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Common development keys
nmap <Leader>dm :!make<CR>
" Git
nmap <Leader>gb :Gblame<CR>
nmap <Leader>gc :Gcommit<CR>
nmap <Leader>gm :Magit<CR>
" Ctags
nmap <Leader>ct :!ctags -R<CR>
" Ruby TODO: Add Ruby Leader binding
:autocmd Filetype ruby set softtabstop=2
:autocmd Filetype ruby set sw=2
:autocmd Filetype ruby set ts=2
" Buffers
nnoremap <C-n> :bnext<CR>
nnoremap <C-p> :bprevious<CR>
nmap <Leader>bb :BufExplorer<CR>
nmap <Leader><Tab> :bnext<CR>
nmap <Leader>bd :bd<CR>
nmap <Leader>bk :bnext<CR>
nmap <Leader>bj :bprevious<CR>
" JavaScript
au FileType js set tabstop=2
au FileType js set shiftwidth=2
" Scala
autocmd BufWritePost *.scala silent :EnTypeCheck
nnoremap <Leader>t :EnType<CR>
au FileType scala nnoremap <Leader>df :EnDeclaration<CR>
set ignorecase " Make searching case insensitive
set smartcase " ... unless the query has capital letters.
set gdefault " Use 'g' flag by default with :s/foo/bar/.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
endif
" Search and Replace
nmap <Leader>s :%s//g<Left><Left>
" Relative numbering
function! NumberToggle()
if(&relativenumber == 1)
set nornu
set number
else
set rnu
endif
endfunc
set rnu
nnorema ; :
nnoremap Q @q
" StatusLine
let g:currentmode={
\ 'n' : 'N ',
\ 'no' : 'N·Operator Pending ',
\ 'v' : 'V ',
\ 'V' : 'V·Line ',
\ '' : 'V·Block ',
\ 's' : 'Select ',
\ 'S' : 'S·Line ',
\ '' : 'S·Block ',
\ 'i' : 'I ',
\ 'R' : 'R ',
\ 'Rv' : 'V·Replace ',
\ 'c' : 'Command ',
\ 'cv' : 'Vim Ex ',
\ 'ce' : 'Ex ',
\ 'r' : 'Prompt ',
\ 'rm' : 'More ',
\ 'r?' : 'Confirm ',
\ '!' : 'Shell ',
\ 't' : 'Terminal '
\}
highlight User1 cterm=None gui=None ctermfg=007 guifg=fgcolor
highlight User2 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User3 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User4 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User5 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User7 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User8 cterm=None gui=None ctermfg=008 guifg=bgcolor
highlight User9 cterm=None gui=None ctermfg=007 guifg=fgcolor
" Automatically change the statusline color depending on mode
function! ChangeStatuslineColor()
if (mode() =~# '\v(n|no)')
exe 'hi! StatusLine ctermfg=008 guifg=fgcolor gui=None cterm=None'
elseif (mode() =~# '\v(v|V)' || g:currentmode[mode()] ==# 'V·Block' || get(g:currentmode, mode(), '') ==# 't')
exe 'hi! StatusLine ctermfg=005 guifg=#00ff00 gui=None cterm=None'
elseif (mode() ==# 'i')
exe 'hi! StatusLine ctermfg=004 guifg=#6CBCE8 gui=None cterm=None'
else
exe 'hi! StatusLine ctermfg=006 guifg=orange gui=None cterm=None'
endif
return ''
endfunction
" Find out current buffer's size and output it.
function! FileSize()
let bytes = getfsize(expand('%:p'))
if (bytes >= 1024)
let kbytes = bytes / 1024
endif
if (exists('kbytes') && kbytes >= 1000)
let mbytes = kbytes / 1000
endif
if bytes <= 0
return '0'
endif
if (exists('mbytes'))
return mbytes . 'MB '
elseif (exists('kbytes'))
return kbytes . 'KB '
else
return bytes . 'B '
endif
endfunction
function! ReadOnly()
if &readonly || !&modifiable
return ''
else
return ''
endfunction
function! GitInfo()
let git = fugitive#head()
if git != ''
return ' '.fugitive#head()
else
return ''
endfunction
" http://stackoverflow.com/a/10416234/213124
set laststatus=2
set statusline=
set statusline+=%{ChangeStatuslineColor()} " Changing the statusline color
set statusline+=%0*\ %{toupper(g:currentmode[mode()])} " Current mode
set statusline+=%8*\ [%n] " buffernr
set statusline+=%8*\ %{GitInfo()} " Git Branch name
set statusline+=%8*\ %<%F\ %{ReadOnly()}\ %m\ %w\ " File+path
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()} " Syntastic errors
set statusline+=%*
set statusline+=%9*\ %= " Space
set statusline+=%8*\ %y\ " FileType
set statusline+=%7*\ %{(&fenc!=''?&fenc:&enc)}\[%{&ff}]\ " Encoding & Fileformat
set statusline+=%8*\ %-3(%{FileSize()}%) " File size
set statusline+=%0*\ %3p%%\ \ %l:\ %3c\ " Rownumber/total (%)