Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions compiler/vlty.vim
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,42 @@ if !exists('s:vlty.language')
\ 'prompt': 'Multiple spelllang languages detected, please select one:',
\ 'abort': v:false,
\})
let s:vlty.language = substitute(s:vlty.language, '_', '-', '')
endif

if !exists('s:list')
silent let s:list = split(
\ system(s:vlty_lt_command . ' --list NOFILE'),
\ '[[:space:]]')
endif
if !empty(s:list)
if match(s:list, '\c^' . s:vlty.language . '$') == -1
echohl WarningMsg
echomsg "Language '" . s:vlty.language . "'"
\ . " not listed in output of "
\ . s:vlty_lt_command . " --list!"
let s:vlty.language = matchstr(s:vlty.language, '\v^[^-]+')
echomsg "Trying '" . s:vlty.language . "' instead."
echohl None
if match(s:list, '\c^' . s:vlty.language . '$') == -1
echoerr "Language '" . s:vlty.language . "'"
\ . " not listed in output of "
\ . s:vlty_lt_command . " --list; trying anyway!"
endif
endif
endif

if !empty(s:vlty.language)
let s:vlty_language = ' --language ' . s:vlty.language
else
if empty(s:vlty.language)
echohl WarningMsg
echomsg 'Please set g:vimtex_grammar_vlty.language to enable more accurate'
echomsg 'checks by LanguageTool. Reverting to --autoDetect.'
echohl None
let s:vlty_language = ' --autoDetect'
else
let s:vlty.language = substitute(s:vlty.language, '_', '-', '')
let s:vlty_language = ' --language ' . s:vlty.language
if !exists('s:list')
silent let s:list = split(
\ system(s:vlty_lt_command . ' --list NOFILE'),
\ '[[:space:]]')
endif
if !empty(s:list)
if match(s:list, '\c^' . s:vlty.language . '$') == -1
echohl WarningMsg
echomsg "Language '" . s:vlty.language . "'"
\ . " not listed in output of the command "
\ . "'" . s:vlty_lt_command . " --list'! "
\ . "Please check its output!"
echohl None
if match(s:vlty.language, '-') != -1
let s:vlty.language = matchstr(s:vlty.language, '\v^[^-]+')
echohl WarningMsg
echomsg "Trying '" . s:vlty.language . "' instead."
echohl None
else
echohl WarningMsg
echomsg "Trying '" . s:vlty.language . "' anyway."
echohl None
endif
endif
endif
endif

let &l:makeprg =
Expand Down