2015-08-13 22:28:46 +00:00
|
|
|
" Functions {{
|
2015-03-27 00:54:29 +00:00
|
|
|
function! s:smart_source_rc(name)
|
|
|
|
call s:source_rc(a:name . '.rc.vim')
|
|
|
|
call s:source_rc(a:name . '.local.rc.vim')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:source_rc(path)
|
2020-02-22 01:09:00 +00:00
|
|
|
let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path))
|
|
|
|
if filereadable(l:f_path)
|
|
|
|
execute 'source' . l:f_path
|
|
|
|
endif
|
2015-03-27 00:54:29 +00:00
|
|
|
endfunction
|
2015-08-13 22:28:46 +00:00
|
|
|
" }} Functions
|
2015-03-27 00:54:29 +00:00
|
|
|
|
2019-10-24 21:13:20 +00:00
|
|
|
" Saving and loading specific versions of plugins
|
2020-10-23 20:52:12 +00:00
|
|
|
call s:smart_source_rc('plug-snapshot')
|
2019-10-24 21:13:20 +00:00
|
|
|
function! s:save_snapshot()
|
2020-02-22 01:09:00 +00:00
|
|
|
let l:f_path = fnameescape(expand('~/.vim/rc/plug-snapshot.rc.vim'))
|
|
|
|
execute 'PlugSnapshot!' . l:f_path
|
2019-10-24 21:13:20 +00:00
|
|
|
endfunction
|
|
|
|
command! SavePlugSnapshot call s:save_snapshot()
|
|
|
|
|
|
|
|
|
2020-02-22 01:09:00 +00:00
|
|
|
" General
|
|
|
|
Plug 'godlygeek/tabular' " Tabular spacing
|
|
|
|
Plug 'gregsexton/MatchTag'
|
|
|
|
Plug 'tpope/vim-endwise'
|
|
|
|
Plug 'tpope/vim-eunuch'
|
|
|
|
Plug 'tpope/vim-repeat'
|
|
|
|
Plug 'tpope/vim-rsi' " emacs bindinds in insert
|
|
|
|
Plug 'tpope/vim-surround'
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'tpope/vim-vinegar'
|
2020-02-22 01:09:00 +00:00
|
|
|
Plug 'vim-scripts/file-line'
|
|
|
|
if !g:gui.has_buffer_features
|
|
|
|
call s:smart_source_rc('plugins/airline')
|
|
|
|
call s:smart_source_rc('plugins/startify')
|
|
|
|
endif
|
|
|
|
Plug 'milkypostman/vim-togglelist'
|
|
|
|
nnoremap <silent> <F6> :call ToggleQuickfixList()<CR>
|
|
|
|
nnoremap <silent> <F7> :call ToggleLocationList()<CR>
|
|
|
|
" Plug 'edkolev/tmuxline.vim' " Removed because this can fail on some machines
|
|
|
|
" let g:tmuxline_powerline_separators = 0
|
|
|
|
call s:smart_source_rc('plugins/goyo-limelight') " Distraction free editing
|
2015-03-27 00:45:03 +00:00
|
|
|
|
2020-02-22 01:09:00 +00:00
|
|
|
" Searching
|
2018-06-13 20:19:22 +00:00
|
|
|
if !exists('g:gui_oni')
|
|
|
|
if !executable('fzf')
|
|
|
|
call s:smart_source_rc('plugins/ctrlp')
|
|
|
|
endif
|
|
|
|
call s:smart_source_rc('plugins/fzf')
|
|
|
|
call s:smart_source_rc('plugins/vim-grepper')
|
2017-11-14 03:03:12 +00:00
|
|
|
endif
|
2015-03-26 17:09:26 +00:00
|
|
|
|
2020-02-22 01:09:00 +00:00
|
|
|
" Git / Version control
|
|
|
|
call s:smart_source_rc('plugins/fugitive')
|
|
|
|
call s:smart_source_rc('plugins/gitgutter')
|
|
|
|
|
|
|
|
" Programming
|
2019-10-24 19:40:10 +00:00
|
|
|
Plug 'FooSoft/vim-argwrap'
|
2020-02-22 01:09:00 +00:00
|
|
|
nnoremap <silent> <leader>a :ArgWrap<CR>
|
2019-10-24 19:40:10 +00:00
|
|
|
Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] }
|
|
|
|
nnoremap // :TComment<CR>
|
|
|
|
vnoremap // :TCommentBlock<CR>
|
2020-02-22 01:09:00 +00:00
|
|
|
Plug 'rizzatti/dash.vim', { 'on': 'DashSearch' }
|
|
|
|
nmap <silent> <leader>d <Plug>DashSearch
|
|
|
|
let g:dash_map = { 'apex' : 'apex', 'visualforce' : 'vf' }
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2020-02-22 01:07:50 +00:00
|
|
|
" IDE stuff
|
|
|
|
|
|
|
|
" Lint and completion
|
|
|
|
if (g:vim_as_an_ide && !g:gui.has_linter_features) && (has('nvim') || v:version >= 800)
|
2021-04-30 18:27:39 +00:00
|
|
|
call s:smart_source_rc('plugins/ale')
|
2019-11-01 22:06:54 +00:00
|
|
|
|
2020-02-22 01:07:50 +00:00
|
|
|
" Enable autocomplete from ale and asyncomplete
|
|
|
|
if !g:gui.has_autocomplete_features
|
|
|
|
set omnifunc=ale#completion#OmniFunc
|
|
|
|
" Set ale completion as omni-func
|
|
|
|
" Enable asyncomplete
|
|
|
|
Plug 'prabirshrestha/asyncomplete.vim'
|
|
|
|
" Add ALE to asyncomplete
|
|
|
|
augroup acomp_setup
|
|
|
|
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({
|
|
|
|
\ 'priority': 10,
|
|
|
|
\ }))
|
|
|
|
augroup end
|
|
|
|
|
|
|
|
let g:asyncomplete_auto_popup = 0
|
|
|
|
" Make asyncomplete manually triggered
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~? '\s'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
inoremap <silent><expr> <C-Space>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ asyncomplete#force_refresh()
|
|
|
|
end
|
2015-03-26 17:09:26 +00:00
|
|
|
end
|
|
|
|
|
2020-02-22 01:07:50 +00:00
|
|
|
" Programming Tag navigation
|
2019-10-21 23:27:34 +00:00
|
|
|
if g:vim_as_an_ide && (v:version > 703) && !g:gui.has_ctags_features
|
|
|
|
call s:smart_source_rc('plugins/tagbar')
|
2016-05-20 23:17:33 +00:00
|
|
|
Plug 'ludovicchabant/vim-gutentags' " Auto generate tags files
|
2019-10-24 19:40:10 +00:00
|
|
|
command! TagsUpdate :GutentagsUpdate
|
2016-05-20 23:17:33 +00:00
|
|
|
end
|
2015-03-26 17:09:26 +00:00
|
|
|
|
2020-02-22 01:09:00 +00:00
|
|
|
" Filetype configuration
|
2020-02-05 18:17:32 +00:00
|
|
|
|
|
|
|
" Languages with custom configuration
|
|
|
|
" Custom go
|
2016-11-15 17:25:41 +00:00
|
|
|
let g:go_def_mapping_enabled = 0
|
2017-11-08 21:55:33 +00:00
|
|
|
let g:go_version_warning = 0
|
2021-04-30 18:27:39 +00:00
|
|
|
let g:go_fmt_autosave = 0
|
|
|
|
let g:go_imports_autosave = 0
|
2020-02-05 18:17:32 +00:00
|
|
|
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
|
|
|
" Custom rust
|
2019-04-11 20:04:32 +00:00
|
|
|
let g:rustfmt_autosave = 1
|
2020-02-05 18:17:32 +00:00
|
|
|
Plug 'rust-lang/rust.vim'
|
|
|
|
" Lots of custom python
|
2016-11-15 17:25:41 +00:00
|
|
|
call s:smart_source_rc('plugins/python')
|
2020-02-05 18:17:32 +00:00
|
|
|
|
|
|
|
" Disable polyglog for languages with more robust plugins
|
2020-02-22 01:11:08 +00:00
|
|
|
let g:polyglot_disabled = ['go', 'rust']
|
2020-02-05 18:17:32 +00:00
|
|
|
Plug 'sheerun/vim-polyglot'
|
2021-01-13 17:22:06 +00:00
|
|
|
" Custom rule for ansible playbook detection
|
|
|
|
augroup ansible_playbook
|
|
|
|
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
|
|
|
|
au BufRead,BufNewFile */playbooks/*.yaml set filetype=yaml.ansible
|
|
|
|
augroup end
|
2020-02-05 18:17:32 +00:00
|
|
|
|
|
|
|
" Languages not in polyglot
|
|
|
|
Plug 'ViViDboarder/force-vim', { 'for': ['apex', 'visualforce'] }
|
|
|
|
Plug 'ViViDboarder/vim-forcedotcom'
|
|
|
|
Plug 'hsanson/vim-android'
|
|
|
|
Plug 'pdurbin/vim-tsv'
|
2015-03-26 17:09:26 +00:00
|
|
|
" }}
|
|
|
|
|
2020-02-22 01:09:00 +00:00
|
|
|
" Themes
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'altercation/vim-colors-solarized'
|
2017-05-31 00:01:51 +00:00
|
|
|
Plug 'vim-scripts/wombat256.vim'
|