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)
|
|
|
|
let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path))
|
|
|
|
if filereadable(l:f_path)
|
|
|
|
execute 'source' . l:f_path
|
|
|
|
endif
|
|
|
|
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
|
|
|
|
call s:source_rc('plug-snapshot')
|
|
|
|
function! s:save_snapshot()
|
|
|
|
let l:f_path = fnameescape(expand('~/.vim/rc/plug-snapshot.rc.vim'))
|
|
|
|
execute 'PlugSnapshot!' . l:f_path
|
|
|
|
endfunction
|
|
|
|
command! SavePlugSnapshot call s:save_snapshot()
|
|
|
|
|
|
|
|
|
2015-03-26 17:09:26 +00:00
|
|
|
" Navigation {{
|
2017-05-31 00:01:51 +00:00
|
|
|
Plug 'vim-scripts/file-line'
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'tpope/vim-vinegar'
|
2015-08-13 22:28:46 +00:00
|
|
|
" }} Navigation
|
|
|
|
|
|
|
|
" Git {{
|
2016-11-15 17:25:41 +00:00
|
|
|
call s:smart_source_rc('plugins/fugitive')
|
|
|
|
call s:smart_source_rc('plugins/gitgutter')
|
2015-08-13 22:28:46 +00:00
|
|
|
" }} Git
|
2015-03-27 00:45:03 +00:00
|
|
|
|
2015-08-20 21:54:46 +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
|
2017-01-06 01:19:19 +00:00
|
|
|
" }} Searching
|
2015-03-26 17:09:26 +00:00
|
|
|
|
2019-10-21 23:27:34 +00:00
|
|
|
" Programming {{
|
2019-10-24 19:40:10 +00:00
|
|
|
Plug 'FooSoft/vim-argwrap'
|
2019-10-21 23:27:34 +00:00
|
|
|
|
2019-10-24 19:40:10 +00:00
|
|
|
Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] }
|
|
|
|
nnoremap // :TComment<CR>
|
|
|
|
vnoremap // :TCommentBlock<CR>
|
|
|
|
|
|
|
|
" Install ALE
|
|
|
|
if !g:vim_as_an_ide || g:gui.has_linter_features
|
|
|
|
" We'll keep skip adding any of these features
|
|
|
|
elseif has('nvim') || v:version >= 800
|
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
set omnifunc=ale#completion#OmniFunc
|
|
|
|
let g:airline#extensions#ale#enabled = 1
|
|
|
|
let g:ale_lint_on_enter = 0
|
|
|
|
|
|
|
|
" TODO: Maybe move this to something per language
|
|
|
|
" TODO: Handle installing of language servers on setup (see ./install-language-servers.sh)
|
|
|
|
" NOTE: Some of these are installed when bootstrapping environment,
|
|
|
|
" outside of vim setup
|
|
|
|
let g:ale_linters = {
|
2019-10-29 19:33:08 +00:00
|
|
|
\ 'go': ['gopls', 'golint', 'gometalinter'],
|
|
|
|
\ 'python': ['pyls', 'flake8', 'mypy', 'pylint'],
|
|
|
|
\ 'rust': ['rls', 'cargo'],
|
|
|
|
\ 'sh': ['language_server', 'shell', 'shellcheck'],
|
|
|
|
\ 'text': ['proselint', 'alex'],
|
2019-10-24 19:40:10 +00:00
|
|
|
\}
|
2019-10-29 19:33:08 +00:00
|
|
|
let g:ale_linter_aliases = {
|
|
|
|
\ 'markdown': ['text'],
|
|
|
|
\}
|
|
|
|
" More than a few languages use the same fixers
|
|
|
|
let s:ale_pretty_trim_fixer = ['prettier', 'trim_whitespace', 'remove_trailing_lines']
|
2019-10-24 19:40:10 +00:00
|
|
|
let g:ale_fixers = {
|
2019-10-29 19:33:08 +00:00
|
|
|
\ 'go': ['gofmt', 'goimports'],
|
|
|
|
\ 'json': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'rust': ['rustfmt'],
|
|
|
|
\ 'markdown': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'yaml': ['prettier', 'remove_trailing_lines'],
|
|
|
|
\ 'css': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'javascript': s:ale_pretty_trim_fixer,
|
2019-10-24 19:40:10 +00:00
|
|
|
\}
|
|
|
|
|
2019-11-01 22:06:54 +00:00
|
|
|
" Create shortcut for ALEFix
|
|
|
|
nnoremap <F4> :ALEFix<CR>
|
|
|
|
|
2019-10-24 19:40:10 +00:00
|
|
|
" 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({
|
2019-10-29 19:33:08 +00:00
|
|
|
\ 'priority': 10,
|
|
|
|
\ }))
|
2019-10-24 19:40:10 +00:00
|
|
|
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()
|
2015-03-26 17:09:26 +00:00
|
|
|
end
|
|
|
|
|
2019-10-24 19:40:10 +00:00
|
|
|
" TODO: Figure out if this is needed or if the ale completions are sufficient
|
|
|
|
" call s:smart_source_rc('plugins/omnicompletion')
|
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-27 00:45:03 +00:00
|
|
|
" }}
|
2015-03-26 17:09:26 +00:00
|
|
|
|
|
|
|
" GUI {{
|
2017-01-06 01:19:19 +00:00
|
|
|
Plug 'gregsexton/MatchTag'
|
|
|
|
call s:smart_source_rc('plugins/dash')
|
2019-10-21 23:27:34 +00:00
|
|
|
if !g:gui.has_buffer_features
|
|
|
|
call s:smart_source_rc('plugins/airline')
|
2018-06-13 20:19:22 +00:00
|
|
|
call s:smart_source_rc('plugins/startify')
|
|
|
|
endif
|
2016-11-15 17:16:03 +00:00
|
|
|
" Plug 'edkolev/tmuxline.vim' " Removed because this can fail on some machines
|
|
|
|
" let g:tmuxline_powerline_separators = 0
|
2015-08-13 22:28:46 +00:00
|
|
|
|
|
|
|
" }} GUI
|
2015-03-26 17:09:26 +00:00
|
|
|
|
|
|
|
" Filetypes {{
|
2017-01-06 01:19:19 +00:00
|
|
|
Plug 'ViViDboarder/force-vim', { 'for': ['apex', 'visualforce'] }
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'ViViDboarder/vim-forcedotcom'
|
2019-10-24 20:47:40 +00:00
|
|
|
" YAML seems to be supported by Vim now?
|
|
|
|
" Plug 'avakhov/vim-yaml'
|
2017-01-23 20:21:40 +00:00
|
|
|
Plug 'cespare/vim-toml'
|
2015-06-16 01:01:57 +00:00
|
|
|
Plug 'dag/vim-fish'
|
2017-05-30 21:10:55 +00:00
|
|
|
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'hsanson/vim-android'
|
2019-04-11 20:04:32 +00:00
|
|
|
Plug 'keith/swift.vim'
|
2015-03-26 17:09:26 +00:00
|
|
|
Plug 'pangloss/vim-javascript'
|
|
|
|
Plug 'pdurbin/vim-tsv'
|
|
|
|
Plug 'tfnico/vim-gradle'
|
2015-03-31 20:48:21 +00:00
|
|
|
Plug 'tmux-plugins/vim-tmux'
|
2017-01-06 01:19:19 +00:00
|
|
|
Plug 'udalov/kotlin-vim'
|
2017-11-08 21:55:33 +00:00
|
|
|
Plug 'vim-scripts/groovy.vim'
|
2019-04-11 20:04:32 +00:00
|
|
|
Plug 'leafgarland/typescript-vim'
|
|
|
|
Plug 'rust-lang/rust.vim'
|
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
|
2019-04-11 20:04:32 +00:00
|
|
|
let g:rustfmt_autosave = 1
|
2015-03-27 00:45:03 +00:00
|
|
|
" }}
|
|
|
|
|
2015-03-26 17:09:26 +00:00
|
|
|
" Python {{
|
2016-11-15 17:25:41 +00:00
|
|
|
call s:smart_source_rc('plugins/python')
|
2015-03-26 17:09:26 +00:00
|
|
|
" }}
|
|
|
|
|
|
|
|
" Themes {{
|
|
|
|
Plug 'altercation/vim-colors-solarized'
|
2017-05-31 00:01:51 +00:00
|
|
|
Plug 'vim-scripts/vividchalk.vim'
|
|
|
|
Plug 'vim-scripts/wombat256.vim'
|
2017-01-06 01:19:19 +00:00
|
|
|
call s:smart_source_rc('plugins/goyo-limelight') " Distraction free editing
|
2019-10-21 23:27:34 +00:00
|
|
|
" }}
|
2015-03-26 17:09:26 +00:00
|
|
|
|
|
|
|
" System {{
|
2019-10-21 23:27:34 +00:00
|
|
|
Plug 'tpope/vim-surround'
|
2015-06-16 01:01:57 +00:00
|
|
|
Plug 'tpope/vim-endwise'
|
2016-06-07 01:03:45 +00:00
|
|
|
Plug 'tpope/vim-eunuch'
|
|
|
|
Plug 'tpope/vim-repeat'
|
2017-01-06 01:19:19 +00:00
|
|
|
Plug 'tpope/vim-rsi' " emacs bindinds in insert
|
|
|
|
call s:smart_source_rc('plugins/vim-togglelist')
|
2015-03-26 17:09:26 +00:00
|
|
|
" }}
|