comparison vim/vimrc @ 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 d048318ba839
comparison
equal deleted inserted replaced
444:71d7734148ed 445:05ab0353cd6e
52 if has("win32") 52 if has("win32")
53 au GUIEnter * simalt ~x 53 au GUIEnter * simalt ~x
54 endif 54 endif
55 endif 55 endif
56 56
57 function! s:HasPlugin(plugname) abort 57 function! s:HasPlugin(plugname, ...) abort
58 return globpath(&runtimepath, 'plugin/'.a:plugname.'.vim') !=# '' 58 let l:dirname = 'plugin/'
59 if a:0 && a:1
60 let l:dirname = 'autoload/'
61 endif
62 return globpath(&runtimepath, l:dirname.a:plugname.'.vim') !=# ''
59 endfunction 63 endfunction
60 64
61 " }}} 65 " }}}
62 66
63 " General Settings {{{ 67 " General Settings {{{
274 \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir', 278 \'tag', 'buffertag', 'quickfix', 'mixed', 'bookmarkdir',
275 \'autoignore' 279 \'autoignore'
276 \] 280 \]
277 281
278 " Use PyMatch to go faster. 282 " Use PyMatch to go faster.
279 if (has('python3') || has('python')) && s:HasPlugin('ctrlp-py-matcher') 283 if (has('python3') || has('python'))
280 let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'} 284 if s:HasPlugin('ctrlp-py-matcher')
281 let g:ctrlp_max_files = 0 285 let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'}
282 let g:ctrlp_lazy_update = 350 286 let g:ctrlp_max_files = 0
287 let g:ctrlp_lazy_update = 350
288 elseif s:HasPlugin('cpsm', 1)
289 let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'}
290 let g:ctrlp_max_files = 0
291 let g:ctrlp_lazy_update = 350
292 endif
283 endif 293 endif
284 294
285 " }}} 295 " }}}
286 296
287 " FZF {{{ 297 " FZF {{{
658 " Copy the current buffer's info. 668 " Copy the current buffer's info.
659 nnoremap <leader>cp :let @+ = expand('%:p')<cr>:echo @+<cr> 669 nnoremap <leader>cp :let @+ = expand('%:p')<cr>:echo @+<cr>
660 nnoremap <leader>cf :let @+ = expand('%:h')<cr>:echo @+<cr> 670 nnoremap <leader>cf :let @+ = expand('%:h')<cr>:echo @+<cr>
661 nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr> 671 nnoremap <leader>cw :let @+ = getcwd()<cr>:echo @+<cr>
662 672
663 nnoremap F <Plug>(easymotion-prefix)s
664
665 " Make the diff navigation also center things. 673 " Make the diff navigation also center things.
666 nnoremap ]c ]czvzz 674 nnoremap ]c ]czvzz
667 nnoremap [c [czvzz 675 nnoremap [c [czvzz
668 676
669 " Quick search and replace. 677 " Quick search and replace.
760 \"FZF is installed and enabled, but the Vim plugin ". 768 \"FZF is installed and enabled, but the Vim plugin ".
761 \"isn't loaded... add it to your `vimrc-local-pre`.") 769 \"isn't loaded... add it to your `vimrc-local-pre`.")
762 endif 770 endif
763 endif 771 endif
764 772
773 " LeaderF mappings.
774 if s:HasPlugin('leaderf')
775 let g:Lf_ShortcutF = '<C-p>'
776 let g:Lf_ShortcutB = '<C-o>'
777 nnoremap <silent> <C-p> :LeaderfFile<cr>
778 nnoremap <silent> <C-o> :LeaderfBuffer<cr>
779 nnoremap <silent> <C-u> :LeaderfTag<cr>
780 nnoremap <silent> <C-y> :LeaderfBufTagAll<cr>
781 nnoremap <silent> <Tab> :LeaderfMru<cr>
782
783 let g:Lf_StlSeparator = { 'left': '', 'right': '' }
784 endif
785
765 " }}} 786 " }}}
766 787
767 " Folding {{{ 788 " Folding {{{
768 789
769 " Start with one level of open. 790 " Start with one level of open.