Mercurial > dotfiles
changeset 445:05ab0353cd6e
Add config for `cpsm` and `Leaderf`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 13 May 2018 21:41:57 -0700 |
parents | 71d7734148ed |
children | edefbb8ea16a |
files | vim/vimrc |
diffstat | 1 files changed, 29 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/vim/vimrc Mon May 07 22:14:56 2018 -0700 +++ b/vim/vimrc Sun May 13 21:41:57 2018 -0700 @@ -54,8 +54,12 @@ endif endif -function! s:HasPlugin(plugname) abort - return globpath(&runtimepath, 'plugin/'.a:plugname.'.vim') !=# '' +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 " }}} @@ -276,10 +280,16 @@ \] " Use PyMatch to go faster. -if (has('python3') || has('python')) && s:HasPlugin('ctrlp-py-matcher') - let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'} - let g:ctrlp_max_files = 0 - let g:ctrlp_lazy_update = 350 +if (has('python3') || has('python')) + if s:HasPlugin('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) + let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'} + let g:ctrlp_max_files = 0 + let g:ctrlp_lazy_update = 350 + endif endif " }}} @@ -660,8 +670,6 @@ nnoremap <leader>cf :let @+ = expand('%:h')<cr>:echo @+<cr> nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr> -nnoremap F <Plug>(easymotion-prefix)s - " Make the diff navigation also center things. nnoremap ]c ]czvzz nnoremap [c [czvzz @@ -762,6 +770,19 @@ endif endif +" LeaderF mappings. +if s:HasPlugin('leaderf') + let g:Lf_ShortcutF = '<C-p>' + let g:Lf_ShortcutB = '<C-o>' + nnoremap <silent> <C-p> :LeaderfFile<cr> + nnoremap <silent> <C-o> :LeaderfBuffer<cr> + nnoremap <silent> <C-u> :LeaderfTag<cr> + nnoremap <silent> <C-y> :LeaderfBufTagAll<cr> + nnoremap <silent> <Tab> :LeaderfMru<cr> + + let g:Lf_StlSeparator = { 'left': '', 'right': '' } +endif + " }}} " Folding {{{