Add tests for cse
This commit is contained in:
parent
2d816d7559
commit
1763cd3ae9
@ -91,7 +91,7 @@ function! vimtex#env#change_prompt(type) " {{{1
|
||||
call vimtex#echo#status(['Change surrounding environment: ',
|
||||
\ ['VimtexWarning', l:name]])
|
||||
echohl VimtexMsg
|
||||
let l:new_env = input('> ', '', 'customlist,' . s:sidwrap('input_complete'))
|
||||
let l:new_env = input('> ', '', 'customlist,vimtex#env#input_complete')
|
||||
echohl None
|
||||
if empty(l:new_env) | return | endif
|
||||
|
||||
@ -123,21 +123,7 @@ function! vimtex#env#is_inside(env) " {{{1
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:pos_prev(env) " {{{1
|
||||
return a:env.cnum > 1
|
||||
\ ? [0, a:env.lnum, a:env.cnum-1, 0]
|
||||
\ : [0, max([a:env.lnum-1, 1]), strlen(getline(a:env.lnum-1)), 0]
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:sidwrap(func) " {{{1
|
||||
return matchstr(expand('<sfile>'), '\zs<SNR>\d\+_\ze.*$') . a:func
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
function! s:input_complete(lead, cmdline, pos) " {{{1
|
||||
function! vimtex#env#input_complete(lead, cmdline, pos) " {{{1
|
||||
" Always include displaymath
|
||||
let l:cands = ['\[']
|
||||
|
||||
@ -157,4 +143,12 @@ endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:pos_prev(env) " {{{1
|
||||
return a:env.cnum > 1
|
||||
\ ? [0, a:env.lnum, a:env.cnum-1, 0]
|
||||
\ : [0, max([a:env.lnum-1, 1]), strlen(getline(a:env.lnum-1)), 0]
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
" vim: fdm=marker sw=2
|
||||
|
43
test/vader/env.vader
Normal file
43
test/vader/env.vader
Normal file
@ -0,0 +1,43 @@
|
||||
Before:
|
||||
set buftype=
|
||||
silent w!
|
||||
|
||||
After:
|
||||
set buftype=nofile
|
||||
silent call delete('[Vader-workbench]')
|
||||
|
||||
Given tex (Environments: foo and bar):
|
||||
\begin{foo}
|
||||
Foo
|
||||
\end{foo}
|
||||
|
||||
\begin{bar}
|
||||
Bar
|
||||
\end{bar}
|
||||
|
||||
Do (Change env: foo -> baz):
|
||||
csebaz\<cr>
|
||||
|
||||
Expect tex (Verify):
|
||||
\begin{baz}
|
||||
Foo
|
||||
\end{baz}
|
||||
|
||||
\begin{bar}
|
||||
Bar
|
||||
\end{bar}
|
||||
|
||||
Do (Change env: foo -> bar (with completion)):
|
||||
cse\<c-z>\<c-z>\<c-z>\<cr>
|
||||
|
||||
Expect tex (Verify):
|
||||
\begin{bar}
|
||||
Foo
|
||||
\end{bar}
|
||||
|
||||
\begin{bar}
|
||||
Bar
|
||||
\end{bar}
|
||||
|
||||
Before:
|
||||
After:
|
@ -4,4 +4,8 @@ let &rtp .= isdirectory('vader.vim') ? ',vader.vim' : ',../../../vader.vim'
|
||||
filetype plugin indent on
|
||||
syntax enable
|
||||
|
||||
" Personal settings to get consistent results
|
||||
set wildmode=longest:full,full
|
||||
set wildcharm=<c-z>
|
||||
|
||||
let g:tex_flavor = 'latex'
|
||||
|
Loading…
Reference in New Issue
Block a user