-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
356 lines (301 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
" { Plugins
call plug#begin('~/.vim/plugged')
" General
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'janko-m/vim-test'
Plug 'w0rp/ale'
" Search and navigation
Plug 'dyng/ctrlsf.vim'
Plug 'jlanzarotta/bufexplorer'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'jasoncodes/ctrlp-modified.vim'
Plug 'scrooloose/nerdtree'
Plug 'ruanyl/vim-gh-line'
" Autocomplete
Plug 'jiangmiao/auto-pairs'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neocomplete'
Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets'
" Advanced
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ConradIrwin/vim-bracketed-paste'
Plug 'airblade/vim-gitgutter'
Plug 'kassio/neoterm'
Plug 'majutsushi/tagbar'
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
" Plug 'Valloric/MatchTagAlways'
Plug 'terryma/vim-multiple-cursors'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'kana/vim-textobj-user'
Plug 'powerman/vim-plugin-AnsiEsc'
Plug 'inkarkat/vim-ingo-library'
Plug 'inkarkat/vim-SyntaxRange'
" Tools integration
Plug 'hashivim/vim-vagrant'
Plug 'wfleming/vim-codeclimate'
Plug 'rizzatti/dash.vim'
" Languages support
Plug 'chase/vim-ansible-yaml'
Plug 'kchmck/vim-coffee-script'
Plug 'othree/html5.vim'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-markdown'
Plug 'slim-template/vim-slim'
Plug 'tmux-plugins/vim-tmux'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'lmeijvogel/vim-yaml-helper'
Plug 'kylef/apiblueprint.vim'
Plug 'IN3D/vim-raml'
Plug 'fidian/hexmode'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'jvirtanen/vim-hcl'
" C/C++
Plug 'rhysd/vim-clang-format'
" Clojure
Plug 'guns/vim-clojure-highlight'
Plug 'guns/vim-clojure-static'
Plug 'guns/vim-slamhound'
Plug 'tpope/vim-classpath'
Plug 'tpope/vim-fireplace'
Plug 'tpope/vim-salve'
Plug 'venantius/vim-eastwood'
Plug 'venantius/vim-cljfmt'
Plug 'vim-scripts/paredit.vim'
" Elixir
Plug 'elixir-lang/vim-elixir'
Plug 'thinca/vim-ref'
Plug 'awetzel/elixir.nvim', { 'do': 'yes \| ./install.sh' }
Plug 'slashmili/alchemist.vim'
Plug 'c-brenn/phoenix.vim'
" " Erlang
" Plug 'vim-erlang/vim-erlang-runtime'
" Plug 'vim-erlang/vim-erlang-compiler'
" Plug 'vim-erlang/vim-erlang-omnicomplete'
" Plug 'vim-erlang/vim-erlang-tags'
" Haskell
Plug 'eagletmt/ghcmod-vim'
Plug 'eagletmt/neco-ghc'
Plug 'mpickering/hlint-refactor-vim'
Plug 'neovimhaskell/haskell-vim'
Plug 'twinside/vim-hoogle'
" JavaScript
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'mtscout6/vim-cjsx'
Plug 'flowtype/vim-flow'
Plug 'moll/vim-node'
" Ruby, Rails
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
Plug 'sunaku/vim-ruby-minitest'
Plug 'thoughtbot/vim-rspec'
Plug 'tpope/vim-rvm'
Plug 'p0deje/vim-ruby-interpolation'
" Themes
Plug 'nanotech/jellybeans.vim'
call plug#end()
" { Plugin configuration
let mapleader=","
" { Alchemist (Elixir)
let g:alchemist_iex_term_size = 15
let g:alchemist_iex_term_split = 'split'
let g:alchemist_tag_disable = 1
let g:elixir_autobuild = 1
let g:elixir_docpreview = 1
" }
" { BufExplorer
let g:bufExplorerShowRelativePath=1
" }
" { CtrlP
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
endif
" }
" { CtrlSF
nmap <C-F>f <Plug>CtrlSFPrompt
vmap <C-F>f <Plug>CtrlSFVwordPath
vmap <C-F>F <Plug>CtrlSFVwordExec
nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
nnoremap <C-F>o :CtrlSFOpen<CR>
nnoremap <C-F>t :CtrlSFToggle<CR>
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>
" }
" { Fireplace (Clojure)
nmap <Leader>r :RunTests<CR>
autocmd User FireplacePreConnect call fireplace#register_port_file(expand('./nrepl-port'), '/')
" }
" { Ghc-mod (Haskell)
hi ghcmodType ctermbg=yellow
let g:ghcmod_type_highlight = 'ghcmodType'
" }
" { Haskell-vim
let g:haskellmode_completion_ghc = 0
" }
" { Jellybeans
colorscheme jellybeans
let g:jellybeans_use_term_background_color = 1
" }
" { Vim-jsx
let g:jsx_ext_required = 0
" }
" { Vim-markdown
let g:markdown_fenced_languages = ['clojure', 'ruby']
" }
" { Ale
let g:ale_echo_msg_format = '[%linter%] [%severity%] %s'
let g:ale_linters = {
\ 'ruby': ['ruby', 'rubocop', 'reek', 'flog'],
\}
let g:ale_set_highlights = 0
" }
" " { Neomake
" let g:neomake_elixir_enabled_makers = ['credo', 'mix']
" let g:neomake_javascript_enabled_makers = ['eslint', 'flow']
" let g:neomake_ruby_enabled_makers = ['mri', 'rubocop', 'reek', 'brakeman']
" " }
" { Neoterm
let g:neoterm_automap_keys = ',tt'
let g:neoterm_use_relative_path = 1
let g:neoterm_shell = 'bash -login'
nnoremap <silent> ,tc :call neoterm#kill()<cr>
nnoremap <silent> ,th :call neoterm#close()<cr>
nnoremap <silent> ,tl :call neoterm#clear()<cr>
nnoremap <silent> <f10> :TREPLSendFile<cr>
nnoremap <silent> <f9> :TREPLSend<cr>
vnoremap <silent> <f9> :TREPLSend<cr>
" }
" { NERDTree
let NERDTreeIgnore = ['\.pyc$']
nmap <C-\> :NERDTreeFind<CR>
nmap <silent> <leader><leader> :NERDTreeToggle<CR>
" }
" { Vim-test
let test#strategy = "neovim"
nmap <silent> <leader>rt :TestSuite<CR>
nmap <silent> <leader>rf :TestFile<CR>
nmap <silent> <leader>rn :TestNearest<CR>
nmap <silent> <leader>rr :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
" }
" }
" }
" { General options
set cb=unnamedplus
set completefunc=syntaxcomplete#Complete
set cursorline
set diffopt+=vertical
set expandtab
set hidden
set hlsearch
set ignorecase
set lazyredraw
set nobackup
set nocursorline
set noswapfile
set nowb
set nowrap
set number
set pastetoggle=<F2>
set shiftwidth=4
set smartcase
set splitbelow
set splitright
set tabstop=4
" }
" ================ 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
" ==================== KeyMap ========================
nmap <F8> :TagbarToggle<CR>
nnoremap <F5> :UndotreeToggle<cr>
nmap <silent> <leader>d <Plug>DashSearch
" Map ctrl-movement keys to window switching
map <C-k> <C-w><Up>
map <C-j> <C-w><Down>
map <C-l> <C-w><Right>
map <C-h> <C-w><Left>
nnoremap <silent> <bs> <C-w><Left>
" upper/lower word
nmap <leader>u mQviwU`Q
nmap <leader>l mQviwu`Q
nmap <silent> // :nohlsearch<CR>
noremap ,h1 :set hlsearch! hlsearch?<CR>
" set text wrapping toggles
nmap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
" ctrlp git modified
map <Leader>m :CtrlPModified<CR>
map <Leader>M :CtrlPBranch<CR>
" Allows you to enter sudo pass and save the file
" when you forgot to open your file with sudo
cmap w!! %!sudo tee > /dev/null null%
" Allow to copy/paste between VIM instances
" copy the current visual selection to ~/.vbuf
vmap <Leader>y :w! ~/.vbuf<CR>
" copy the current line to the buffer file if no visual selection
nmap <Leader>y :.w! ~/.vbuf<CR>
" paste the contents of the buffer file
nmap <Leader>p :r ~/.vbuf<CR>
augroup au_common
au!
" Automatically removing all trailing whitespace
au BufWritePre * :%s/\s\+$//e
au BufRead,BufNewFile {Capfile,Gemfile,Guardfile,Vagrantfile,*.prawn} set ft=ruby
au BufRead,BufNewFile {.babelrc,.eslintrc} set ft=json
augroup END
augroup ft_gitcommit
au!
au FileType gitcommit setlocal spell spelllang=en_us
augroup END
augroup ft_haskell
au!
au BufWritePost *.hs GhcModCheckAndLintAsync
au FileType haskell setlocal makeprg=stack
au FileType haskell setlocal omnifunc=necoghc#omnifunc
au FileType haskell nnoremap <silent><buffer> gfs :GhcModSplitFunCase<CR>
au FileType haskell nnoremap <silent><buffer> git :GhcModTypeInsert<CR>
au FileType haskell nnoremap <silent><buffer> gtt :GhcModType<CR>
au FileType haskell nnoremap <silent><buffer> gct :GhcModTypeClear<CR>
augroup END
augroup ft_markdown
au!
au FileType markdown setlocal spell spelllang=ru_ru,en_us
au FileType markdown setlocal wrap
augroup END
augroup ft_ruby
au FileType ruby call SyntaxRange#IncludeEx('keepend start="\%(<<[-\~]SQL\>.*\n\)\@<=" end="SQL" containedin=ALL', 'sql')
augroup END
augroup set_omnifunc
au!
au FileType css setlocal omnifunc=csscomplete#CompleteCSS
au FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
au FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
au FileType python setlocal omnifunc=pythoncomplete#Complete
au FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
augroup END
augroup set_shift_width
au!
au FileType ruby setl sw=2 sts=2 et
au FileType eruby setl sw=2 sts=2 et
au FileType javascript setl sw=2 sts=2 et
au FileType yaml setl sw=2 sts=2 et
augroup END
command! J :%!python -mjson.tool