Updated messages and warnings

Also fixed clientserver detection for neovim (i.e. use
has('nvim')), cf. #262.
This commit is contained in:
Karl Yngve Lervåg 2016-07-12 22:07:17 +02:00
parent 9a545b4038
commit 9207c40d8a
6 changed files with 34 additions and 34 deletions

View File

@ -177,9 +177,7 @@ if !exists('s:reloading_script')
runtime indent/tex.vim runtime indent/tex.vim
endif endif
call vimtex#echo#formatted([ call vimtex#echo#info('reloaded')
\ 'vimtex: ', ['VimtexWarning', 'reloaded']])
unlet s:reloading_script unlet s:reloading_script
endfunction endfunction
endif endif

View File

@ -83,19 +83,19 @@ function! s:bib.init() dict " {{{2
" Check if bibtex is executable " Check if bibtex is executable
if !executable('bibtex') if !executable('bibtex')
let self.enabled = 0 let self.enabled = 0
call vimtex#echo#warning('vimtex warning') call vimtex#echo#warning('bibtex is not executable')
call vimtex#echo#warning(' bibtex completion is not available!', 'None') call vimtex#echo#echo('- bibtex completion is not available!')
call vimtex#echo#warning(' bibtex is not executable', 'None') call vimtex#echo#wait()
return return
endif endif
" Check if kpsewhich is required and available " Check if kpsewhich is required and available
if g:vimtex_complete_recursive_bib && !executable('kpsewhich') if g:vimtex_complete_recursive_bib && !executable('kpsewhich')
let self.enabled = 0 let self.enabled = 0
call vimtex#echo#warning('vimtex warning') call vimtex#echo#warning('kpsewhich is not executable')
call vimtex#echo#warning(' bibtex completion is not available!', 'None') call vimtex#echo#echo('- recursive bib search requires kpsewhich!')
call vimtex#echo#warning(' recursive bib search requires kpsewhich', 'None') call vimtex#echo#echo('- bibtex completion is not available!')
call vimtex#echo#warning(' kpsewhich is not executable', 'None') call vimtex#echo#wait()
endif endif
" Check if bstfile contains whitespace (not handled by vimtex) " Check if bstfile contains whitespace (not handled by vimtex)

View File

@ -27,18 +27,22 @@ function! vimtex#echo#wait() " {{{1
echohl None echohl None
endfunction endfunction
function! vimtex#echo#echo(message, ...) " {{{1 function! vimtex#echo#echo(message) " {{{1
let hl = len(a:000) > 0 ? a:0 : 'VimtexMsg' echohl VimtexMsg
execute 'echohl' hl
echo a:message echo a:message
echohl None echohl None
endfunction endfunction
function! vimtex#echo#warning(message, ...) " {{{1 function! vimtex#echo#warning(message) " {{{1
let hl = len(a:000) > 0 ? a:0 : 'VimtexWarning' call vimtex#echo#formatted([
execute 'echohl' hl \ ['VimtexWarning', 'vimtex warning: '],
echomsg a:message \ ['VimtexMsg', a:message]])
echohl None endfunction
function! vimtex#echo#info(message) " {{{1
call vimtex#echo#formatted([
\ ['VimtexInfo', 'vimtex: '],
\ ['VimtexMsg', a:message]])
endfunction endfunction
function! vimtex#echo#formatted(parts) " {{{1 function! vimtex#echo#formatted(parts) " {{{1

View File

@ -69,11 +69,9 @@ function! vimtex#fold#init_buffer() " {{{1
" Sanity check " Sanity check
if g:vimtex_fold_documentclass && g:vimtex_fold_preamble 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 let g:vimtex_fold_documentclass = 0
call vimtex#echo#warning('Can''t fold both preamble and documentclass!')
call vimtex#echo#wait()
endif endif
" Set fold options " Set fold options

View File

@ -57,11 +57,11 @@ function! vimtex#latexmk#init_buffer() " {{{1
if !g:vimtex_latexmk_enabled | return | endif if !g:vimtex_latexmk_enabled | return | endif
" Check option validity " Check option validity
if g:vimtex_latexmk_callback && !has('clientserver') if g:vimtex_latexmk_callback
call vimtex#echo#status(['vimtex: ', \ && !(has('clientserver') || has('nvim'))
\ ['VimtexWarning',
\ 'Can''t use callbacks without +clientserver']])
let g:vimtex_latexmk_callback = 0 let g:vimtex_latexmk_callback = 0
call vimtex#echo#warning('Can''t use callbacks without +clientserver')
call vimtex#echo#wait()
endif endif
" Set compiler (this defines the errorformat) " Set compiler (this defines the errorformat)
@ -632,11 +632,11 @@ function! s:check_system_compatibility() " {{{1
" Disable latexmk if required programs are missing " Disable latexmk if required programs are missing
" "
if len(missing) > 0 if len(missing) > 0
call vimtex#echo#warning('vimtex warning: ')
call vimtex#echo#warning(' vimtex#latexmk was not initialized', 'None')
for cmd in missing for cmd in missing
call vimtex#echo#warning(' ' . cmd . ' is not executable', 'None') call vimtex#echo#warning(cmd . ' is not executable')
endfor endfor
call vimtex#echo#echo('- vimtex#latexmk was not initialized!')
call vimtex#echo#wait()
let g:vimtex_latexmk_enabled = 0 let g:vimtex_latexmk_enabled = 0
endif endif
endfunction endfunction

View File

@ -161,7 +161,7 @@ function! s:mupdf.init() dict " {{{2
endif endif
if !executable('xdotool') if !executable('xdotool')
call vimtex#echo#warning('vimtex viewer MuPDF requires xdotool!') call vimtex#echo#warning('viewer MuPDF requires xdotool!')
endif endif
let self.class = 'MuPDF' let self.class = 'MuPDF'
@ -240,7 +240,7 @@ function! s:mupdf.reverse_search() dict " {{{2
if !self.xwin_exists() if !self.xwin_exists()
call vimtex#echo#warning( call vimtex#echo#warning(
\ 'vimtex reverse search failed (is MuPDF open?)') \ 'reverse search failed (is MuPDF open?)')
return return
endif endif
@ -315,7 +315,7 @@ function! s:zathura.init() dict " {{{2
endif endif
if !executable('xdotool') if !executable('xdotool')
call vimtex#echo#warning('vimtex viewer Zathura requires xdotool!') call vimtex#echo#warning('viewer Zathura requires xdotool!')
endif endif
let self.class = 'Zathura' let self.class = 'Zathura'
@ -402,7 +402,7 @@ endfunction
" "
function! s:output_not_readable(output) " {{{1 function! s:output_not_readable(output) " {{{1
if !filereadable(a:output) 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 return 1
else else
return 0 return 0
@ -424,7 +424,7 @@ function! s:xwin_get_id() dict " {{{1
let xwin_ids = split(system(cmd), '\n') let xwin_ids = split(system(cmd), '\n')
if len(xwin_ids) == 0 if len(xwin_ids) == 0
call vimtex#echo#warning( 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 let self.xwin_id = 0
else else
let self.xwin_id = xwin_ids[-1] let self.xwin_id = xwin_ids[-1]