Add covenience function for warnings

This commit is contained in:
Marco Hinz 2017-11-02 20:29:48 +01:00
parent 0c23b67dbf
commit 22ccf58613
No known key found for this signature in database
GPG key ID: 1C980A1B657B4A4F

View file

@ -98,9 +98,7 @@ function! startify#insane_in_the_membrane() abort
endif endif
if empty(v:oldfiles) if empty(v:oldfiles)
echohl WarningMsg call s:warn("startify: Can't read viminfo file. Read :help startify-faq-02")
echomsg "startify: Can't read viminfo file. Read :help startify-faq-02"
echohl NONE
endif endif
let b:startify.section_header_lines = [] let b:startify.section_header_lines = []
@ -396,7 +394,7 @@ function! startify#debug()
echomsg '['. k .'] = '. string(b:startify.entries[k]) echomsg '['. k .'] = '. string(b:startify.entries[k])
endfor endfor
else else
echomsg 'This is no Startify buffer!' call s:warn('This is no Startify buffer!')
endif endif
endfunction endfunction
@ -693,9 +691,7 @@ function! s:is_in_skiplist(arg) abort
return 1 return 1
endif endif
catch catch
echohl WarningMsg call s:warn('startify: Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist')
echomsg 'startify: Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist'
echohl NONE
endtry endtry
endfor endfor
endfunction endfunction
@ -945,3 +941,10 @@ function s:transform(absolute_path)
endfor endfor
return '' return ''
endfunction endfunction
" Function: s:warn {{{1
function! s:warn(msg) abort
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction