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
endif
call vimtex#echo#formatted([
\ 'vimtex: ', ['VimtexWarning', 'reloaded']])
call vimtex#echo#info('reloaded')
unlet s:reloading_script
endfunction
endif

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]