diff vim/vimrc @ 495:232351531855

Vim config improvements - Support for gui vs non gui plugin exclusions rules - Move HasPlugin to an autoload function that can be used in vimrc-local - Don't load the local bundle if it doesn't exist - Handle VS vs UE for building projects
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 12 Nov 2021 10:51:57 -0800
parents b452486b97c5
children
line wrap: on
line diff
--- a/vim/vimrc	Fri Nov 12 10:50:18 2021 -0800
+++ b/vim/vimrc	Fri Nov 12 10:51:57 2021 -0800
@@ -31,7 +31,11 @@
 
 " Disable some plugins.
 let g:pathogen_disabled = get(g:, 'pathogen_disabled', [])
-call ludo#setup_pathogen([ludo#localpath('bundle'), ludo#localpath('local')])
+let s:bundles = [ludo#localpath('bundle')]
+if isdirectory(ludo#localpath('local'))
+    call add(s:bundles, ludo#localpath('local'))
+endif
+call ludo#setup_pathogen(s:bundles)
 
 " Load pathogen.
 runtime bundle/pathogen/autoload/pathogen.vim
@@ -54,14 +58,6 @@
     endif
 endif
 
-function! s:HasPlugin(plugname, ...) abort
-    let l:dirname = 'plugin/'
-    if a:0 && a:1
-        let l:dirname = 'autoload/'
-    endif
-    return globpath(&runtimepath, l:dirname.a:plugname.'.vim') !=# ''
-endfunction
-
 " }}}
 
 " General Settings {{{
@@ -287,11 +283,11 @@
 
 " Use PyMatch to go faster.
 if (has('python3') || has('python'))
-    if s:HasPlugin('ctrlp-py-matcher')
+    if ludo#has_plugin('ctrlp-py-matcher')
         let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'}
         let g:ctrlp_max_files = 0
         let g:ctrlp_lazy_update = 350
-    elseif s:HasPlugin('cpsm', 1)
+    elseif ludo#has_plugin('cpsm', 1)
         let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'}
         let g:ctrlp_max_files = 0
         let g:ctrlp_lazy_update = 350
@@ -456,7 +452,7 @@
       \    },
       \}
 
-if s:HasPlugin('fugitive')
+if ludo#has_plugin('fugitive')
     function! _LightlineFugitive()
         return fugitive#head()
     endfunction
@@ -465,7 +461,7 @@
     endfunction
 endif
 
-if s:HasPlugin('lawrencium')
+if ludo#has_plugin('lawrencium')
     function! _LightlineLawrencium()
         return lawrencium#statusline()
     endfunction
@@ -487,7 +483,7 @@
     endif
 endfunction
 
-if s:HasPlugin('gutentags')
+if ludo#has_plugin('gutentags')
     function! _LightlineGutentags()
         return gutentags#statusline('', '', '♨')
     endfunction
@@ -496,7 +492,7 @@
     endfunction
 endif
 
-if s:HasPlugin('syntastic')
+if ludo#has_plugin('syntastic')
     function! _LightlineLinter()
         return SyntasticStatuslineFlag()
     endfunction
@@ -515,7 +511,7 @@
     endfunction
 endif
 
-if s:HasPlugin('youcompleteme')
+if ludo#has_plugin('youcompleteme')
     function! _LightlineYcmErrors()
         let l:cnt = youcompleteme#GetErrorCount()
         return l:cnt > 0 ? string(l:cnt) : ''
@@ -734,7 +730,7 @@
 nnoremap N Nzvzz
 
 " YCM mappings.
-if s:HasPlugin('youcompleteme')
+if ludo#has_plugin('youcompleteme')
     augroup VimRC_YouCompleteMe
         autocmd!
         autocmd FileType cpp nnoremap <Leader>jj :YcmCompleter GoToImprecise<cr>zv
@@ -748,7 +744,7 @@
 endif
 
 " OmniSharp mappings
-if s:HasPlugin('OmniSharp')
+if ludo#has_plugin('OmniSharp')
     augroup VimRC_OmniSharp
         autocmd!
         autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
@@ -788,7 +784,7 @@
 nnoremap <leader>cd :ProjectRootCD<cr>
 
 " Ctrl-P mappings.
-if s:HasPlugin('ctrlp')
+if ludo#has_plugin('ctrlp')
     nnoremap <silent> <C-p> :CtrlP<cr>
     nnoremap <silent> <C-o> :CtrlPBuffer<cr>
     nnoremap <silent> <C-u> :CtrlPTag<cr>
@@ -798,7 +794,7 @@
 endif
 
 " FZF mappings.
-if s:HasPlugin('fzf')
+if ludo#has_plugin('fzf')
     if exists('*fzf#run')
         nnoremap <silent> <C-p> :Files<cr>
         nnoremap <silent> <C-o> :Buffers<cr>
@@ -816,7 +812,7 @@
 endif
 
 " LeaderF mappings.
-if s:HasPlugin('leaderf')
+if ludo#has_plugin('leaderf')
     let g:Lf_ShortcutF = '<C-p>'
     let g:Lf_ShortcutB = '<C-o>'
     nnoremap <silent> <C-p> :LeaderfFile<cr>
@@ -832,11 +828,8 @@
     let g:Lf_StlSeparator = { 'left': '', 'right': '' }
 endif
 
-" Vimcrosoft mappings.
-if s:HasPlugin('vimcrosoft')
-    nnoremap <F7> :VimcrosoftBuildActiveProject<cr>
-    nnoremap <F8> :VimcrosoftBuildSln<cr>
-endif
+" Vimcrosoft/UE mappings.
+nnoremap <F7> :call ludo#build_vs_or_ue()<cr>
 
 " }}}