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,14 @@
MYVIM ?= nvim --clean --headless
INMAKE := 1
export INMAKE
TESTS := $(wildcard test*.vim)
TESTS := $(TESTS:.vim=)
.PHONY: default $(TESTS)
default: $(TESTS)
$(TESTS):
@$(MYVIM) -u $@.vim

View File

@@ -0,0 +1 @@
% do nothing

View File

@@ -0,0 +1,7 @@
\documentclass{minimal}
\input{included}
\begin{document}
Hello World!
\end{document}

View File

@@ -0,0 +1,36 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
function! TestBuildDir(expected) abort
silent edit test.tex
let l:build_dir = vimtex#paths#shorten_relative(
\ fnamemodify(b:vimtex.get_aux_file('dummy', 1), ':h'))
call assert_equal(a:expected, l:build_dir)
bwipeout
endfunction
call TestBuildDir('')
let g:vimtex_compiler_latexmk = {'build_dir': 'out'}
call TestBuildDir('out')
let $VIMTEX_OUTPUT_DIRECTORY = 'out'
call TestBuildDir('out')
call assert_true(empty(vimtex#log#get()))
let $VIMTEX_OUTPUT_DIRECTORY = 'build'
call TestBuildDir('build')
let s:warning = get(map(vimtex#log#get(), {_, x -> x.msg[0]}), 0, 'NONE')
call assert_equal(
\ 'Setting VIMTEX_OUTPUT_DIRECTORY overrides build_dir!',
\ s:warning)
let $VIMTEX_OUTPUT_DIRECTORY = ''
call TestBuildDir('out')
call vimtex#test#finished()

View File

@@ -0,0 +1,56 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
set hidden
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
if empty($INMAKE) | finish | endif
silent edit minimal.tex
call assert_equal(len(vimtex#state#list_all()), 1)
silent edit new1.tex
call assert_equal(len(vimtex#state#list_all()), 2)
silent edit new2.tex
call assert_equal(len(vimtex#state#list_all()), 3)
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 2)
" Don't clean the state unless it is wiped
silent bdelete
call assert_equal(len(vimtex#state#list_all()), 2)
silent 2bwipeout
call assert_equal(len(vimtex#state#list_all()), 1)
" Reload file with 'edit' should not clean states
silent edit
call assert_equal(len(vimtex#state#list_all()), 1)
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 0)
" Open included file should create two states (main and included)
call assert_equal(len(vimtex#state#list_all()), 0)
silent edit included.tex
call assert_equal(len(vimtex#state#list_all()), 2)
" Simple test of VimtexEventQuit
let g:test = 0
augroup Testing
autocmd!
autocmd User VimtexEventQuit let g:test += 1
augroup END
" Wiping the buffer when main state is active should wipe all states
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 0)
call assert_equal(g:test, 2)
call vimtex#test#finished()

View File

@@ -0,0 +1,28 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
set noswapfile
set nomore
nnoremap q :qall!<cr>
if empty($INMAKE) | finish | endif
let g:test = 0
augroup Testing
autocmd!
autocmd User VimtexEventQuit let g:test += 1
augroup END
silent edit included.tex
" 'hidden' is not set, so quitting should not wipe any states
normal! GOtest
try
silent quit
catch /E37/
endtry
call assert_equal(g:test, 0)
call vimtex#test#finished()

View File

@@ -0,0 +1,54 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
if empty($INMAKE) | finish | endif
silent edit minimal.tex
call assert_equal(len(vimtex#state#list_all()), 1)
silent edit new1.tex
call assert_equal(len(vimtex#state#list_all()), 2)
silent edit new2.tex
call assert_equal(len(vimtex#state#list_all()), 3)
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 2)
" Don't clean the state unless it is wiped
silent bdelete
call assert_equal(len(vimtex#state#list_all()), 2)
silent 2bwipeout
call assert_equal(len(vimtex#state#list_all()), 1)
" Reload file with 'edit' should not clean states
silent edit
call assert_equal(len(vimtex#state#list_all()), 1)
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 0)
" Open included file should create two states (main and included)
call assert_equal(len(vimtex#state#list_all()), 0)
silent edit included.tex
call assert_equal(len(vimtex#state#list_all()), 2)
" Simple test of VimtexEventQuit
let g:test = 0
augroup Testing
autocmd!
autocmd User VimtexEventQuit let g:test += 1
augroup END
" Wiping the buffer when main state is active should wipe all states
silent bwipeout
call assert_equal(len(vimtex#state#list_all()), 0)
call assert_equal(g:test, 2)
call vimtex#test#finished()

View File

@@ -0,0 +1,14 @@
% Leading comments here
% Leading comments here
\documentclass[
12pt, % 12 pt font
a4paper, % A4 paper
twoside, % two-side layout
]{article}
\begin{document}
Hello, world!
\end{document}

View File

@@ -0,0 +1,15 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
silent edit test_parse_documentclass.tex
if empty($INMAKE) | finish | endif
call assert_equal('article', b:vimtex.documentclass)
call vimtex#test#finished()

View File

@@ -0,0 +1,8 @@
%% Minimal LaTeX Class
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{simplec}[2019/02/13 v3.14159 simple]
\LoadClass[a4paper]{article}
\RequirePackage{simplep}

View File

@@ -0,0 +1,19 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
set hidden
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
if empty($INMAKE) | finish | endif
silent edit test_reload.cls
call assert_equal(len(vimtex#state#list_all()), 1)
silent VimtexReload
call assert_equal(len(vimtex#state#list_all()), 1)
call vimtex#test#finished()

View File

@@ -0,0 +1,26 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
if empty($INMAKE) | finish | endif
silent edit minimal.tex
call assert_equal(len(vimtex#state#list_all()), 1)
bwipeout
call assert_equal(len(vimtex#state#list_all()), 0)
silent edit minimal.tex
call assert_equal(len(vimtex#state#list_all()), 1)
bdelete
call assert_equal(len(vimtex#state#list_all()), 1)
silent edit minimal.tex
call assert_equal(len(vimtex#state#list_all()), 1)
call vimtex#test#finished()

View File

@@ -0,0 +1,38 @@
set nocompatible
let &rtp = '../..,' . &rtp
filetype plugin on
nnoremap q :qall!<cr>
call vimtex#log#set_silent()
if empty($INMAKE) | finish | endif
" Open included file should create two states (main and included)
call assert_equal(len(vimtex#state#list_all()), 0)
silent edit included.tex
call assert_equal(len(vimtex#state#list_all()), 2)
" If we toggle to the included state then wipe it, we should not cleanup the
" main state
VimtexToggleMain
bwipeout
call assert_equal(len(vimtex#state#list_all()), 1)
"
" The main state should be cleaned up when we exit, though!
"
let g:test = 0
augroup Testing
autocmd!
autocmd User VimtexEventQuit let g:test += 1
augroup END
function! Finalize() abort
call assert_equal(g:test, 1)
call vimtex#test#finished()
endfunction
autocmd Testing VimLeave * call Finalize()
quitall!