-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvimrc
executable file
·367 lines (298 loc) · 9.84 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
" Aaron's Global Defaults
" Bundle Plugins!
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
set rtp+=/usr/local/opt/fzf
call vundle#rc()
let g:goldenview__enable_default_mapping = 0
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Vundle stuff
Bundle 'majutsushi/tagbar'
Bundle 'vim-scripts/ZoomWin'
Bundle 'vim-scripts/taglist.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'gregsexton/gitv'
Bundle 'Shougo/neosnippet.git'
Bundle 'Shougo/neosnippet-snippets'
Bundle 'freitass/todo.txt-vim'
Bundle 'mileszs/ack.vim'
Bundle 'scrooloose/nerdcommenter.git'
Bundle 'aaronzirbes/vimport'
Bundle 'tpope/vim-abolish.git'
Bundle 'tpope/vim-dispatch'
Bundle 'radenling/vim-dispatch-neovim'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-unimpaired.git'
Bundle 'vim-scripts/Align.git'
Bundle 'altercation/vim-colors-solarized.git'
Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
Bundle 'pangloss/vim-javascript'
Bundle 'elzr/vim-json'
" Bundle 'zhaocai/GoldenView.Vim'
" Plugin 'neoclide/coc.nvim', {'branch': 'release'}
" Plugin 'neoclide/coc.nvim'
Plugin 'cespare/vim-toml'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'udalov/kotlin-vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'neomake/neomake'
Plugin 'luochen1990/rainbow'
Plugin 'fatih/vim-go'
"call neomake#configure#automake('w')
let g:neomake_open_list=1
" Requires:
"https://github.com/editorconfig/editorconfig-core-c
" Occasional Plugins
" Bundle 'jplaut/vim-arduino-ino'
" Bundle 'powerman/vim-plugin-AnsiEsc'
" Bundle 'chrisbra/csv.vim'
"Bundle 'scrooloose/syntastic'
" After updating this list, run `nvim +BundleInstall +qall`
" After updating this list, run `nvim +PluginInstall +qall`
" After updating this list, run `nvim +BundleUpdate +qall`
"
" nvim +BundleInstall +qall && nvim +PluginInstall +qall && nvim +BundleUpdate +qall
"let g:vim_arduino_library_path = /Applications/Arduino.app/Contents/Java
"let g:vim_arduino_serial_port = /my/serial/port
"
let g:airline_theme='tomorrow'
" Rainbow Parentheses Improved
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
" Enables HTML/CSS syntax highlighting in your JavaScript file.
"set javascript_enable_domhtmlcss
" Status line
"set statusline=%t\ [%{strlen(&fenc)?&fenc:'none'},%{&ff}]%h%m%r%y%=%c,%l/%L\ %P
" Syntastic syntax checking
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"%{fugitive#statusline()} to '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 = 0
" Experimenting
Bundle 'Kapeli/dash.vim'
" Maybe plugins
" Bundle 'derekwyatt/vim-scala'
" Bundle 'mhinz/vim-startify'
" Bundle 'jeetsukumaran/vim-buffergator.git'
" Bundle 'sjl/gundo.vim.git'
" tagbar support for groovy
let g:tagbar_type_groovy = {
\ 'ctagstype' : 'groovy',
\ 'kinds' : [
\ 'p:package',
\ 'c:class',
\ 'i:interface',
\ 'f:function',
\ 'v:variables',
\ ]
\ }
filetype plugin indent on
" I like pretty colors
if has("syntax")
syntax on
endif
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
" Ctrl-P ignore path
"set wildignore+=*.class,.git,.hg,.svn,**/target/classes/**,**/target/test-classes/**,**/target/test-reports/**.html,**/target/test-reports/**.xml,**/build/**
"let g:ctrlp_cmd = 'CtrlPTag'
"nnoremap <C-i> :<C-U>CtrlP <CR>
nnoremap <C-p> :<C-U>Tags <CR>
nnoremap <C-i> :<C-U>GFiles <CR>
" Tabline support for airline
let g:airline#extensions#tabline#enabled = 1
" Exhuberant C-Tags
set tags=.tags
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
"set ignorecase smartcase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Set the current line with the cursor on it to have an underline
set cursorline
set cmdheight=2
" When switching buffers, swap for the current open window
"set switchbuf=useopen
"
" Turn on line numbers
set number
set numberwidth=5
" Always show cursor information
set ruler
" Whether or not to show the tabs list
"set showtabline=2
" COMMENT THESE OUT TO LET VIM WINDOWS BE THE DEFAULT SIZE
"if has("gui_macvim")
"set winwidth=121
"set winminwidth=12
"set winheight=25
"set winminheight=15
"au VimEnter * set winheight=999
"endif
"set errorformat=%A""%f: %l"" : %m,%+G%.%#
set errorformat=%A""%f: %l"" : %m,%+%.%#
" The number of lines before and after the cursor to show
set scrolloff=3
let mapleader=","
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" Search highlighting
set hlsearch
function! MapCr()
nnoremap \ :nohlsearch<CR>
endfunction
call MapCr()
" my settings
set expandtab
set tabstop=4
set shiftwidth=4
set laststatus=2
set background=dark
"set background=light
"
"colorscheme torte
"colorscheme koehler
"colorscheme solarized
"colorscheme Tomorrow-Night
"colorscheme Tomorrow-Night-Eighties
colorscheme Tomorrow-Night-Bright
"colorscheme Tomorrow
" destroy all trailing whitespace
autocmd BufWritePre *.groovy :%s/\s\+$//e
" Vertical Column Limiter
" highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" match OverLength /\%121v.\+/
set colorcolumn=121
highlight ColorColumn ctermbg=2
" ctags
command! Tag :call GenerateCTags()
function! GenerateCTags()
let file = expand("%:p:h")
execute ":!ctags -f " . file . "/.tags " . file . "/*"
endfunction
" Search for selected text, forwards or backwards.
vnoremap <silent> * :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy/<C-R><C-R>=substitute(
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
vnoremap <silent> # :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy?<C-R><C-R>=substitute(
\escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
" Split line
nnoremap L i<CR><Esc>
" Vim JDK Imports location
let g:vimport_filetype_import_files = {
\ 'java': [$HOME . '/.vim/data/vimports_java.txt'],
\ 'groovy': [$HOME . '/.vim/data/vimports_java.txt', $HOME . '/.vim/data/vimports_groovy.txt', $HOME . '/.vim/data/vimports_spock.txt' ],
\ 'kotlin': [$HOME . '/.vim/data/vimports_kotlin.txt'],
\ 'scala': []
\ }
let g:vimport_lookup_gradle_classpath=1
noremap <Leader>i :InsertImport <CR> :%s/ *$// <CR>
" vimdiff ignore whitespace
"set diffopt+=iwhite
" Fugitive
noremap <Leader>b :<C-U>Git blame<CR>
noremap <Leader>di :<C-U>Git diff<CR>
noremap <Leader>s :<C-U>Git<CR><C-W>20+
noremap <Leader>h :<C-U>GBrowse<CR>
vnoremap <Leader>h :<C-U>GBrowse<CR>
noremap <Leader>c :<C-U>Git commit<CR>
noremap <Leader>d :<C-U>Gdiffsplit<CR>
" GitV
noremap <Leader>l :<C-U>Gitv!<CR>
noremap <Leader>L :<C-U>Gitv<CR>
" NerdTree
let g:NERDTreeWinSize = 40
noremap <Leader>nt :<C-U>NERDTreeToggle<CR>
noremap <Leader>nf :<C-U>NERDTreeFind<CR>
noremap :StacktraceFromJson :<C-U>%s#\\n\\t#\r\t#g<CR>
" tagbar
noremap <Leader>t :<C-U>TagbarToggle<CR>
nnoremap <Leader>tb :<C-U>!~/.vim/buildtags.sh<CR>
let g:airline#extensions#tagbar#enabled = 0
" Jira https://gist.github.com/2d860441b323e543d2bc
" Tired of hitting shift
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;
" Really not a big fan of trailing whitespace, mark it red
set list listchars=tab:>-,trail:·,precedes:<,extends:>
noremap <Leader>hr <C-U>set nolist
" clean stacktraces
nnoremap <Leader>st :<C-U>g/^\tat.*\.java.*/d<CR>:<C-U>g/^\tat.*(Unknown Source).*/d<CR>:<C-U>g/^\tat.*(Native Method).*/d<CR>
"noremap <Leader>st :<C-U>g/^\tat .*\(\.java:[0-9]\+\\|(Native Method)\\|(Unknown Source)\).*/d<CR>
" Dash lookup word under cursor
noremap <Leader>jd :<C-U>Dash! <C-R>=expand("<cword>") <CR><CR>
" JIRA
noremap <Leader>j :<C-U>!jira<CR> <CR>
" Enable Spell check highlighting for buffer
noremap <Leader>sc :<C-U>set spell spelllang=en_us<CR>
noremap <Leader>sn :<C-U>set spell spelllang=<CR>
" Copy selected range to Mac OS X copy buffer
vnoremap <Leader>y :<C-U>!sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p '<C-R>=expand("%:p") <CR>' \|pbcopy <CR> <CR>
" Copy entire file contents to Mac OS X copy buffer
nnoremap <Leader>y :<C-U>!cat '<C-R>=expand("%:p") <CR>' \| pbcopy <CR> <CR>
" Navigate next buffer / previous buffer
nnoremap <C-n> :<C-U>bn<CR>
nnoremap <C-N> :<C-U>bn<CR>
nnoremap <C-b> :<C-U>bp<CR>
nnoremap <C-B> :<C-U>bp<CR>
" Window navigation
if has('nvim')
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
nnoremap <C-h> <C-w>h
nnoremap <BS> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
else
nnoremap <C-j> <C-w>j
nnoremap <C-J> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-K> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-L> <C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-H> <C-w>h
endif
" Window resizing
nnoremap <C-7> :resize +2
nnoremap <C-8> :vertical:resize +2
nnoremap <C-9> :vertical:resize -2
nnoremap <C-0> :resize +2
" JSON highlighting
au BufRead,BufNewFile *.json set filetype=json