From d757bfd643cc73c2d495355c153ed0257f5d5b47 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 25 Apr 2020 21:30:46 +0200 Subject: Change latex provider to luatex, closes #476 --- autoload/vimtex/scratch.vim | 72 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 autoload/vimtex/scratch.vim (limited to 'autoload/vimtex/scratch.vim') diff --git a/autoload/vimtex/scratch.vim b/autoload/vimtex/scratch.vim new file mode 100644 index 00000000..299cc0ee --- /dev/null +++ b/autoload/vimtex/scratch.vim @@ -0,0 +1,72 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1 + +" vimtex - LaTeX plugin for Vim +" +" Maintainer: Karl Yngve LervÄg +" Email: karl.yngve@gmail.com +" + +function! vimtex#scratch#new(opts) abort " {{{1 + let l:buf = extend(deepcopy(s:scratch), a:opts) + call l:buf.open() +endfunction + +" }}}1 + + +let s:scratch = { + \ 'name' : 'VimtexScratch' + \} +function! s:scratch.open() abort dict " {{{1 + let l:bufnr = bufnr('') + let l:vimtex = get(b:, 'vimtex', {}) + + silent execute 'keepalt edit' escape(self.name, ' ') + + let self.prev_bufnr = l:bufnr + let b:scratch = self + let b:vimtex = l:vimtex + + setlocal bufhidden=wipe + setlocal buftype=nofile + setlocal concealcursor=nvic + setlocal conceallevel=0 + setlocal nobuflisted + setlocal nolist + setlocal nospell + setlocal noswapfile + setlocal nowrap + setlocal tabstop=8 + + nnoremap q :call b:scratch.close() + nnoremap :call b:scratch.close() + nnoremap :call b:scratch.close() + nnoremap :call b:scratch.close() + nnoremap :call b:scratch.close() + + if has_key(self, 'syntax') + call self.syntax() + endif + + call self.fill() +endfunction + +" }}}1 +function! s:scratch.close() abort dict " {{{1 + silent execute 'keepalt buffer' self.prev_bufnr +endfunction + +" }}}1 +function! s:scratch.fill() abort dict " {{{1 + setlocal modifiable + %delete + + call self.print_content() + + 0delete _ + setlocal nomodifiable +endfunction + +" }}}1 + +endif -- cgit v1.2.3