File: test-toggle-frac.vim

package info (click to toggle)
vim-vimtex 2.16-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,660 kB
  • sloc: makefile: 367; python: 103
file content (58 lines) | stat: -rw-r--r-- 2,350 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set nocompatible
set runtimepath^=../..
filetype plugin on


" tsf  /  Toggle surrounding fraction
for [s:in, s:out] in [
      \ ['$e^{a/b}$', '$e^{\frac{a}{b}}$'],
      \ ['$n^{1/2}$', '$n^{\frac{1}{2}}$'],
      \ ['$n^{-1/2}$', '$n^{-\frac{1}{2}}$'],
      \ ['$(0/q)$', '$(\frac{0}{q})$'],
      \ ['$\frac{x+1}{x-1}$', '$(x+1)/(x-1)$'],
      \ ['$\frac {x+1}  {x-1}$', '$(x+1)/(x-1)$'],
      \ ['$\frac {x-1} x$', '$(x-1)/x$'],
      \ ['$\frac x  {x-1}$', '$x/(x-1)$'],
      \ ['$x / (x-1)$', '$\frac{x}{x-1}$'],
      \ ['$(x-1) /x$', '$\frac{x-1}{x}$'],
      \ ['$(x+1)  /(x-1)$', '$\frac{x+1}{x-1}$'],
      \ ['$(x+1)/ (x-1)$', '$\frac{x+1}{x-1}$'],
      \ ['$\alpha/\mu$', '$\frac{\alpha}{\mu}$'],
      \ ['$\frac{\alpha}{\mu}$', '$\alpha/\mu$'],
      \ ['$(r+t)/((\mu))$', '$\frac{r+t}{(\mu)}$'],
      \ ['$((\mu))/(r+t)$', '$\frac{(\mu)}{r+t}$'],
      \ ['$\frac{\delta_{02}}{\delta_{02} + \delta_{01}}$',
      \  '$(\delta_{02})/(\delta_{02} + \delta_{01})$'],
      \ ['$(\delta_{02})/(\delta_{02} + \delta_{01})$',
      \  '$\frac{\delta_{02}}{\delta_{02} + \delta_{01}}$'],
      \ ['\(a/p_\text{b}\)', '\(\frac{a}{p_\text{b}}\)'],
      \ ['$f(x+y)/g(z)$', '$\frac{f(x+y)}{g(z)}$'],
      \ ['$f(x)g(y)/h(z)$', '$f(x)\frac{g(y)}{h(z)}$'],
      \ ['$\dfrac{x+1}{x-1}$', '$(x+1)/(x-1)$'],
      \]
  if s:in =~# '\/'
    call vimtex#test#keys('f/ltsf', s:in, s:out)
    call vimtex#test#keys('f/htsf', s:in, s:out)
  else
    call vimtex#test#keys('f{tsf', s:in, s:out)
  endif
endfor

" tsf  /  Toggle surrounding fraction (visual mode)
call vimtex#test#keys('f$lvf$htsf',
      \ 'testing $inline frac / something$ more text',
      \ 'testing $\frac{inline frac}{something}$ more text')
call vimtex#test#keys('f/bvf$htsf',
      \ 'testing $inline frac / something$ more text',
      \ 'testing $inline \frac{frac}{something}$ more text')
call vimtex#test#keys('f/bvtttsf',
      \ 'testing $inline frac / something$ more text',
      \ 'testing $inline \frac{frac}{some}thing$ more text')
call vimtex#test#keys('f(v$hhtsf',
      \ '$(\delta_{02})/(\delta_{02} + \delta_{01})$',
      \ '$\frac{\delta_{02}}{\delta_{02} + \delta_{01}}$')
call vimtex#test#keys('f\v$hhtsf',
      \ '$\frac{\delta_{02}}{\delta_{02} + \delta_{01}}$',
      \ '$(\delta_{02})/(\delta_{02} + \delta_{01})$')

call vimtex#test#finished()