@@ -81,7 +81,7 @@ function! settings#LoadSettings() abort
8181
8282
8383 function ! s: find_root ()
84- for vcs in [' .venv' , ' Pipfile' , ' Procfile' , ' Gemfile' , ' .git' , ' .svn' , ' .hg' ]
84+ for vcs in [' .venv' , ' Pipfile' , ' Procfile' , ' pyproject.toml ' , ' Gemfile' , ' .git' , ' .svn' , ' .hg' ]
8585 let dir = finddir (vcs.' /..' , ' ;' )
8686 if ! empty (dir )
8787 execute ' FZF' dir
@@ -91,16 +91,30 @@ function! settings#LoadSettings() abort
9191 FZF
9292 endfunction
9393
94- " command! FZFR call s:find_root()
95-
96- command ! - bang FZFR
97- \ call fzf#run (fzf#wrap (' my-stuff' , {' dir' : FindRootDirectory ()}, <bang> 0 ))
98-
99-
94+ function ! OnLoadFZF ()
95+ if ! exists (' :FZF' ) || ! exists (' :FZFAg' )
96+ echo ' bail'
97+ return
98+ endif
10099
101- nmap <space> :<C-u> FZFR<CR>
102- " nmap <space> :<C-u>FZF<CR>
100+ " fzf#wrap is resilient: It's Truthy even after plugged wipes depending on
101+ " the dir. Also check for fzf#complete to make sure it's possible to
102+ " actually see if fzf exists.
103+ if exists (' *fzf#wrap' ) && exists (' *fzf#complete' )
104+ command ! - bang FZFR
105+ \ call fzf#run (fzf#wrap (' my-stuff' , {' dir' : FindRootDirectory ()}, <bang> 0 ))
106+ nmap <space> :<C-u> FZFR<CR>
107+ endif
108+ if exists (' :FZFAg' )
109+ nnoremap <silent> <C-F> :<C-u> FZFAg<cr>
110+ endif
111+ if exists (' :FZFAgRoot' )
112+ nnoremap <silent> <C-f> :<C-u> FZFAgRoot<cr>
113+ endif
114+ " Old one: nmap <space> :<C-u>FZF<CR>
115+ endfunction
103116
117+ call plugin_loader#PlugOnLoad (' fzf.vim' , ' call OnLoadFZF()' )
104118
105119 " """
106120 " Tags in buffer
@@ -152,9 +166,6 @@ function! settings#LoadSettings() abort
152166 endfunction
153167
154168 command ! BTags call s: btags ()
155-
156-
157- nmap <space> :<C-u> FZFR<CR>
158169 nmap <C-o> :<C-u> BTags<CR>
159170
160171
@@ -211,8 +222,7 @@ function! settings#LoadSettings() abort
211222 \ ' down' : ' 50%'
212223 \ })
213224
214- nnoremap <silent> <C-F> :<C-u> FZFAg<cr>
215- nnoremap <silent> <C-f> :<C-u> FZFAgRoot<cr>
225+
216226
217227 if executable (' rg' )
218228 command ! - bang -nargs =* Rg
@@ -241,14 +251,3 @@ endfunction
241251 set laststatus = 2
242252 set cmdheight = 2 " Used to show docs when popup not available
243253" endif
244-
245- if &rtp = ~ ' wilder'
246- " ++once supported in Nvim 0.4+ and Vim 8.1+
247- " Also need to switch
248- autocmd CmdlineEnter * ++once call s: wilder_init () | call g: wilder#main#start ()
249-
250- function ! s: wilder_init () abort
251- call wilder#setup ({' modes' : [' :' , ' /' , ' ?' ]})
252- call wilder#set_option (' use_python_remote_plugin' , 0 )
253- endfunction
254- endif
0 commit comments