diff options
Diffstat (limited to 'ftplugin/latex-box')
-rw-r--r-- | ftplugin/latex-box/findmain.vim | 4 | ||||
-rw-r--r-- | ftplugin/latex-box/latexmk.vim | 24 | ||||
-rw-r--r-- | ftplugin/latex-box/mappings.vim | 32 |
3 files changed, 41 insertions, 19 deletions
diff --git a/ftplugin/latex-box/findmain.vim b/ftplugin/latex-box/findmain.vim index 622c408f..b9871a61 100644 --- a/ftplugin/latex-box/findmain.vim +++ b/ftplugin/latex-box/findmain.vim @@ -30,7 +30,7 @@ function! LatexBox_GetMainFileName(...) " move up the directory tree until we find a .latexmain file. " TODO: Should we be doing this recursion by default, or should there be a " setting? - while glob('*.latexmain') == '' + while glob('*.latexmain',1) == '' let dirmodifier = dirmodifier.':h' let dirNew = fnameescape(expand(dirmodifier)) " break from the loop if we cannot go up any further. @@ -41,7 +41,7 @@ function! LatexBox_GetMainFileName(...) exe 'cd '.dirLast endwhile - let lheadfile = glob('*.latexmain') + let lheadfile = glob('*.latexmain',1) if lheadfile != '' " Remove the trailing .latexmain part of the filename... We never want " that. diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim index 6c5d3eb1..1285bc64 100644 --- a/ftplugin/latex-box/latexmk.vim +++ b/ftplugin/latex-box/latexmk.vim @@ -443,10 +443,32 @@ function! LatexBox_LatexErrors(status, ...) endif endfunction +" Redefine uniq() for compatibility with older Vim versions (< 7.4.218) +function! s:uniq(list) + if exists('*uniq') + return uniq(a:list) + elseif len(a:list) <= 1 + return a:list + endif + + let last_element = get(a:list,0) + let uniq_list = [last_element] + + for i in range(1, len(a:list)-1) + let next_element = get(a:list, i) + if last_element == next_element + continue + endif + let last_element = next_element + call add(uniq_list, next_element) + endfor + return uniq_list +endfunction + function! s:log_contains_error(file) let lines = readfile(a:file) let lines = filter(lines, 'v:val =~ ''^.*:\d\+: ''') - let lines = uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) + let lines = s:uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) let lines = filter(lines, 'filereadable(fnameescape(v:val))') return len(lines) > 0 endfunction diff --git a/ftplugin/latex-box/mappings.vim b/ftplugin/latex-box/mappings.vim index 648d9b56..ef6b52ff 100644 --- a/ftplugin/latex-box/mappings.vim +++ b/ftplugin/latex-box/mappings.vim @@ -5,31 +5,31 @@ if exists("g:LatexBox_no_mappings") endif " latexmk {{{ -map <buffer> <LocalLeader>ll :Latexmk<CR> -map <buffer> <LocalLeader>lL :Latexmk!<CR> -map <buffer> <LocalLeader>lc :LatexmkClean<CR> -map <buffer> <LocalLeader>lC :LatexmkClean!<CR> -map <buffer> <LocalLeader>lg :LatexmkStatus<CR> -map <buffer> <LocalLeader>lG :LatexmkStatus!<CR> -map <buffer> <LocalLeader>lk :LatexmkStop<CR> -map <buffer> <LocalLeader>le :LatexErrors<CR> +noremap <buffer> <LocalLeader>ll :Latexmk<CR> +noremap <buffer> <LocalLeader>lL :Latexmk!<CR> +noremap <buffer> <LocalLeader>lc :LatexmkClean<CR> +noremap <buffer> <LocalLeader>lC :LatexmkClean!<CR> +noremap <buffer> <LocalLeader>lg :LatexmkStatus<CR> +noremap <buffer> <LocalLeader>lG :LatexmkStatus!<CR> +noremap <buffer> <LocalLeader>lk :LatexmkStop<CR> +noremap <buffer> <LocalLeader>le :LatexErrors<CR> " }}} " View {{{ -map <buffer> <LocalLeader>lv :LatexView<CR> +noremap <buffer> <LocalLeader>lv :LatexView<CR> " }}} " TOC {{{ -map <silent> <buffer> <LocalLeader>lt :LatexTOC<CR> +noremap <silent> <buffer> <LocalLeader>lt :LatexTOC<CR> " }}} " List of labels {{{ -map <silent> <buffer> <LocalLeader>lj :LatexLabels<CR> +noremap <silent> <buffer> <LocalLeader>lj :LatexLabels<CR> " }}} " Folding {{{ if g:LatexBox_Folding == 1 - map <buffer> <LocalLeader>lf :LatexFold<CR> + noremap <buffer> <LocalLeader>lf :LatexFold<CR> endif " }}} @@ -44,12 +44,12 @@ endif " Define text objects {{{ vmap <buffer> ie <Plug>LatexBox_SelectCurrentEnvInner vmap <buffer> ae <Plug>LatexBox_SelectCurrentEnvOuter -omap <buffer> ie :normal vie<CR> -omap <buffer> ae :normal vae<CR> +onoremap <buffer> ie :normal vie<CR> +onoremap <buffer> ae :normal vae<CR> vmap <buffer> i$ <Plug>LatexBox_SelectInlineMathInner vmap <buffer> a$ <Plug>LatexBox_SelectInlineMathOuter -omap <buffer> i$ :normal vi$<CR> -omap <buffer> a$ :normal va$<CR> +onoremap <buffer> i$ :normal vi$<CR> +onoremap <buffer> a$ :normal va$<CR> " }}} " Jump between sections {{{ |