-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
256 lines (207 loc) · 5.67 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
call plug#begin('~/.vim/vimplug-plugins')
" essentials
Plug 'mileszs/ack.vim'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-unimpaired'
Plug 'majutsushi/tagbar'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'Lokaltog/vim-easymotion'
Plug 'chrisbra/NrrwRgn'
Plug 'vim-scripts/ZoomWin'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'bronson/vim-trailing-whitespace'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-surround'
Plug 'vito-c/jq.vim'
" tab completion
Plug 'ervandew/supertab'
" comments
Plug 'tomtom/tcomment_vim'
" fuzzy search
Plug 'ctrlpvim/ctrlp.vim'
" git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" colors
Plug 'lifepillar/vim-solarized8'
Plug 'ajh17/Spacegray.vim'
" jvm
Plug 'vim-scripts/log4j.vim'
Plug 'tfnico/vim-gradle'
Plug 'gurpreetatwal/vim-avro', {'as': 'vim-avro-avdl'} "only avdl support
Plug 'AoLab/vim-avro', {'as': 'vim-avro-avsc'} "only avsc support
Plug 'GEverding/vim-hocon'
Plug 'neo4j-contrib/cypher-vim-syntax'
" scala/metals support
Plug 'derekwyatt/vim-scala'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Nix
Plug 'LnL7/vim-nix'
" Configuration for vim-scala
au BufRead,BufNewFile *.sbt set filetype=scala
" Configuration for vim-lsc
let g:lsc_enable_autocomplete = v:false
let g:lsc_server_commands = {
\ 'scala': {
\ 'command': 'metals-vim',
\ 'log_level': 'Log'
\ }
\}
let g:lsc_auto_map = {
\ 'GoToDefinition': 'gd',
\}
" javascript/json
Plug 'mustache/vim-mustache-handlebars'
Plug 'moll/vim-node'
Plug 'tpope/vim-jdaddy'
Plug 'leshill/vim-json'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'raichoo/purescript-vim'
Plug 'FrigoEU/psc-ide-vim'
" python
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'nvie/vim-flake8'
" build tools
Plug 'google/vim-maktaba'
Plug 'bazelbuild/vim-bazel'
call plug#end()
syntax on
syntax enable
filetype on
filetype plugin indent on
set nocompatible
" comments
map ,c <c-_><c-_>
" javascript/json
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0
" powerline specific
" seems to work best with macvim/gvim
" NOTE: this could also be thrown into .gvimrc
if has('gui_running')
Plug 'powerline/powerline', { 'rtp': 'powerline/bindings/vim/' }
set guifont=Meslo\ LG\ M\ for\ Powerline:h15
" set guifont=Inconsolata\ for\ Powerline:h15
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
endif
"Write the old file out when switching between files.
set autowrite
"Display current cursor position in lower right corner.
set ruler
"Tab stuff
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
autocmd BufRead,BufNewFile *.rb setlocal tabstop=2
autocmd BufRead,BufNewFile *.rb setlocal shiftwidth=2
autocmd BufRead,BufNewFile *.rb setlocal softtabstop=2
au FileType ruby setl sw=2 sts=2 et
autocmd BufRead,BufNewFile *.js setlocal tabstop=2
autocmd BufRead,BufNewFile *.js setlocal shiftwidth=2
autocmd BufRead,BufNewFile *.js setlocal softtabstop=2
au FileType javascript setl sw=2 sts=2 et
au FileType javascript.jsx setl sw=2 sts=2 et
autocmd BufRead,BufNewFile *.yml setlocal tabstop=2
autocmd BufRead,BufNewFile *.yml setlocal shiftwidth=2
autocmd BufRead,BufNewFile *.yml setlocal softtabstop=2
au FileType yaml setl sw=2 sts=2 et
autocmd FileType json syntax match Comment +\/\/.\+$+
set showcmd
set number
set smartindent
set autoindent
set laststatus=2
set linespace=3
set wrap
set textwidth=79
set formatoptions=qrn1
set hlsearch
set ignorecase
set smartcase
set foldenable
set mousehide
set guioptions=aAce
"Set incremental searching"
set incsearch
"Hide MacVim toolbar by default
set go-=T
"Hard-wrap paragraphs of text
nnoremap <leader>q gqip
"Code completion
imap ,<tab> <C-x><C-o>
set omnifunc=syntaxcomplete#Complete
"Set EOL
set endofline
"Escape
imap jj <esc>
"mimic macvim
imap <D-]> <C-O>:tabn<cr>
imap <D-[> <C-O>:tabp<cr>
" Source the vimrc file after saving it. This way, you don't have to reload
" Vim to see the changes.
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
let g:solarized_termtrans = 1
set background=dark
try
" colorscheme solarized8
" colorscheme solarized8_low
" colorscheme solarized8_flat
colorscheme solarized8_high
catch /^Vim\%((\a\+)\)\=:E185/
colorscheme desert
endtry
" sudo trick
cmap w!! %!sudo tee > /dev/null %
let g:jedi#auto_initialization = 0
let g:syntastic_python_checkers = ['flake8', 'pylint']
autocmd BufRead,BufNewFile *.html setlocal filetype=htmldjango
autocmd BufRead,BufNewFile *.json.j2 setlocal filetype=json
" nerdtree
let NERDTreeIgnore = ['^\.DS_Store$', '\.pyc$', '\.swp$', '^bazel\-.*']
map <Leader>n :NERDTreeToggle<CR>
" jvm specific
set wildignore+=*/target/*
function! StartUp()
if has('gui_running')
if 0 == argc()
NERDTree ~/dev
else
if argv(0) == '.'
" execute 'NERDTree' getcwd()
execute 'NERDTreeToggle'
"autopen NERDTree and focus cursor in new document
autocmd VimEnter * NERDTree
autocmd vimenter * wincmd p
let NERDTreeShowHidden=1
else
execute 'NERDTree' getcwd() . '/' . argv(0)
endif
endif
else
set mouse=a
endif
endfunction
autocmd VimEnter * call StartUp()
autocmd VimEnter * wincmd p
augroup myvimrc
au!
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
function Add(list, item)
call add(a:list, a:item)
return a:item
endfunction