-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.symlink.old
581 lines (462 loc) · 15.9 KB
/
vimrc.symlink.old
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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
if !has('nvim')
set nocompatible " be iMproved, required
endif
filetype off " required
call plug#begin('~/.vim/plugged')
" let Vundle manage Vundle, required
Plug 'gmarik/Vundle.vim'
"Plug 'ervandew/supertab'
" Color themes
" Plug 'tomasr/molokai'
" Plug 'nanotech/jellybeans.vim'
" Plug 'altercation/vim-colors-solarized'
" Plug 'joshdick/onedark.vim'
Plug 'liuchengxu/space-vim-dark'
" YouCompleteMe autocompletion engine
" Plug 'Valloric/YouCompleteMe'
" Color coding for parantheses
Plug 'kien/rainbow_parentheses.vim'
" Syntastic syntax highlighting (conflicts with ALE)
" Plug 'scrooloose/syntastic'
" Plug 'majutsushi/tagbar'
" Better status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Support auto-formatting of code via external autoformatters
" Plug 'Chiel92/vim-autoformat'
" Needed by unite and neocomplete
Plug 'Shougo/vimproc.vim', {'do': 'make'}
" Unite.vim
Plug 'Shougo/unite.vim'
" Support most recently used files in unite.vim
Plug 'Shougo/neomru.vim'
" neocomplete auto-completion
if !has('nvim')
Plug 'Shougo/neocomplete.vim'
Plug 'Shougo/context_filetype.vim'
Plug 'Shougo/neoinclude.vim'
else
Plug 'Shougo/deoplete.nvim'
" Plug 'zchee/deoplete-go', { 'do': 'make' }
endif
" Display line indentation marks
Plug 'Yggdroot/indentLine'
" Deletes a trailing EOL from files on save (if it is there)
Plug 'vim-scripts/PreserveNoEOL'
" Maps Groovy syntax to gradle files
Plug 'tfnico/vim-gradle'
" Plug 'edkolev/promptline.vim'
" Only GIT: Show changed/added/deleted lines in the signs-column
Plug 'airblade/vim-gitgutter'
" Preview of %s changes
" Plug 'osyo-manga/vim-over'
Plug 'mbbill/undotree'
" Auto-close parentheses
Plug 'Townk/vim-autoclose'
Plug 'mileszs/ack.vim'
" Sublime Text style multiple cursors
" Plug 'vim-multiple-cursors'
" Language support
"Plug 'fatih/vim-go'
"Plug 'elzr/vim-json'
"Plug 'othree/html5.vim'
"Plug 'posva/vim-vue'
"Plug 'derekwyatt/vim-scala'
Plug 'sheerun/vim-polyglot'
" Automatically adding 'end' for Ruby
" Plug 'tpope/vim-endwise'
Plug 'ngmy/vim-rubocop'
Plug 'vim-ruby/vim-ruby'
" Match HTML tags like parentheses
Plug 'gregsexton/MatchTag'
Plug 'tpope/vim-fugitive'
if has('nvim')
Plug 'airodactyl/neovim-ranger'
endif
" Asynchronous Linter using external tools
Plug 'w0rp/ale'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround'
" All of your Plugins must be added before the following line
call plug#end()
filetype plugin indent on " required
set hidden
set background=dark
let mapleader=','
" GVim settings
" set guifont=Envy\ Code\ R\ for\ Powerline\ 10
set guifont=Iosevka\ Nerd\ Font\ 10
" Autoselect: Automatically yank visual selection into "* register
set guioptions+=a
" Use console dialogs instead of popup dialogs
set guioptions+=c
" Disable toolbar
set guioptions-=T
" Disable menu
" set guioptions-=m
" Highlight current line
let s:uname = system("echo -n \"$(uname)\"")
if !v:shell_error && s:uname == "Linux"
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
set cursorline cursorcolumn
endif
" More powerfull backspace
set backspace=indent,eol,start
" persistent_undo
set undofile
set undodir=~/.vim/undodir
set undolevels=1000
set undoreload=10000
" show matching bracket (briefly jump)
set showmatch
set matchtime=2 "0.2 seconds
set matchpairs+=<:> " specially for html
" Enable true color
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
syntax on
filetype plugin indent on
" colorscheme molokai
" colorscheme jellybeans
" colorscheme solarized
" colorscheme onedark
colorscheme space-vim-dark
hi Comment cterm=italic
" Damn you Arduino!
au BufNewFile,BufRead *.ino set filetype=cpp
" Rust
au BufNewFile,BufRead *.rs set filetype=rust
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Turn backup off, since most stuff is in SVN, git, etc anyway...
set nobackup
set nowb
set noswapfile
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
if !has('nvim')
set term=screen-256color
" Set utf8 as standard encoding
set encoding=utf8
endif
" Sets how many lines of history VIM has to remember
set history=1024
" Set to auto read when a file is changed from the outside
set autoread
" Word wrapping after 80 characters
set tw=80
set fo-=t
"set wrap
" Enable the wildmenu (better auto completion for files in command line)
set wildmenu
set wildmode=longest:full,full
" Always have 7 lines from screen edge to the cursor
set so=5
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
" Let the netrw file explorer ignore specific filetypes (comma separated)
let g:netrw_list_hide= '.*\.swp$,.*\.pyc$,.*\.o$,.*~$'
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" No annoying sound on errors
set noerrorbells
"set novisualbell
set t_vb=
set tm=500
" Activate line numbers
set number
" Set line number style for console
:highlight LineNr ctermfg=grey
" and GUI
:highlight LineNr guifg=#868686
" Automatically detect *.md files as Markdown files
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
" Automatically remove trailing whitespaces on save
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" Open new split panes to right and bottom
set splitbelow
set splitright
" RainbowParantheses Config Start
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 14
let g:rbpt_loadcmd_toggle = 0
" Load the RainbowParentheses and activate them upon VIM startup
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" RainbowParantheses Config End
" Don't conceal JSON syntax
set conceallevel=0
let g:vim_json_syntax_conceal = 0
let g:miniBufExplBRSplit = 0 " Put new window above
" current or on the
" left for vertical split
if !has('nvim')
let g:neocomplete#enable_at_startup = 0 "default 0
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_cursor_hold_i = 1
else
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#auto_complete_delay = 200
endif
" Syntastic
"let g:syntastic_enable_signs = 1
"let g:syntastic_enable_balloons = 1
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_aggregate_errors = 1
" Default = 2 (auto close but not open)
"let g:syntastic_auto_loc_list = 2
"let g:syntastic_markdown_checkers = ['mdl']
"let g:syntastic_javascript_checkers = ['eslint']
" Gitgutter
set signcolumn=yes
" Airline
set laststatus=2 " Always display the statusline in all windows
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#buffer_nr_format = '%s:'
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#fnamecollapse = 1
let g:airline#extensions#tabline#fnametruncate = 0
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#whitespace#enabled = 1
"let g:airline#extensions#promptline#snapshot_file = '~/.dotfiles/zsh/90-airline-theme.zsh'
"let g:airline_theme='wombat'
"let g:airline_theme='solarized'
"let g:airline_theme='onedark'
let g:airline_theme='violet'
let g:Powerline_symbols='fancy'
" Distinct background color is enough to discriminate the warning and
" error information.
let g:airline#extensions#ale#error_symbol = '•'
let g:airline#extensions#ale#warning_symbol = '•'
" let g:promptline_theme='airline'
" tagbar
let g:tagbar_left = 1
" vim-go
let g:go_fmt_command = "goimports"
let g:go_fmt_autosave = 1
let g:go_get_update = 0
let g:go_auto_type_info = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_build_constraints = 1
" disable if vim behaves sluggish
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
" Ack
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Sometimes when using both vim-go and syntastic Vim will start lagging while saving and opening files. The following fixes this:
" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" let g:go_list_type = "quickfix"
" Unite
" Use fuzzy search and sort results by rank
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
let g:unite_source_history_yank_enable = 1
" Use ag command instead of the find/grep command for file_rec/async
let g:unite_source_rec_async_command= 'ag --nocolor --nogroup --hidden -g ""'
" KEYMAPPINGS
" Open/Close foldings in normal mode with space
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
" Tab changes
:nmap <Leader>t2 :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>
:nmap <Leader>t4 :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
:nmap <Leader>t8 :set expandtab tabstop=8 shiftwidth=8 softtabstop=8<CR>
" Unite
" -no-split?
nnoremap <C-p> :Unite -start-insert buffer file_rec/async file_mru -auto-preview<CR>
nnoremap <Leader>l :Unite -start-insert line -auto-preview<CR>
nnoremap <Leader>m :Unite -start-insert mapping -auto-preview<CR>
"nnoremap <space>/ :Unite grep:.<CR>
nnoremap <space>y :Unite history/yank<CR>
" nnoremap <space>/ :Unite grep:.<CR>
vnoremap <space>( :call VisualSelection('ug')<CR>
" OMG UNITE!
" Ack, again
nnoremap <space>/ :Ack
nmap <Leader>// <Plug>NERDCommenterToggle
omap <Leader>// <Plug>NERDCommenterToggle
vmap <Leader>// <Plug>NERDCommenterToggle
" Map Up and Down keys to move one row instead of one line (wrapped lines
" stuff)
map <Down> gj
map <Up> gk
" Map Ctrl+Up and Ctrl+Down to scroll window
map <C-Down> <C-E>
map <C-Up> <C-Y>
" I want word movements on Ctrl + Arrows instread of WORD movements
map <C-Right> w
map <C-Left> b
nmap <Leader>q :nohlsearch<CR>
" Map Shift + Arrows to switch between windows
nmap <S-Up> <C-W><Up>
nmap <S-Down> <C-W><Down>
nmap <S-Left> <C-W><Left>
nmap <S-Right> <C-W><Right>
nmap <M-Left> :bprevious<CR>
nmap <M-Right> :bnext<CR>
nnoremap <F4> :UndotreeToggle<cr>
" Nicer buffer switchting on F6
nnoremap <F6> :buffers<CR>:buffer<Space>
" F9 : Toggle auto line wrapping
map <F9> :call ToggleTextWrap()<CR>
" F10: Highlight too long lines
map<F10> :call ToggleHighlightLongLines()<CR>
" F12: Toggle line numbers
map <F12> :set nonumber!<CR>:IndentLinesToggle<CR>
" See http://vim.wikia.com/wiki/Accessing_the_system_clipboard
" Visual mode: F7 to copy current selection to clipboard
vmap <F7> "+ygv"+y`>
" Visual Mode Ctrl-F7: Overwrite selection with clipboard cursor
vmap <C-F7> "+p`]
" F7: Paste clipboard after cursor
nmap <F7> "+gp
" F8: Tagbar toggle
nmap <F8> :TagbarToggle<CR>
" Shift-F7: Paste clipboard before cursor
nmap <S-F7> "+gP
" neocomplete
if !has('nvim')
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
else
inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>"
endif
" vim-go
au FileType go nmap <leader>gr <Plug>(go-run)
au FileType go nmap <leader>gd <Plug>(go-def)
au FileType go nmap <leader>gds <Plug>(go-def-split)
au FileType go nmap <leader>gdv <Plug>(go-def-vertical)
au FileType go nmap <leader>gb <Plug>(go-build)
au FileType go nmap <leader>gt <Plug>(go-test)
au FileType go nmap <leader>gv <Plug>(go-vet)
au FileType go nmap <leader>gc <Plug>(go-coverage)
au FileType go nmap <leader>gcc <Plug>(go-coverage-clear)
au FileType go nmap <leader>gct <Plug>(go-coverage-toggle)
au FileType go nmap <Leader>gi <Plug>(go-implements)
au FileType go nmap <Leader>gce <Plug>(go-callees)
au FileType go nmap <Leader>gcr <Plug>(go-callers)
au FileType go nmap <Leader>gcs <Plug>(go-callstack)
au FileType go nmap <Leader>gre <Plug>(go-rename)
""""" Helper function from http://amix.dk/vim/vimrc.html
" Visual mode: search & highlight current selection (* -> forward, # -> backward)
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
function! VisualSelection(direction) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
elseif a:direction == 'gv'
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
elseif a:direction == 'f'
execute "normal /" . l:pattern . "^M"
elseif a:direction == 'ug'
execute "Unite grep:.::" . l:pattern
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
" Thanks to http://wtf.hijacked.us/wiki/index.php/Vim
" Global tracker var
let g:HighlightLongLines = 0 "set to 0 so we can run it to enable
" Function to toggle highlighting of lines longer than 80 character
" It also toggles textwidth to 80 so newlines are forced when typing
fu! ToggleHighlightLongLines()
if(g:HighlightLongLines == 1)
" Disable highlighting and textwidth
highlight clear rightMargin
set textwidth=0
let g:HighlightLongLines = 0
else
" Enable highlighting and textwidth
set textwidth=80
highlight rightMargin ctermbg=LightRed guibg=LightRed
match rightMargin /\%>81v/
let g:HighlightLongLines = 1
endif
endfunction
function! ToggleTextWrap()
if &fo =~ 't'
set fo-=t
else
set fo+=t
endif
endfunction
function! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun