From a957ecefdf6f3cf25e535baac88ec52f3ee86e24 Mon Sep 17 00:00:00 2001 From: Jay Mueller Date: Wed, 23 Sep 2020 15:01:58 -0500 Subject: [PATCH] Improve error reporting * Replace echoerr with an error function. echoerr adds quite a bit of noise. --- plugin/fswitch.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin/fswitch.vim b/plugin/fswitch.vim index a0396c8..8d3958f 100755 --- a/plugin/fswitch.vim +++ b/plugin/fswitch.vim @@ -19,8 +19,14 @@ if exists("g:disable_fswitch") finish endif +function! s:FSError(msg) abort + echohl ErrorMsg + echomsg a:msg + echohl None +endfunction + if v:version < 700 - echoerr "FSwitch requires Vim 7.0 or higher." + call s:FSError("FSwitch requires Vim 7.0 or higher.") finish endif @@ -323,10 +329,10 @@ function! FSwitch(filename, precmd) execute 'edit ' . s:fname endif else - echoerr "Alternate has evaluated to nothing. See :h fswitch-empty for more info." + call s:FSError("Alternate has evaluated to nothing. See :h fswitch-empty for more info.") endif else - echoerr "No alternate file found. 'fsnonewfiles' is set which denies creation." + call s:FSError("No alternate file found.") endif endfunction