I broke up with neovim....vim is my best friend now

This commit is contained in:
LinlyBoi
2023-04-30 08:14:07 +03:00
parent 0d185449c5
commit 4a4a6b1e81
5245 changed files with 468325 additions and 25 deletions

View File

@@ -0,0 +1,27 @@
MYVIM ?= nvim --clean --headless
INMAKE := 1
export INMAKE
TESTS := $(wildcard test*.vim)
TESTS := $(filter-out test-backend,$(TESTS:.vim=))
.PHONY: test $(TESTS)
test: test-backend $(TESTS)
$(TESTS):
@$(MYVIM) -u $@.vim
test-backend: latexrun
@PATH=$$PATH:. chronic $(MYVIM) -u $@.vim
@rm -f minimal.*
@rm -f pdflatex*.fls
@rm -f .latexrun.db.lock
@rm -rf out
latexrun:
@wget \
https://raw.githubusercontent.com/aclements/latexrun/master/latexrun \
>/dev/null 2>&1
@chmod u+x latexrun

View File

@@ -0,0 +1,107 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
set nomore
let g:vimtex_view_automatic = 0
let g:vimtex_log_verbose = 0
function! RunTests(comp, list_opts)
if !executable(a:comp)
echo 'Warning! "' . a:comp . '" was not executable!'
echo "Compiler tests could not run!\n\n"
cquit
endif
let g:vimtex_compiler_method = a:comp
for l:opts in a:list_opts
let g:vimtex_compiler_{a:comp} = l:opts
" Ensure there is no latexmk process before we start the test
if a:comp ==# 'latexmk'
call system('pkill -f latexmk')
endif
echo 'Testing compiler "' . a:comp . '"'
if !empty(l:opts)
echon ' with options:'
for [l:key, l:val] in items(l:opts)
echo '* ' . l:key . ' =' l:val . "\n"
endfor
endif
for l:file in glob('minimal.*', 1, 1)
call delete(l:file)
endfor
call writefile([
\ '\documentclass{minimal}',
\ '\begin{document}',
\ 'Hello World!',
\ '\end{document}',
\], 'minimal.tex')
silent edit minimal.tex
" Check if the compiler was loaded
if !has_key(b:vimtex, 'compiler')
echo "Compiler failed to load!\n"
cquit
endif
silent call vimtex#compiler#compile()
sleep 650m
" Check if continuous mode is active
if get(b:vimtex.compiler, 'continuous')
if !b:vimtex.compiler.get_pid()
echo "Could not get PID for compiler\n"
cquit
endif
silent call vimtex#compiler#stop()
else
sleep 450m
endif
" Check that the PDF has been built
if empty(b:vimtex.out())
echo "PDF was not built properly\n"
cquit
endif
silent call vimtex#compiler#clean(1)
sleep 650m
if !empty(b:vimtex.out()) || !empty(b:vimtex.get_aux_file('aux'))
echo "VimtexClean failed!\n"
cquit
endif
if !empty(get(l:opts, 'build_dir', ''))
call delete(l:opts.build_dir, 'rf')
endif
echo "\n"
bwipeout
endfor
endfunction
for [s:comp, s:opts] in items({
\ 'latexmk' : [
\ {},
\ {'build_dir' : 'out'},
\ {'callback' : 0},
\ {'callback' : 0, 'continuous' : 0},
\ {'continuous' : 0},
\ ],
\ 'latexrun' : [
\ {},
\ {'build_dir' : 'out'},
\ ],
\})
call RunTests(s:comp, s:opts)
endfor
quitall!

View File

@@ -0,0 +1,4 @@
\documentclass{minimal}
\begin{document}
Hello World! \failed
\end{document}

View File

@@ -0,0 +1,33 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
let g:status = 0
nnoremap q :qall!<cr>
let g:vimtex_compiler_latexmk = {'build_dir': 'build'}
call vimtex#log#set_silent()
augroup test_builddir
autocmd!
autocmd User VimtexEventCompileSuccess let g:status = 1
autocmd User VimtexEventCompileFailed let g:status = 2
augroup END
silent edit test-builddir.tex
if empty($INMAKE) | finish | endif
silent VimtexCompileSS
let s:n = 0
while g:status < 1 && s:n < 100
sleep 20m
let s:n += 1
endwhile
call assert_equal(2, g:status)
silent VimtexClean!
call vimtex#test#finished()