@@ -81,7 +81,7 @@ function! settings#LoadSettings() abort
81
81
82
82
83
83
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' ]
85
85
let dir = finddir (vcs.' /..' , ' ;' )
86
86
if ! empty (dir )
87
87
execute ' FZF' dir
@@ -91,16 +91,30 @@ function! settings#LoadSettings() abort
91
91
FZF
92
92
endfunction
93
93
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
100
99
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
103
116
117
+ call plugin_loader#PlugOnLoad (' fzf.vim' , ' call OnLoadFZF()' )
104
118
105
119
" """
106
120
" Tags in buffer
@@ -152,9 +166,6 @@ function! settings#LoadSettings() abort
152
166
endfunction
153
167
154
168
command ! BTags call s: btags ()
155
-
156
-
157
- nmap <space> :<C-u> FZFR<CR>
158
169
nmap <C-o> :<C-u> BTags<CR>
159
170
160
171
@@ -211,8 +222,7 @@ function! settings#LoadSettings() abort
211
222
\ ' down' : ' 50%'
212
223
\ })
213
224
214
- nnoremap <silent> <C-F> :<C-u> FZFAg<cr>
215
- nnoremap <silent> <C-f> :<C-u> FZFAgRoot<cr>
225
+
216
226
217
227
if executable (' rg' )
218
228
command ! - bang -nargs =* Rg
@@ -241,14 +251,3 @@ endfunction
241
251
set laststatus = 2
242
252
set cmdheight = 2 " Used to show docs when popup not available
243
253
" 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