Use script local variable instead of buffer local

This commit is contained in:
EinfachToll 2015-02-02 10:35:32 +01:00
parent 13e76aed2e
commit de11957fca
4 changed files with 7 additions and 15 deletions

View File

@ -768,10 +768,11 @@ function! s:process_tag_math(line, math) "{{{
let class = matchstr(a:line, '{{$\zs.*$') let class = matchstr(a:line, '{{$\zs.*$')
"FIXME class cannot be any string! "FIXME class cannot be any string!
let class = substitute(class, '\s\+$', '', 'g') let class = substitute(class, '\s\+$', '', 'g')
" Check the math placeholder (default: displaymath) " store the environment name in a global variable in order to close the
let b:vimwiki_mathEnv = matchstr(class, '^%\zs\S\+\ze%') " environment properly
if b:vimwiki_mathEnv != "" let s:current_math_env = matchstr(class, '^%\zs\S\+\ze%')
call add(lines, substitute(class, '^%\(\S\+\)%','\\begin{\1}', '')) if s:current_math_env != ""
call add(lines, substitute(class, '^%\(\S\+\)%','\\begin{\1}', ''))
elseif class != "" elseif class != ""
call add(lines, "\\\[".class) call add(lines, "\\\[".class)
else else
@ -781,8 +782,8 @@ function! s:process_tag_math(line, math) "{{{
let processed = 1 let processed = 1
elseif math[0] && a:line =~ '^\s*}}\$\s*$' elseif math[0] && a:line =~ '^\s*}}\$\s*$'
let math = [0, 0] let math = [0, 0]
if b:vimwiki_mathEnv != "" if s:current_math_env != ""
call add(lines, "\\end{".b:vimwiki_mathEnv."}") call add(lines, "\\end{".s:current_math_env."}")
else else
call add(lines, "\\\]") call add(lines, "\\\]")
endif endif

View File

@ -4,9 +4,6 @@
" Author: Maxim Kim <habamax@gmail.com> " Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/ " Home: http://code.google.com/p/vimwiki/
" placeholder for math environments
let b:vimwiki_mathEnv = ""
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
let g:vimwiki_char_eqin = '\$' let g:vimwiki_char_eqin = '\$'

View File

@ -4,9 +4,6 @@
" Author: Maxim Kim <habamax@gmail.com> " Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/ " Home: http://code.google.com/p/vimwiki/
" placeholder for math environments
let b:vimwiki_mathEnv = ""
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
let g:vimwiki_char_eqin = '\$' let g:vimwiki_char_eqin = '\$'

View File

@ -4,9 +4,6 @@
" Author: Maxim Kim <habamax@gmail.com> " Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/ " Home: http://code.google.com/p/vimwiki/
" placeholder for math environments
let b:vimwiki_mathEnv = ""
" text: $ equation_inline $ " text: $ equation_inline $
let g:vimwiki_rxEqIn = '\$[^$`]\+\$' let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
let g:vimwiki_char_eqin = '\$' let g:vimwiki_char_eqin = '\$'