<commit_before>" vimtex - LaTeX plugin for Vim
"
" Maintainer: <NAME>
" Email:      <EMAIL>
"

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 'edit' escape(self.name, ' ')

  let self.prev_winnr = bufwinnr(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 <silent><buffer> q     :call b:scratch.close()<cr>
  nnoremap <silent><buffer> <esc> :call b:scratch.close()<cr>

  if has_key(self, 'syntax')
    call self.syntax()
  endif

  if has_key(self, 'fill')
    call self.fill()
  endif
endfunction

" }}}1
function! s:scratch.close() abort dict " {{{1
  let self.fold_level = &l:foldlevel

  silent execute 'bwipeout' . bufnr(self.name)
endfunction

" }}}1
function! s:scratch.fill() abort dict " {{{1
  setlocal modifiable
  %delete<commit_msg>Fixed minor scratch (cf. #929)<commit_after>" vimtex - LaTeX plugin for Vim
"
" Maintainer: <NAME>
" Email:      <EMAIL>
"

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 <silent><buffer> q     :call b:scratch.close()<cr>
  nnoremap <silent><buffer> <esc> :call b:scratch.close()<cr>
  nnoremap <silent><buffer> <c-6> :call b:scratch.close()<cr>
  nnoremap <silent><buffer> <c-^> :call b:scratch.close()<cr>
  nnoremap <silent><buffer> <c-e> :call b:scratch.close()<cr>

  if has_key(self, 'syntax')
    call self.syntax()
  endif

  if has_key(self, 'fill')
    call self.fill()
  endif
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
{'fraction_non_alphanumeric': 0.1448529411764706, 'fraction_numerical': 0.008088235294117648, 'mean_word_length': 4.029574861367838, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7120228', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1072, 'n_words': 251}