From bb85059bacd5b415a012f25679111a0e55d3c6d9 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 30 Dec 2017 11:10:32 +0100 Subject: Update --- ftplugin/latex-box/mappings.vim | 110 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 ftplugin/latex-box/mappings.vim (limited to 'ftplugin/latex-box/mappings.vim') diff --git a/ftplugin/latex-box/mappings.vim b/ftplugin/latex-box/mappings.vim new file mode 100644 index 00000000..7141635e --- /dev/null +++ b/ftplugin/latex-box/mappings.vim @@ -0,0 +1,110 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1 + +" LaTeX Box mappings + +if exists("g:LatexBox_no_mappings") + finish +endif + +" latexmk {{{ +noremap ll :Latexmk +noremap lL :Latexmk! +noremap lc :LatexmkClean +noremap lC :LatexmkClean! +noremap lg :LatexmkStatus +noremap lG :LatexmkStatus! +noremap lk :LatexmkStop +noremap le :LatexErrors +" }}} + +" View {{{ +noremap lv :LatexView +" }}} + +" TOC {{{ +noremap lt :LatexTOC +" }}} + +" List of labels {{{ +noremap lj :LatexLabels +" }}} + +" Folding {{{ +if g:LatexBox_Folding == 1 + noremap lf :LatexFold +endif +" }}} + +" Jump to match {{{ +if !exists('g:LatexBox_loaded_matchparen') + nmap % LatexBox_JumpToMatch + vmap % LatexBox_JumpToMatch + omap % LatexBox_JumpToMatch +endif +" }}} + +" Define text objects {{{ +vmap ie LatexBox_SelectCurrentEnvInner +vmap ae LatexBox_SelectCurrentEnvOuter +onoremap ie :normal vie +onoremap ae :normal vae +vmap i$ LatexBox_SelectInlineMathInner +vmap a$ LatexBox_SelectInlineMathOuter +onoremap i$ :normal vi$ +onoremap a$ :normal va$ +" }}} + +" Jump between sections {{{ +function! s:LatexBoxNextSection(type, backwards, visual) + " Restore visual mode if desired + if a:visual + normal! gv + endif + + " For the [] and ][ commands we move up or down before the search + if a:type == 1 + if a:backwards + normal! k + else + normal! j + endif + endif + + " Define search pattern and do the search while preserving "/ + let save_search = @/ + let flags = 'W' + if a:backwards + let flags = 'b' . flags + endif + let notcomment = '\%(\%(\\\@' + call search(pattern, flags) + let @/ = save_search + + " For the [] and ][ commands we move down or up after the search + if a:type == 1 + if a:backwards + normal! j + else + normal! k + endif + endif +endfunction +noremap ]] :call LatexBoxNextSection(0,0,0) +noremap ][ :call LatexBoxNextSection(1,0,0) +noremap [] :call LatexBoxNextSection(1,1,0) +noremap [[ :call LatexBoxNextSection(0,1,0) +vnoremap ]] :call LatexBoxNextSection(0,0,1) +vnoremap ][ :call LatexBoxNextSection(1,0,1) +vnoremap [] :call LatexBoxNextSection(1,1,1) +vnoremap [[ :call LatexBoxNextSection(0,1,1) +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 + +endif -- cgit v1.2.3