From 3739bea50dbfa392199af6b4a7157611a561ceb5 Mon Sep 17 00:00:00 2001 From: Damien Dart Date: Sat, 3 Feb 2024 18:10:20 +0000 Subject: [PATCH] Improve handling of Vim E11 errors. Improve handling of Vim E11 errors when using the fuzzy finders. --- .vim/plugin/fuzzy-files.vim | 11 ++++++++++- .vim/plugin/fuzzy-grep.vim | 11 ++++++++++- .vim/plugin/fuzzy-snippets.vim | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.vim/plugin/fuzzy-files.vim b/.vim/plugin/fuzzy-files.vim index 33ea577..1770729 100644 --- a/.vim/plugin/fuzzy-files.vim +++ b/.vim/plugin/fuzzy-files.vim @@ -56,7 +56,16 @@ function! s:FuzzyFiles(abandon, ...) abort \ 'source': g:fuzzy_files_source_command, \ }, \ ) - call fzf#run(l:spec) + + try + call fzf#run(l:spec) + " Improve the appearance of some commonly-encountered errors. + catch /E11/ + echohl ErrorMsg + echom join(split(v:exception, ':')[1:2], ':') + echohl None + return + endtry endfunction function! s:FuzzyFilesHandler(abandon, lines) abort diff --git a/.vim/plugin/fuzzy-grep.vim b/.vim/plugin/fuzzy-grep.vim index 3e1ec39..4ee4856 100644 --- a/.vim/plugin/fuzzy-grep.vim +++ b/.vim/plugin/fuzzy-grep.vim @@ -55,7 +55,16 @@ function! s:FuzzyGrep(abandon, options, prompt_embellishment, ...) abort \ 'source': printf(g:fuzzy_grep_source_command, a:options, shellescape(l:query)), \ } \ ) - call fzf#run(l:spec) + + try + call fzf#run(l:spec) + " Improve the appearance of some commonly-encountered errors. + catch /E11/ + echohl ErrorMsg + echom join(split(v:exception, ':')[1:2], ':') + echohl None + return + endtry endfunction function! s:FuzzyGrepHandler(abandon, lines) abort diff --git a/.vim/plugin/fuzzy-snippets.vim b/.vim/plugin/fuzzy-snippets.vim index c64b6b7..e70c3c6 100644 --- a/.vim/plugin/fuzzy-snippets.vim +++ b/.vim/plugin/fuzzy-snippets.vim @@ -38,7 +38,16 @@ function! s:FuzzySnippets() abort \ 'source': g:fuzzy_snippets_source_command, \ } \ ) - call fzf#run(l:spec) + + try + call fzf#run(l:spec) + " Improve the appearance of some commonly-encountered errors. + catch /E11/ + echohl ErrorMsg + echom join(split(v:exception, ':')[1:2], ':') + echohl None + return + endtry endfunction function! s:FuzzySnippetsHandler(lines) abort