diff --git a/autoload/vimtex.vim b/autoload/vimtex.vim index e293fef..8cfc270 100644 --- a/autoload/vimtex.vim +++ b/autoload/vimtex.vim @@ -177,9 +177,7 @@ if !exists('s:reloading_script') runtime indent/tex.vim endif - call vimtex#echo#formatted([ - \ 'vimtex: ', ['VimtexWarning', 'reloaded']]) - + call vimtex#echo#info('reloaded') unlet s:reloading_script endfunction endif diff --git a/autoload/vimtex/complete.vim b/autoload/vimtex/complete.vim index 2da9495..9ca600d 100644 --- a/autoload/vimtex/complete.vim +++ b/autoload/vimtex/complete.vim @@ -83,19 +83,19 @@ function! s:bib.init() dict " {{{2 " Check if bibtex is executable if !executable('bibtex') let self.enabled = 0 - call vimtex#echo#warning('vimtex warning') - call vimtex#echo#warning(' bibtex completion is not available!', 'None') - call vimtex#echo#warning(' bibtex is not executable', 'None') + call vimtex#echo#warning('bibtex is not executable') + call vimtex#echo#echo('- bibtex completion is not available!') + call vimtex#echo#wait() return endif " Check if kpsewhich is required and available if g:vimtex_complete_recursive_bib && !executable('kpsewhich') let self.enabled = 0 - call vimtex#echo#warning('vimtex warning') - call vimtex#echo#warning(' bibtex completion is not available!', 'None') - call vimtex#echo#warning(' recursive bib search requires kpsewhich', 'None') - call vimtex#echo#warning(' kpsewhich is not executable', 'None') + call vimtex#echo#warning('kpsewhich is not executable') + call vimtex#echo#echo('- recursive bib search requires kpsewhich!') + call vimtex#echo#echo('- bibtex completion is not available!') + call vimtex#echo#wait() endif " Check if bstfile contains whitespace (not handled by vimtex) diff --git a/autoload/vimtex/echo.vim b/autoload/vimtex/echo.vim index bbe0730..ffc4007 100644 --- a/autoload/vimtex/echo.vim +++ b/autoload/vimtex/echo.vim @@ -27,18 +27,22 @@ function! vimtex#echo#wait() " {{{1 echohl None endfunction -function! vimtex#echo#echo(message, ...) " {{{1 - let hl = len(a:000) > 0 ? a:0 : 'VimtexMsg' - execute 'echohl' hl +function! vimtex#echo#echo(message) " {{{1 + echohl VimtexMsg echo a:message echohl None endfunction -function! vimtex#echo#warning(message, ...) " {{{1 - let hl = len(a:000) > 0 ? a:0 : 'VimtexWarning' - execute 'echohl' hl - echomsg a:message - echohl None +function! vimtex#echo#warning(message) " {{{1 + call vimtex#echo#formatted([ + \ ['VimtexWarning', 'vimtex warning: '], + \ ['VimtexMsg', a:message]]) +endfunction + +function! vimtex#echo#info(message) " {{{1 + call vimtex#echo#formatted([ + \ ['VimtexInfo', 'vimtex: '], + \ ['VimtexMsg', a:message]]) endfunction function! vimtex#echo#formatted(parts) " {{{1 diff --git a/autoload/vimtex/fold.vim b/autoload/vimtex/fold.vim index 850632b..9f1d3f2 100644 --- a/autoload/vimtex/fold.vim +++ b/autoload/vimtex/fold.vim @@ -69,11 +69,9 @@ function! vimtex#fold#init_buffer() " {{{1 " Sanity check if g:vimtex_fold_documentclass && g:vimtex_fold_preamble - call vimtex#echo#formatted(['vimtex: ', - \ ['VimtexWarning', - \ 'Can''t fold both preamble and documentclass!']]) - call vimtex#echo#wait() let g:vimtex_fold_documentclass = 0 + call vimtex#echo#warning('Can''t fold both preamble and documentclass!') + call vimtex#echo#wait() endif " Set fold options diff --git a/autoload/vimtex/latexmk.vim b/autoload/vimtex/latexmk.vim index b4b34ae..0571909 100644 --- a/autoload/vimtex/latexmk.vim +++ b/autoload/vimtex/latexmk.vim @@ -57,11 +57,11 @@ function! vimtex#latexmk#init_buffer() " {{{1 if !g:vimtex_latexmk_enabled | return | endif " Check option validity - if g:vimtex_latexmk_callback && !has('clientserver') - call vimtex#echo#status(['vimtex: ', - \ ['VimtexWarning', - \ 'Can''t use callbacks without +clientserver']]) + if g:vimtex_latexmk_callback + \ && !(has('clientserver') || has('nvim')) let g:vimtex_latexmk_callback = 0 + call vimtex#echo#warning('Can''t use callbacks without +clientserver') + call vimtex#echo#wait() endif " Set compiler (this defines the errorformat) @@ -632,11 +632,11 @@ function! s:check_system_compatibility() " {{{1 " Disable latexmk if required programs are missing " if len(missing) > 0 - call vimtex#echo#warning('vimtex warning: ') - call vimtex#echo#warning(' vimtex#latexmk was not initialized', 'None') for cmd in missing - call vimtex#echo#warning(' ' . cmd . ' is not executable', 'None') + call vimtex#echo#warning(cmd . ' is not executable') endfor + call vimtex#echo#echo('- vimtex#latexmk was not initialized!') + call vimtex#echo#wait() let g:vimtex_latexmk_enabled = 0 endif endfunction diff --git a/autoload/vimtex/view.vim b/autoload/vimtex/view.vim index 7f36561..bf8ea24 100644 --- a/autoload/vimtex/view.vim +++ b/autoload/vimtex/view.vim @@ -161,7 +161,7 @@ function! s:mupdf.init() dict " {{{2 endif if !executable('xdotool') - call vimtex#echo#warning('vimtex viewer MuPDF requires xdotool!') + call vimtex#echo#warning('viewer MuPDF requires xdotool!') endif let self.class = 'MuPDF' @@ -240,7 +240,7 @@ function! s:mupdf.reverse_search() dict " {{{2 if !self.xwin_exists() call vimtex#echo#warning( - \ 'vimtex reverse search failed (is MuPDF open?)') + \ 'reverse search failed (is MuPDF open?)') return endif @@ -315,7 +315,7 @@ function! s:zathura.init() dict " {{{2 endif if !executable('xdotool') - call vimtex#echo#warning('vimtex viewer Zathura requires xdotool!') + call vimtex#echo#warning('viewer Zathura requires xdotool!') endif let self.class = 'Zathura' @@ -402,7 +402,7 @@ endfunction " function! s:output_not_readable(output) " {{{1 if !filereadable(a:output) - call vimtex#echo#warning('vimtex viewer can not read PDF file!') + call vimtex#echo#warning('viewer can not read PDF file!') return 1 else return 0 @@ -424,7 +424,7 @@ function! s:xwin_get_id() dict " {{{1 let xwin_ids = split(system(cmd), '\n') if len(xwin_ids) == 0 call vimtex#echo#warning( - \ 'vimtex viewer can not find ' . self.class . ' window ID!') + \ 'viewer can not find ' . self.class . ' window ID!') let self.xwin_id = 0 else let self.xwin_id = xwin_ids[-1]