Please find my minimal vimrc (whatever I use for Latex compilation)
"General "{{{
set nocompatible " because vim is not vi
"set autowrite " write on shell commands
"set autoread " read on change outside vim
set spell spl=en_us " Set Spell
set omnifunc=syntaxcomplete#Complete
set tags=tags;/
syntax enable
" let mapleader=","
"}}}
set encoding=utf8
""}}}
" VimPlug {{{
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'dense-analysis/ale'
Plug 'vim-latex/vim-latex' , {'for': 'tex'} "
Plug 'neoclide/coc.nvim' , {'branch':'release'}
Plug 'skywind3000/asyncrun.vim'
call plug#end()
filetype plugin indent on
"}}}
"LaTeX {{{2
augroup FT_LaTex
autocmd BufReadPost *.tex setlocal filetype=tex
au FileType tex let b:ale_linters = ['texlab']
au filetype tex let b:ale_fixers = ['latexindent', 'remove_trailing_lines', 'trim_whitespace']
let g:tex_flavor = 'latex'
let g:Tex_CustomTemplateDirectory='/home/rudra/Templates/Latex'
" let g:Tex_DefaultTargetFormat = 'pdf'
" let g:Tex_ViewRule_pdf = 'evince_dbus.py'
" let g:Tex_Debug = 1
" let g:Tex_DebugLog = '/tmp/vim-latex-suite.log'
let g:Tex_FoldedMisc = 'preamble,<<<'
au FileType tex inoremap "" ``"<++><esc>4hi
au FileType bib inoremap "" ""<++><esc>4hi
au FileType tex inoremap <<< %<<<
au VimLeavePre *.tex exe "! latexmk -c"
au filetype tex syntax region texZone start='\\begin{minted}' end='\\end{minted}'
augroup END
"}}}2
" LANGUAGE SERVER {{{
if match (&runtimepath, "coc.nvim") !=-1
let g:coc_start_at_startup = 0
augroup coc
autocmd!
autocmd VimEnter * :silent CocStart
augroup end
let g:coc_user_config = {
\ 'languageserver': {
\ 'latex': {
\ 'command': '/home/rudra/.local/bin/texlab',
\ 'ignoredRootPaths':['~'],
\ 'filetypes': ['tex', 'bib', 'plaintex', 'context'],
\ }
\ }
\ }
else
echom ('install coc.nvim')
endif
" ALE {{{
let g:ale_sign_error = 'EE'
let g:ale_sign_warning = 'ww'
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_fix_on_save = 1
" let g:ale_fixers = ['remove_trailing_lines', 'trim_whitespace']
" }}}
" AsyncRun {{{
" Quick run via <F10>
nnoremap <F10> :call <SID>compile_and_run()<CR><Esc>
inoremap <buffer> <F10> <Esc> :call <SID>compile_and_run()<CR><Esc>
function! s:compile_and_run()
exec 'w'
if &filetype == 'tex'
exec "AsyncRun! latexmk -pdflua -pvc --synctex=1 -shell-escape %"
elseif &filetype == 'sh'
exec "AsyncRun! time bash %"
endif
endfunction
let g:asyncrun_open = 15
"}}}
And a mwe.tex:
\documentclass[10pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{minipage}[t]{.25\textwidth}\vspace{0pt}
\includegraphics[width=\textwidth]{example-image-a}
\end{minipage}
\begin{minipage}[t]{.75\textwidth}\vspace{0pt}
Hello World
\end{minipage}
\thisiserror
\small{
\begin{tabular}[h]{|p{.35\textwidth}|p{.08\textwidth}|p{.25\textwidth}|}\hline
Hello & World & \makebox[\linewidth][s]{\spaceout{0123456789}} \\\hline
\end{tabular}
}
\end{document}
The problem is, when I run from terminal, I get the error very neat and clean as:
! Undefined control sequence.
l.10 \thisiserror
?
! Undefined control sequence.
<argument> \spaceout
{0123456789}
l.13 ...akebox[\linewidth][s]{\spaceout{0123456789}}
\\\hline
?
But if I am compiling inside vim as
exec "AsyncRun! latexmk -pdflua -pvc --synctex=1 -shell-escape %"
in quickfix, I get not so helpful output:
mwe.tex|| Undefined control sequence.
mwe.tex|| Emergency stop.
mwe.tex|| ==> Fatal error occurred, no output PDF file produced!
If I add
au filetype tex set errorformat=%f:%l:%c:%m
in augroup FT_Latex
, I am getting complete compilation, and not the error only.
What I can do?
Also, how I can check all the errorformat active in my vim.
The format I am looking for is: line no: Error