From 22ccf5861397dd2365756c24ce1952736632cd8c Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 2 Nov 2017 20:29:48 +0100 Subject: [PATCH] Add covenience function for warnings --- autoload/startify.vim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 2d652cc..13eeb13 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -98,9 +98,7 @@ function! startify#insane_in_the_membrane() abort endif if empty(v:oldfiles) - echohl WarningMsg - echomsg "startify: Can't read viminfo file. Read :help startify-faq-02" - echohl NONE + call s:warn("startify: Can't read viminfo file. Read :help startify-faq-02") endif let b:startify.section_header_lines = [] @@ -396,7 +394,7 @@ function! startify#debug() echomsg '['. k .'] = '. string(b:startify.entries[k]) endfor else - echomsg 'This is no Startify buffer!' + call s:warn('This is no Startify buffer!') endif endfunction @@ -693,9 +691,7 @@ function! s:is_in_skiplist(arg) abort return 1 endif catch - echohl WarningMsg - echomsg 'startify: Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist' - echohl NONE + call s:warn('startify: Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist') endtry endfor endfunction @@ -945,3 +941,10 @@ function s:transform(absolute_path) endfor return '' endfunction + +" Function: s:warn {{{1 +function! s:warn(msg) abort + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction