Some nice improvements
This commit is contained in:
parent
374e983d09
commit
a56d48dc53
@ -5,10 +5,8 @@ function! latex#change#init(initialized)
|
||||
|
||||
nnoremap <silent><buffer> cse :call latex#change#env_prompt()<cr>
|
||||
|
||||
nnoremap <silent><buffer> tse :call latex#change#env_toggle_star()<cr>
|
||||
|
||||
nnoremap <silent><buffer> tsl :call latex#change#delim_toggle()<cr>
|
||||
nnoremap <silent><buffer> tsr :call latex#change#delim_toggle()<cr>
|
||||
nnoremap <silent><buffer> tse :call latex#change#toggle_env_star()<cr>
|
||||
nnoremap <silent><buffer> tsd :call latex#change#toggle_delim()<cr>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -24,40 +22,6 @@ function! latex#change#delim(open, close)
|
||||
call setline(l2, line)
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#change#delim_toggle
|
||||
function! latex#change#delim_toggle()
|
||||
"
|
||||
" Toggle \left and \right variants of delimiters
|
||||
"
|
||||
let [d1, l1, c1, d2, l2, c2] = latex#util#get_delim()
|
||||
|
||||
if d1 =~ 'left'
|
||||
let newd1 = substitute(d1, '\\left', '', '')
|
||||
let newd2 = substitute(d2, '\\right', '', '')
|
||||
elseif d1 !~ '\cbigg\?'
|
||||
let newd1 = '\left' . d1
|
||||
let newd2 = '\right' . d2
|
||||
else
|
||||
return
|
||||
endif
|
||||
|
||||
let line = getline(l1)
|
||||
let line = strpart(line, 0, c1 - 1) . newd1 . strpart(line, c1 + len(d1) - 1)
|
||||
call setline(l1, line)
|
||||
|
||||
if l1 == l2
|
||||
let n = len(newd1) - len(d1)
|
||||
let c2 += n
|
||||
let pos = getpos('.')
|
||||
let pos[2] += n
|
||||
call setpos('.', pos)
|
||||
endif
|
||||
|
||||
let line = getline(l2)
|
||||
let line = strpart(line, 0, c2 - 1) . newd2 . strpart(line, c2 + len(d2) - 1)
|
||||
call setline(l2, line)
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#change#env
|
||||
function! latex#change#env(new_env)
|
||||
let [env, l1, c1, l2, c2] = latex#util#get_env(1)
|
||||
@ -102,8 +66,42 @@ function! latex#change#env_prompt()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#change#env_toggle_star
|
||||
function! latex#change#env_toggle_star()
|
||||
" {{{1 latex#change#toggle_delim
|
||||
function! latex#change#toggle_delim()
|
||||
"
|
||||
" Toggle \left and \right variants of delimiters
|
||||
"
|
||||
let [d1, l1, c1, d2, l2, c2] = latex#util#get_delim()
|
||||
|
||||
if d1 =~ 'left'
|
||||
let newd1 = substitute(d1, '\\left', '', '')
|
||||
let newd2 = substitute(d2, '\\right', '', '')
|
||||
elseif d1 !~ '\cbigg\?'
|
||||
let newd1 = '\left' . d1
|
||||
let newd2 = '\right' . d2
|
||||
else
|
||||
return
|
||||
endif
|
||||
|
||||
let line = getline(l1)
|
||||
let line = strpart(line, 0, c1 - 1) . newd1 . strpart(line, c1 + len(d1) - 1)
|
||||
call setline(l1, line)
|
||||
|
||||
if l1 == l2
|
||||
let n = len(newd1) - len(d1)
|
||||
let c2 += n
|
||||
let pos = getpos('.')
|
||||
let pos[2] += n
|
||||
call setpos('.', pos)
|
||||
endif
|
||||
|
||||
let line = getline(l2)
|
||||
let line = strpart(line, 0, c2 - 1) . newd2 . strpart(line, c2 + len(d2) - 1)
|
||||
call setline(l2, line)
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#change#toggle_env_star
|
||||
function! latex#change#toggle_env_star()
|
||||
let env = latex#util#get_env()
|
||||
|
||||
if env == '\('
|
||||
@ -155,32 +153,6 @@ function! latex#change#wrap_selection_prompt(...)
|
||||
endfunction
|
||||
" }}}1
|
||||
|
||||
" Work in progress
|
||||
" {{{1 latex#change#surround
|
||||
function! latex#change#surround()
|
||||
let pos = getpos('.')
|
||||
|
||||
let a = getchar()
|
||||
if a =~ '^\d\+$'
|
||||
let a = nr2char(a)
|
||||
endif
|
||||
|
||||
if a == "e"
|
||||
call latex#change#env_prompt()
|
||||
elseif a == "
|
||||
echo "Not implemented"
|
||||
"let b = getchar()
|
||||
"if b =~ '^\d\+$'
|
||||
" let b = nr2char(b)
|
||||
"endif
|
||||
"
|
||||
"echo 'a=' . a . ' b=' . b
|
||||
endif
|
||||
|
||||
call setpos('.', pos)
|
||||
endfunction
|
||||
"}}}1
|
||||
|
||||
" {{{1 s:sidwrap
|
||||
let s:SID = matchstr(expand('<sfile>'), '\zs<SNR>\d\+_\ze.*$')
|
||||
function! s:sidwrap(func)
|
||||
|
@ -21,15 +21,20 @@ function! latex#motion#init(initialized)
|
||||
onoremap <silent><buffer> [] :normal v[]<cr>
|
||||
onoremap <silent><buffer> [[ :normal v[[<cr>
|
||||
|
||||
vnoremap <silent><buffer> ie :latex#motion#select_current_env('inner')<cr>
|
||||
vnoremap <silent><buffer> ae :latex#motion#select_current_env('outer')<cr>
|
||||
vnoremap <silent><buffer> ie :call latex#motion#select_environment(1)<cr>
|
||||
vnoremap <silent><buffer> ae :call latex#motion#select_environment()<cr>
|
||||
onoremap <silent><buffer> ie :normal vie<cr>
|
||||
onoremap <silent><buffer> ae :normal vae<cr>
|
||||
|
||||
vnoremap <silent><buffer> i$ :latex#motion#select_inline_math('inner')<cr>
|
||||
vnoremap <silent><buffer> a$ :latex#motion#select_inline_math('outer')<cr>
|
||||
vnoremap <silent><buffer> i$ :call latex#motion#select_inline_math(1)<cr>
|
||||
vnoremap <silent><buffer> a$ :call latex#motion#select_inline_math()<cr>
|
||||
onoremap <silent><buffer> i$ :normal vi$<cr>
|
||||
onoremap <silent><buffer> a$ :normal va$<cr>
|
||||
|
||||
vnoremap <silent><buffer> id :<c-u>call latex#motion#select_delimiter(1)<cr>
|
||||
vnoremap <silent><buffer> ad :<c-u>call latex#motion#select_delimiter()<cr>
|
||||
onoremap <silent><buffer> id :normal vi(<cr>
|
||||
onoremap <silent><buffer> ad :normal va(<cr>
|
||||
endif
|
||||
|
||||
"
|
||||
@ -55,9 +60,6 @@ endfunction
|
||||
|
||||
" {{{1 latex#motion#find_matching_pair
|
||||
function! latex#motion#find_matching_pair(...)
|
||||
"
|
||||
" Note: This code is ugly, but it seems to work.
|
||||
"
|
||||
if a:0 > 0
|
||||
normal! gv
|
||||
endif
|
||||
@ -68,18 +70,14 @@ function! latex#motion#find_matching_pair(...)
|
||||
let nl = line('.')
|
||||
let nc = col('.')
|
||||
|
||||
" Combine all open/close pats
|
||||
let all_pats = join(g:latex_motion_open_pats+g:latex_motion_close_pats, '\|')
|
||||
let all_pats = '\C\(' . all_pats . '\|\$\)'
|
||||
|
||||
" Find delimiter under cursor
|
||||
let [lnum, cnum] = searchpos(all_pats, 'cbnW', nl-2)
|
||||
let delim = matchstr(getline(lnum), '^'. all_pats, cnum-1)
|
||||
let [lnum, cnum] = searchpos(s:delimiters, 'cbnW', nl-2)
|
||||
let delim = matchstr(getline(lnum), '^' . s:delimiters, cnum-1)
|
||||
|
||||
" If delimiter not found, try to search forward instead
|
||||
if empty(delim)
|
||||
let [lnum, cnum] = searchpos(all_pats, 'cnW', nl+2)
|
||||
let delim = matchstr(getline(lnum), '^'. all_pats, cnum-1)
|
||||
let [lnum, cnum] = searchpos(s:delimiters, 'cnW', nl+2)
|
||||
let delim = matchstr(getline(lnum), '^'. s:delimiters, cnum-1)
|
||||
if empty(delim)
|
||||
return
|
||||
endif
|
||||
@ -100,9 +98,9 @@ function! latex#motion#find_matching_pair(...)
|
||||
|
||||
call cursor(lnum2,cnum2)
|
||||
else
|
||||
for i in range(len(g:latex_motion_open_pats))
|
||||
let open_pat = '\C' . b:notbslash . g:latex_motion_open_pats[i]
|
||||
let close_pat = '\C' . b:notbslash . g:latex_motion_close_pats[i]
|
||||
for i in range(len(s:delimiters))
|
||||
let open_pat = '\C' . b:notbslash . s:delimiters_open[i]
|
||||
let close_pat = '\C' . b:notbslash . s:delimiters_close[i]
|
||||
|
||||
if delim =~# '^' . open_pat
|
||||
call searchpairpos(open_pat, '', close_pat,
|
||||
@ -135,25 +133,13 @@ function! latex#motion#next_sec(type, backwards, visual)
|
||||
endif
|
||||
|
||||
" Define search pattern and do the search while preserving "/
|
||||
let save_search = @/
|
||||
let flags = 'W'
|
||||
if a:backwards
|
||||
let flags = 'b' . flags
|
||||
endif
|
||||
|
||||
" Define section pattern
|
||||
let sec_pat = join([
|
||||
\ '(sub)*section',
|
||||
\ 'chapter',
|
||||
\ 'part',
|
||||
\ 'appendix',
|
||||
\ '(front|back|main)matter',
|
||||
\ ], '|')
|
||||
let sec_pat = b:notcomment . '\v\s*\\(' . sec_pat . ')>'
|
||||
|
||||
" Perform the search
|
||||
call search(sec_pat, flags)
|
||||
let @/ = save_search
|
||||
call search(s:section, flags)
|
||||
|
||||
" For the [] and ][ commands we move down or up after the search
|
||||
if a:type == 1
|
||||
@ -165,11 +151,48 @@ function! latex#motion#next_sec(type, backwards, visual)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#motion#select_current_env
|
||||
function! latex#motion#select_current_env(seltype)
|
||||
" {{{1 latex#motion#select_delimiter
|
||||
function! latex#motion#select_delimiter(...)
|
||||
let inner = a:0 > 0
|
||||
|
||||
let [d1, l1, c1, d2, l2, c2] = latex#util#get_delim()
|
||||
|
||||
if inner
|
||||
let c1 += len(d1)
|
||||
if c1 != len(getline(l1))
|
||||
let l1 += 1
|
||||
let c1 = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
if inner
|
||||
let c2 -= 1
|
||||
if c2 < 1
|
||||
let l2 -= 1
|
||||
let c2 = len(getline(l2))
|
||||
endif
|
||||
else
|
||||
let c2 += len(d2) - 1
|
||||
endif
|
||||
|
||||
if l1 < l2 || (l1 == l2 && c1 < c2)
|
||||
call cursor(l1,c1)
|
||||
if visualmode() ==# 'V'
|
||||
normal! V
|
||||
else
|
||||
normal! v
|
||||
endif
|
||||
call cursor(l2,c2)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#motion#select_environment
|
||||
function! latex#motion#select_environment(...)
|
||||
let inner = a:0 > 0
|
||||
|
||||
let [env, lnum, cnum, lnum2, cnum2] = latex#util#get_env(1)
|
||||
call cursor(lnum, cnum)
|
||||
if a:seltype == 'inner'
|
||||
if inner
|
||||
if env =~ '^\'
|
||||
call search('\\.\_\s*\S', 'eW')
|
||||
else
|
||||
@ -182,7 +205,7 @@ function! latex#motion#select_current_env(seltype)
|
||||
normal! v
|
||||
endif
|
||||
call cursor(lnum2, cnum2)
|
||||
if a:seltype == 'inner'
|
||||
if inner
|
||||
call search('\S\_\s*', 'bW')
|
||||
else
|
||||
if env =~ '^\'
|
||||
@ -194,8 +217,8 @@ function! latex#motion#select_current_env(seltype)
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#motion#select_inline_math
|
||||
function! latex#motion#select_inline_math(seltype)
|
||||
" seltype is either 'inner' or 'outer'
|
||||
function! latex#motion#select_inline_math(...)
|
||||
let inner = a:0 > 0
|
||||
|
||||
let dollar_pat = '\\\@<!\$'
|
||||
|
||||
@ -207,7 +230,7 @@ function! latex#motion#select_inline_math(seltype)
|
||||
return
|
||||
endif
|
||||
|
||||
if a:seltype == 'inner'
|
||||
if inner
|
||||
normal! l
|
||||
endif
|
||||
|
||||
@ -219,12 +242,47 @@ function! latex#motion#select_inline_math(seltype)
|
||||
|
||||
call s:search_and_skip_comments(dollar_pat, 'W')
|
||||
|
||||
if a:seltype == 'inner'
|
||||
if inner
|
||||
normal! h
|
||||
endif
|
||||
endfunction
|
||||
" }}}1
|
||||
|
||||
" {{{1 Common patterns
|
||||
|
||||
" Patterns to match opening and closing delimiters/environments
|
||||
let s:delimiters_open = [
|
||||
\ '{',
|
||||
\ '(',
|
||||
\ '\[',
|
||||
\ '\\{',
|
||||
\ '\\(',
|
||||
\ '\\\[',
|
||||
\ '\\\Cbegin\s*{.\{-}}',
|
||||
\ '\\\Cleft\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\((\|\[\|\\{\)',
|
||||
\ ]
|
||||
let s:delimiters_close = [
|
||||
\ '}',
|
||||
\ ')',
|
||||
\ '\]',
|
||||
\ '\\}',
|
||||
\ '\\)',
|
||||
\ '\\\]',
|
||||
\ '\\\Cend\s*{.\{-}}',
|
||||
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||
\ ]
|
||||
let s:delimiters = join(s:delimiters_open + s:delimiters_close, '\|')
|
||||
let s:delimiters = '\(' . s:delimiters . '\|\$\)'
|
||||
|
||||
" Pattern to match section/chapter/...
|
||||
let s:section = b:notcomment . '\v\s*\\'
|
||||
let s:section.= '((sub)*section|chapter|part|appendix|(front|back|main)matter)'
|
||||
let s:section.= '>'
|
||||
|
||||
" }}}1
|
||||
|
||||
" {{{1 s:highlight_matching_pair
|
||||
function! s:highlight_matching_pair(...)
|
||||
if latex#util#in_comment() | return | endif
|
||||
@ -237,13 +295,9 @@ function! s:highlight_matching_pair(...)
|
||||
let nc = col('.')
|
||||
let line = getline(nl)
|
||||
|
||||
" Combine all open/close pats
|
||||
let all_pats = join(g:latex_motion_open_pats+g:latex_motion_close_pats, '\|')
|
||||
let all_pats = '\C\(' . all_pats . '\|\$\)'
|
||||
|
||||
" Find delimiter under cursor
|
||||
let cnum = searchpos(all_pats, 'cbnW', nl)[1]
|
||||
let delim = matchstr(line, '^'. all_pats, cnum-1)
|
||||
let cnum = searchpos(s:delimiters, 'cbnW', nl)[1]
|
||||
let delim = matchstr(line, '^'. s:delimiters, cnum-1)
|
||||
|
||||
" Only highlight when cursor is on delimiters
|
||||
if empty(delim) || strlen(delim)+cnum-hmode < nc
|
||||
@ -270,26 +324,26 @@ function! s:highlight_matching_pair(...)
|
||||
"
|
||||
" Match other delimitors
|
||||
"
|
||||
for i in range(len(g:latex_motion_open_pats))
|
||||
let open_pat = '\C' . b:notbslash . g:latex_motion_open_pats[i]
|
||||
let close_pat = '\C' . b:notbslash . g:latex_motion_close_pats[i]
|
||||
for i in range(len(s:delimiters_open))
|
||||
let open_pat = '\C' . b:notbslash . s:delimiters_open[i]
|
||||
let close_pat = '\C' . b:notbslash . s:delimiters_close[i]
|
||||
|
||||
if delim =~# '^' . open_pat
|
||||
let [lnum2, cnum2] = searchpairpos(open_pat, '', close_pat,
|
||||
\ 'nW', 'latex#util#in_comment()', line('w$'), 200)
|
||||
execute '2match MatchParen /\%(\%' . nl . 'l\%' . cnum
|
||||
\ . 'c' . g:latex_motion_open_pats[i] . '\|\%'
|
||||
\ . 'c' . s:delimiters_open[i] . '\|\%'
|
||||
\ . lnum2 . 'l\%' . cnum2 . 'c'
|
||||
\ . g:latex_motion_close_pats[i] . '\)/'
|
||||
\ . s:delimiters_close[i] . '\)/'
|
||||
return
|
||||
elseif delim =~# '^' . close_pat
|
||||
let [lnum2, cnum2] = searchpairpos(open_pat, '',
|
||||
\ '\C\%(\%'. nl . 'l\%' . cnum . 'c\)\@!' . close_pat,
|
||||
\ 'bnW', 'latex#util#in_comment()', line('w0'), 200)
|
||||
execute '2match MatchParen /\%(\%' . lnum2 . 'l\%' . cnum2
|
||||
\ . 'c' . g:latex_motion_open_pats[i] . '\|\%'
|
||||
\ . 'c' . s:delimiters_open[i] . '\|\%'
|
||||
\ . nl . 'l\%' . cnum . 'c'
|
||||
\ . g:latex_motion_close_pats[i] . '\)/'
|
||||
\ . s:delimiters_close[i] . '\)/'
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
|
@ -142,27 +142,7 @@ function! latex#util#get_env(...)
|
||||
endfunction
|
||||
|
||||
" {{{1 latex#util#get_delim
|
||||
let s:latex_delim_open = [
|
||||
\ '(',
|
||||
\ '\[',
|
||||
\ '\\{',
|
||||
\ '\\\[',
|
||||
\ '\\\Cleft\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\((\|\[\|\\{\)',
|
||||
\ ]
|
||||
let s:latex_delim_close = [
|
||||
\ ')',
|
||||
\ '\]',
|
||||
\ '\\}',
|
||||
\ '\\\]',
|
||||
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||
\ ]
|
||||
function! latex#util#get_delim()
|
||||
"
|
||||
" Note: This functions has not been optimized
|
||||
"
|
||||
|
||||
" Save position in order to restore before finishing
|
||||
let pos_original = getpos('.')
|
||||
|
||||
@ -170,7 +150,7 @@ function! latex#util#get_delim()
|
||||
let pos_save = getpos('.')
|
||||
|
||||
" Check if the cursor is on top of a closing delimiter
|
||||
let close_pats = '\(' . join(s:latex_delim_close, '\|') . '\)'
|
||||
let close_pats = '\(' . join(s:delimiters_close, '\|') . '\)'
|
||||
let lnum = pos_save[1]
|
||||
let cnum = pos_save[2]
|
||||
let [lnum, cnum] = searchpos(close_pats, 'cbnW', lnum)
|
||||
@ -187,10 +167,10 @@ function! latex#util#get_delim()
|
||||
let l2=1000000
|
||||
let c1=1000000
|
||||
let c2=1000000
|
||||
for i in range(len(s:latex_delim_open))
|
||||
for i in range(len(s:delimiters_open))
|
||||
call setpos('.', pos_save)
|
||||
let open = s:latex_delim_open[i]
|
||||
let close = s:latex_delim_close[i]
|
||||
let open = s:delimiters_open[i]
|
||||
let close = s:delimiters_close[i]
|
||||
let flags = 'W'
|
||||
|
||||
" Check if the cursor is on top of an opening delimiter. If it is not,
|
||||
@ -221,6 +201,21 @@ function! latex#util#get_delim()
|
||||
return [d1,l1,c1,d2,l2,c2]
|
||||
endfunction
|
||||
|
||||
let s:delimiters_open = [
|
||||
\ '(',
|
||||
\ '\[',
|
||||
\ '\\{',
|
||||
\ '\\\Cleft\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\((\|\[\|\\{\)',
|
||||
\ ]
|
||||
let s:delimiters_close = [
|
||||
\ ')',
|
||||
\ '\]',
|
||||
\ '\\}',
|
||||
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||
\ ]
|
||||
|
||||
" {{{1 latex#util#has_syntax
|
||||
function! latex#util#has_syntax(name, ...)
|
||||
" Usage: latex#util#has_syntax(name, [line], [col])
|
||||
|
183
doc/latex.txt
183
doc/latex.txt
@ -33,9 +33,11 @@ CONTENTS *vim-latex-contents*
|
||||
6. Folding .............................. |vim-latex-folding|
|
||||
7. Latexmk .............................. |vim-latex-latexmk|
|
||||
8. Motion ............................... |vim-latex-motion|
|
||||
9. Table of contents .................... |vim-latex-toc|
|
||||
10. Function reference ................... |vim-latex-functions|
|
||||
11. Limitations .......................... |vim-latex-limitations|
|
||||
9. Change ............................... |vim-latex-change|
|
||||
10. Table of contents .................... |vim-latex-toc|
|
||||
11. Utility functions .................... |vim-latex-util|
|
||||
12. Function reference ................... |vim-latex-functions|
|
||||
13. Limitations .......................... |vim-latex-limitations|
|
||||
|
||||
==============================================================================
|
||||
INTRO *vim-latex-intro*
|
||||
@ -132,32 +134,37 @@ convenience to list all the defined mappings, and it is by default mapped to
|
||||
'<localleader>lh'. The default mappings may be disabled with the option
|
||||
|g:latex_default_mappings|, if the user wishes to create his own mappings.
|
||||
|
||||
n % *@:call latex#motion#find_matching_pair('n')<cr>
|
||||
v % *@:<C-U>call latex#motion#find_matching_pair('v')<cr>
|
||||
o % *@:call latex#motion#find_matching_pair('o')<cr>
|
||||
n % *@:call latex#motion#find_matching_pair()<CR>
|
||||
v % *@:<C-U>call latex#motion#find_matching_pair(1)<CR>
|
||||
o % *@:normal v%<CR>
|
||||
|
||||
v a$ *@:latex#motion#select_inline_math('outer')<cr>
|
||||
v i$ *@:latex#motion#select_inline_math('inner')<cr>
|
||||
o a$ *@:normal va$<cr>
|
||||
o i$ *@:normal vi$<cr>
|
||||
v a$ *@:call latex#motion#select_inline_math()<CR>
|
||||
v i$ *@:call latex#motion#select_inline_math(1)<CR>
|
||||
o a$ *@:normal va$<CR>
|
||||
o i$ *@:normal vi$<CR>
|
||||
|
||||
v ae *@:latex#motion#select_current_env('outer')<cr>
|
||||
v ie *@:latex#motion#select_current_env('inner')<cr>
|
||||
o ae *@:normal vae<cr>
|
||||
o ie *@:normal vie<cr>
|
||||
v ae *@:call latex#motion#select_environment()<CR>
|
||||
v ie *@:call latex#motion#select_environment(1)<CR>
|
||||
o ae *@:normal vae<CR>
|
||||
o ie *@:normal vie<CR>
|
||||
|
||||
n [[ *@:call latex#motion#next_sec(0,1,0)<cr>
|
||||
n [] *@:call latex#motion#next_sec(1,1,0)<cr>
|
||||
n ][ *@:call latex#motion#next_sec(1,0,0)<cr>
|
||||
n ]] *@:call latex#motion#next_sec(0,0,0)<cr>
|
||||
v [[ *@:<C-U>call latex#motion#next_sec(0,1,1)<cr>
|
||||
v [] *@:<C-U>call latex#motion#next_sec(1,1,1)<cr>
|
||||
v ][ *@:<C-U>call latex#motion#next_sec(1,0,1)<cr>
|
||||
v ]] *@:<C-U>call latex#motion#next_sec(0,0,1)<cr>
|
||||
o [[ *@:normal v[[<cr>
|
||||
o [] *@:normal v[]<cr>
|
||||
o ][ *@:normal v][<cr>
|
||||
o ]] *@:normal v]]<cr>
|
||||
v ad *@:<C-U>call latex#motion#select_delimiter()<CR>
|
||||
v id *@:<C-U>call latex#motion#select_delimiter(1)<CR>
|
||||
o ad *@:normal va(<CR>
|
||||
o id *@:normal vi(<CR>
|
||||
|
||||
n [[ *@:call latex#motion#next_sec(0,1,0)<CR>
|
||||
n [] *@:call latex#motion#next_sec(1,1,0)<CR>
|
||||
n ][ *@:call latex#motion#next_sec(1,0,0)<CR>
|
||||
n ]] *@:call latex#motion#next_sec(0,0,0)<CR>
|
||||
v [[ *@:<C-U>call latex#motion#next_sec(0,1,1)<CR>
|
||||
v [] *@:<C-U>call latex#motion#next_sec(1,1,1)<CR>
|
||||
v ][ *@:<C-U>call latex#motion#next_sec(1,0,1)<CR>
|
||||
v ]] *@:<C-U>call latex#motion#next_sec(0,0,1)<CR>
|
||||
o [[ *@:normal v[[<CR>
|
||||
o [] *@:normal v[]<CR>
|
||||
o ][ *@:normal v][<CR>
|
||||
o ]] *@:normal v]]<CR>
|
||||
|
||||
n <localleader>li *@:call latex#info()<cr>
|
||||
n <localleader>lh *@:call latex#help()<cr>
|
||||
@ -174,10 +181,27 @@ n <localleader>lG *@:call latex#latexmk#status(1)<cr>
|
||||
n <localleader>lc *@:call latex#latexmk#clean()<cr>
|
||||
n <localleader>lC *@:call latex#latexmk#clean(1)<cr>
|
||||
|
||||
n <localleader>li *@:call latex#info()<CR>
|
||||
n <localleader>lh *@:call latex#help()<CR>
|
||||
n <localleader>lv *@:call latex#view()<CR>
|
||||
n <localleader>lR *@:call latex#reinit()<CR>
|
||||
n <localleader>lt *@:call latex#toc#open()<CR>
|
||||
n <localleader>lT *@:call latex#toc#toggle()<CR>
|
||||
n <localleader>ll *@:call latex#latexmk#compile()<CR>
|
||||
n <localleader>lk *@:call latex#latexmk#stop(1)<CR>
|
||||
n <localleader>lK *@:call latex#latexmk#stop_all()<CR>
|
||||
n <localleader>le *@:call latex#latexmk#errors()<CR>
|
||||
n <localleader>lg *@:call latex#latexmk#status()<CR>
|
||||
n <localleader>lG *@:call latex#latexmk#status(1)<CR>
|
||||
n <localleader>lc *@:call latex#latexmk#clean()<CR>
|
||||
n <localleader>lC *@:call latex#latexmk#clean(1)<CR>
|
||||
|
||||
n zx *@:call latex#fold#refresh()<cr>zx
|
||||
n dse *@:call latex#change#env('')<cr>
|
||||
n cse *@:call latex#change#env_prompt()<cr>
|
||||
n dse *@:call latex#change#env('')<CR>
|
||||
n cse *@:call latex#change#env_prompt()<CR>
|
||||
n tse *@:call latex#change#env_toggle_star()<CR>
|
||||
n tse *@:call latex#change#env_toggle_star()<cr>
|
||||
n tsd *@:call latex#change#delim_toggle()<CR>
|
||||
|
||||
==============================================================================
|
||||
OPTIONS *vim-latex-options*
|
||||
@ -206,10 +230,8 @@ Overview:~
|
||||
|g:latex_latexmk_options|
|
||||
|g:latex_latexmk_output|
|
||||
|g:latex_main_tex_candidates|
|
||||
|g:latex_motion_close_pats|
|
||||
|g:latex_motion_enabled|
|
||||
|g:latex_motion_matchparen|
|
||||
|g:latex_motion_open_pats|
|
||||
|g:latex_toc_enabled|
|
||||
|g:latex_toc_fold_levels|
|
||||
|g:latex_toc_fold|
|
||||
@ -345,20 +367,6 @@ main tex file in multi-file projects. >
|
||||
\]
|
||||
<
|
||||
|
||||
*g:latex_motion_close_pats*
|
||||
Define a list of patterns that match closing braces and environments. >
|
||||
let g:latex_motion_close_pats = [
|
||||
\ '}',
|
||||
\ ')',
|
||||
\ '\]',
|
||||
\ '\\}',
|
||||
\ '\\)',
|
||||
\ '\\\]',
|
||||
\ '\\end\s*{.\{-}}',
|
||||
\ '\\right\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ ]
|
||||
<
|
||||
|
||||
*g:latex_motion_enabled*
|
||||
Whether to enable the motion interface. If it is disabled, then neither the
|
||||
default mappings nor the autocommands that enable highlighting of matching
|
||||
@ -372,20 +380,6 @@ but disables the builtin |matchparen|. >
|
||||
let g:latex_motion_matchparen = 1
|
||||
<
|
||||
|
||||
*g:latex_motion_open_pats*
|
||||
Define a list of patterns that match opening braces and environments. >
|
||||
let g:latex_motion_open_pats = [
|
||||
\ '{',
|
||||
\ '(',
|
||||
\ '\[',
|
||||
\ '\\{',
|
||||
\ '\\(',
|
||||
\ '\\\[',
|
||||
\ '\\begin\s*{.\{-}}',
|
||||
\ '\\left\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ ]
|
||||
<
|
||||
|
||||
*g:latex_toc_enabled*
|
||||
Enable interface for TOC. If it is disabled, then mappings for the TOC will
|
||||
not be created. >
|
||||
@ -584,6 +578,34 @@ Functions:
|
||||
|latex#motion#select_current_env|
|
||||
|latex#motion#select_inline_math|
|
||||
|
||||
==============================================================================
|
||||
CHANGE *vim-latex-change*
|
||||
|
||||
Utility functions are provided to manipulate the current environments or
|
||||
delimiters.
|
||||
|
||||
Functions:
|
||||
|latex#change#env|
|
||||
|latex#change#env_prompt|
|
||||
|latex#change#toggle_delim|
|
||||
|latex#change#toggle_env_star|
|
||||
|latex#change#wrap_selection|
|
||||
|latex#change#wrap_selection_prompt|
|
||||
|
||||
==============================================================================
|
||||
UTILITY FUNCTIONS *vim-latex-util*
|
||||
|
||||
Functions:
|
||||
|latex#util#convert_back|
|
||||
|latex#util#get_delim|
|
||||
|latex#util#get_env|
|
||||
|latex#util#has_syntax|
|
||||
|latex#util#in_comment|
|
||||
|latex#util#kpsewhich|
|
||||
|latex#util#set_default|
|
||||
|latex#util#tex2tree|
|
||||
|latex#util#tree2tex|
|
||||
|
||||
==============================================================================
|
||||
TABLE OF CONTENTS *vim-latex-toc*
|
||||
|
||||
@ -613,6 +635,12 @@ descriptions follow.
|
||||
|
||||
Overview:~
|
||||
|
||||
|latex#change#env|
|
||||
|latex#change#env_prompt|
|
||||
|latex#change#toggle_delim|
|
||||
|latex#change#toggle_env_star|
|
||||
|latex#change#wrap_selection|
|
||||
|latex#change#wrap_selection_prompt|
|
||||
|latex#complete#omnifunc|
|
||||
|latex#complete#labels|
|
||||
|latex#complete#bibtex|
|
||||
@ -634,11 +662,32 @@ Overview:~
|
||||
|latex#reinit|
|
||||
|latex#toc#open|
|
||||
|latex#toc#toggle|
|
||||
|latex#util#convert_back|
|
||||
|latex#util#get_delim|
|
||||
|latex#util#get_env|
|
||||
|latex#util#has_syntax|
|
||||
|latex#util#in_comment|
|
||||
|latex#util#kpsewhich|
|
||||
|latex#util#set_default|
|
||||
|latex#util#tex2tree|
|
||||
|latex#util#tree2tex|
|
||||
|latex#view|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Detailed descriptions:~
|
||||
|
||||
*latex#change#env*
|
||||
|
||||
*latex#change#env_prompt*
|
||||
|
||||
*latex#change#toggle_delim*
|
||||
|
||||
*latex#change#toggle_env_star*
|
||||
|
||||
*latex#change#wrap_selection*
|
||||
|
||||
*latex#change#wrap_selection_prompt*
|
||||
|
||||
*latex#complete#omnifunc*
|
||||
An 'omnifunc' for label and citation completion, see |vim-latex-completion|.
|
||||
|
||||
@ -717,6 +766,24 @@ the TOC window.
|
||||
Toggle TOC window: If TOC window is open, then close it. If it is closed,
|
||||
then open it (but do not move the cursor to the window).
|
||||
|
||||
*latex#util#convert_back*
|
||||
|
||||
*latex#util#get_delim*
|
||||
|
||||
*latex#util#get_env*
|
||||
|
||||
*latex#util#has_syntax*
|
||||
|
||||
*latex#util#in_comment*
|
||||
|
||||
*latex#util#kpsewhich*
|
||||
|
||||
*latex#util#set_default*
|
||||
|
||||
*latex#util#tex2tree*
|
||||
|
||||
*latex#util#tree2tex*
|
||||
|
||||
*latex#view*
|
||||
Open the output file (specified with |g:latex_latexmk_output|) with the
|
||||
default viewer |g:latex_viewer|.
|
||||
|
@ -71,30 +71,6 @@ call latex#util#set_default('g:latex_errorformat_ignore_warnings',
|
||||
" {{{1 Motion
|
||||
call latex#util#set_default('g:latex_motion_enabled', 1)
|
||||
call latex#util#set_default('g:latex_motion_matchparen', 1)
|
||||
call latex#util#set_default('g:latex_motion_open_pats',
|
||||
\ [
|
||||
\ '{',
|
||||
\ '(',
|
||||
\ '\[',
|
||||
\ '\\{',
|
||||
\ '\\(',
|
||||
\ '\\\[',
|
||||
\ '\\begin\s*{.\{-}}',
|
||||
\ '\\left\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\((\|\[\|\\{\)',
|
||||
\ ])
|
||||
call latex#util#set_default('g:latex_motion_close_pats',
|
||||
\ [
|
||||
\ '}',
|
||||
\ ')',
|
||||
\ '\]',
|
||||
\ '\\}',
|
||||
\ '\\)',
|
||||
\ '\\\]',
|
||||
\ '\\end\s*{.\{-}}',
|
||||
\ '\\right\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||
\ ])
|
||||
|
||||
" {{{1 Toc
|
||||
call latex#util#set_default('g:latex_toc_enabled', 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user