Use robust operators

This commit is contained in:
Karl Yngve Lervåg 2015-04-05 20:36:41 +02:00
parent 41bbce7520
commit 8e537d80c1

View File

@ -88,7 +88,7 @@ function! vimtex#motion#find_matching_pair(...) " {{{1
let not_cursor = '\%(\%'. lnum . 'l\%' . cnum . 'c\)\@!' let not_cursor = '\%(\%'. lnum . 'l\%' . cnum . 'c\)\@!'
" Finally, find the matching delimiter " Finally, find the matching delimiter
if delim =~ '^\$' if delim =~# '^\$'
let inline = s:notcomment . s:notbslash . '\$' let inline = s:notcomment . s:notbslash . '\$'
let [lnum0, cnum0] = searchpos('.', 'nW') let [lnum0, cnum0] = searchpos('.', 'nW')
if lnum0 && vimtex#util#has_syntax('texMathZoneX', lnum0, cnum0) if lnum0 && vimtex#util#has_syntax('texMathZoneX', lnum0, cnum0)
@ -191,7 +191,7 @@ function! vimtex#motion#sel_environment(...) " {{{1
let [env, lnum, cnum, lnum2, cnum2] = vimtex#util#get_env(1) let [env, lnum, cnum, lnum2, cnum2] = vimtex#util#get_env(1)
call cursor(lnum, cnum) call cursor(lnum, cnum)
if inner if inner
if env =~ '^\' if env =~# '^\'
call search('\\.\_\s*\S', 'eW') call search('\\.\_\s*\S', 'eW')
else else
call search('}\(\_\s*\(\[\_[^]]*\]\|{\_\S\{-}}\)\)\?\_\s*\S', 'eW') call search('}\(\_\s*\(\[\_[^]]*\]\|{\_\S\{-}}\)\)\?\_\s*\S', 'eW')
@ -206,7 +206,7 @@ function! vimtex#motion#sel_environment(...) " {{{1
if inner if inner
call search('\S\_\s*', 'bW') call search('\S\_\s*', 'bW')
else else
if env =~ '^\' if env =~# '^\'
normal! l normal! l
else else
call search('}', 'eW') call search('}', 'eW')
@ -221,7 +221,7 @@ function! vimtex#motion#sel_inline_math(...) " {{{1
if vimtex#util#has_syntax('texMathZoneX') if vimtex#util#has_syntax('texMathZoneX')
call s:search_and_skip_comments(dollar_pat, 'cbW') call s:search_and_skip_comments(dollar_pat, 'cbW')
elseif getline('.')[col('.') - 1] == '$' elseif getline('.')[col('.') - 1] ==# '$'
call s:search_and_skip_comments(dollar_pat, 'bW') call s:search_and_skip_comments(dollar_pat, 'bW')
else else
return return
@ -303,7 +303,7 @@ function! s:highlight_matching_pair(...) " {{{1
return return
endif endif
if delim =~ '^\$' if delim =~# '^\$'
" "
" Match inline math " Match inline math
" "