diff --git a/autoload/settings.vim b/autoload/settings.vim index 9925b4f..dd73d36 100644 --- a/autoload/settings.vim +++ b/autoload/settings.vim @@ -81,7 +81,7 @@ function! settings#LoadSettings() abort function! s:find_root() - for vcs in ['.venv', 'Pipfile', 'Procfile', 'Gemfile', '.git', '.svn', '.hg'] + for vcs in ['.venv', 'Pipfile', 'Procfile', 'pyproject.toml', 'Gemfile', '.git', '.svn', '.hg'] let dir = finddir(vcs.'/..', ';') if !empty(dir) execute 'FZF' dir @@ -91,16 +91,30 @@ function! settings#LoadSettings() abort FZF endfunction - " command! FZFR call s:find_root() - - command! -bang FZFR - \ call fzf#run(fzf#wrap('my-stuff', {'dir': FindRootDirectory()}, 0)) - - + function! OnLoadFZF() + if !exists(':FZF') || !exists(':FZFAg') + echo 'bail' + return + endif - nmap :FZFR - "nmap :FZF + " fzf#wrap is resilient: It's Truthy even after plugged wipes depending on + " the dir. Also check for fzf#complete to make sure it's possible to + " actually see if fzf exists. + if exists('*fzf#wrap') && exists('*fzf#complete') + command! -bang FZFR + \ call fzf#run(fzf#wrap('my-stuff', {'dir': FindRootDirectory()}, 0)) + nmap :FZFR + endif + if exists(':FZFAg') + nnoremap :FZFAg + endif + if exists(':FZFAgRoot') + nnoremap :FZFAgRoot + endif + " Old one: nmap :FZF + endfunction + call plugin_loader#PlugOnLoad('fzf.vim', 'call OnLoadFZF()') """" " Tags in buffer @@ -152,9 +166,6 @@ function! settings#LoadSettings() abort endfunction command! BTags call s:btags() - - - nmap :FZFR nmap :BTags @@ -211,8 +222,7 @@ function! settings#LoadSettings() abort \ 'down': '50%' \ }) - nnoremap :FZFAg - nnoremap :FZFAgRoot + if executable('rg') command! -bang -nargs=* Rg @@ -241,14 +251,3 @@ endfunction set laststatus=2 set cmdheight=2 " Used to show docs when popup not available " endif - -if &rtp =~ 'wilder' - " ++once supported in Nvim 0.4+ and Vim 8.1+ - " Also need to switch - autocmd CmdlineEnter * ++once call s:wilder_init() | call g:wilder#main#start() - - function! s:wilder_init() abort - call wilder#setup({'modes': [':', '/', '?']}) - call wilder#set_option('use_python_remote_plugin', 0) - endfunction -endif diff --git a/plugins.vim b/plugins.vim index 4d3ab63..3070a1b 100644 --- a/plugins.vim +++ b/plugins.vim @@ -91,7 +91,9 @@ else endif function! OnLoadCoc() - if ! &rtp =~ 'coc.nvim' + " if ! &rtp =~ 'coc.nvim' + if !exists('*CocActionAsync') || !exists('*CocAction') + echo "coc.nvim not initialized, aborting loading" return endif @@ -107,9 +109,8 @@ function! OnLoadCoc() \ check_back_space() ? "\" : \ coc#refresh() inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - inoremap coc#pum#visible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" + \: "\u\\=coc#on_enter()\" " Remap keys for gotos nmap (coc-definition) @@ -152,7 +153,8 @@ autocmd FileType javascript,typescript,typescript.tsx let b:coc_root_patterns = " Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} -call OnLoadCoc() +call plugin_loader#PlugOnLoad('coc.nvim', 'call OnLoadCoc()') + " For coc-settings.json jsonc autocmd FileType json syntax match Comment +\/\/.\+$+ @@ -240,3 +242,18 @@ else Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' endif + +function! OnLoadWilder() + if &rtp =~ 'wilder' + " ++once supported in Nvim 0.4+ and Vim 8.1+ + " Also need to switch + autocmd CmdlineEnter * ++once call s:wilder_init() | call g:wilder#main#start() + + function! s:wilder_init() abort + call wilder#setup({'modes': [':', '/', '?']}) + call wilder#set_option('use_python_remote_plugin', 0) + endfunction + endif +endfunction + +autocmd! User wilder.nvim call OnLoadWilder()