Merged with master

This commit is contained in:
Karl Yngve Lervåg 2015-06-22 20:49:19 +02:00
commit 4069edc4b0
2 changed files with 81 additions and 74 deletions

View File

@ -59,6 +59,11 @@ function! vimtex#init() " {{{1
endif endif
call s:init_modules('buffer') call s:init_modules('buffer')
"
" Finally we create the mappings
"
call s:init_mappings()
let s:initialized = 1 let s:initialized = 1
endfunction endfunction
@ -175,6 +180,82 @@ function! s:init_buffer() " {{{1
augroup END augroup END
endfunction endfunction
" }}}1
function! s:init_mappings() " {{{1
if !get(g:,'vimtex_mappings_enabled', 1) | return | endif
nmap <silent><buffer> <localleader>li <plug>(vimtex-info)
nmap <silent><buffer> dse <plug>(vimtex-delete-env)
nmap <silent><buffer> dsc <plug>(vimtex-delete-cmd)
nmap <silent><buffer> cse <plug>(vimtex-change-env)
nmap <silent><buffer> csc <plug>(vimtex-change-cmd)
nmap <silent><buffer> tse <plug>(vimtex-toggle-star)
nmap <silent><buffer> tsd <plug>(vimtex-toggle-delim)
nmap <silent><buffer> <F7> <plug>(vimtex-create-cmd)
imap <silent><buffer> <F7> <plug>(vimtex-create-cmd)
imap <silent><buffer> ]] <plug>(vimtex-close-env)
if g:vimtex_latexmk_enabled
nmap <silent><buffer> <localleader>ll <plug>(vimtex-compile-toggle)
nmap <silent><buffer> <localleader>lo <plug>(vimtex-compile-output)
nmap <silent><buffer> <localleader>lk <plug>(vimtex-stop)
nmap <silent><buffer> <localleader>lK <plug>(vimtex-stop-all)
nmap <silent><buffer> <localleader>le <plug>(vimtex-errors)
nmap <silent><buffer> <localleader>lc <plug>(vimtex-clean)
nmap <silent><buffer> <localleader>lC <plug>(vimtex-clean-full)
nmap <silent><buffer> <localleader>lg <plug>(vimtex-status)
nmap <silent><buffer> <localleader>lG <plug>(vimtex-status-all)
endif
if g:vimtex_motion_enabled
nmap <silent><buffer> % <plug>(vimtex-%)
xmap <silent><buffer> % <plug>(vimtex-%)
omap <silent><buffer> % <plug>(vimtex-%)
nmap <silent><buffer> ]] <plug>(vimtex-]])
nmap <silent><buffer> ][ <plug>(vimtex-][)
nmap <silent><buffer> [] <plug>(vimtex-[])
nmap <silent><buffer> [[ <plug>(vimtex-[[)
xmap <silent><buffer> ]] <plug>(vimtex-]])
xmap <silent><buffer> ][ <plug>(vimtex-][)
xmap <silent><buffer> [] <plug>(vimtex-[])
xmap <silent><buffer> [[ <plug>(vimtex-[[)
omap <silent><buffer> ]] <plug>(vimtex-]])
omap <silent><buffer> ][ <plug>(vimtex-][)
omap <silent><buffer> [] <plug>(vimtex-[])
omap <silent><buffer> [[ <plug>(vimtex-[[)
xmap <silent><buffer> ie <plug>(vimtex-ie)
xmap <silent><buffer> ae <plug>(vimtex-ae)
omap <silent><buffer> ie <plug>(vimtex-ie)
omap <silent><buffer> ae <plug>(vimtex-ae)
xmap <silent><buffer> i$ <plug>(vimtex-i$)
xmap <silent><buffer> a$ <plug>(vimtex-a$)
omap <silent><buffer> i$ <plug>(vimtex-i$)
omap <silent><buffer> a$ <plug>(vimtex-a$)
xmap <silent><buffer> id <plug>(vimtex-id)
xmap <silent><buffer> ad <plug>(vimtex-ad)
omap <silent><buffer> id <plug>(vimtex-id)
omap <silent><buffer> ad <plug>(vimtex-ad)
endif
if g:vimtex_toc_enabled
nmap <silent><buffer> <localleader>lt <plug>(vimtex-toc-open)
nmap <silent><buffer> <localleader>lT <plug>(vimtex-toc-toggle)
endif
if g:vimtex_labels_enabled
nmap <silent><buffer> <localleader>ly <plug>(vimtex-labels-open)
nmap <silent><buffer> <localleader>lY <plug>(vimtex-labels-toggle)
endif
if g:vimtex_view_enabled
nmap <silent><buffer> <localleader>lv <plug>(vimtex-view)
if has_key(b:vimtex.viewer, 'reverse_search')
nmap <silent><buffer> <localleader>lr <plug>(vimtex-reverse-search)
endif
endif
endfunction
" }}}1 " }}}1
function! s:init_modules(initmode) " {{{1 function! s:init_modules(initmode) " {{{1
for module in s:modules for module in s:modules

View File

@ -5,7 +5,6 @@
" "
function! vimtex#mappings#init_options() " {{{1 function! vimtex#mappings#init_options() " {{{1
call vimtex#util#set_default('g:vimtex_mappings_enabled', 1)
call vimtex#util#set_default('g:vimtex_mappings_math_mode', 1) call vimtex#util#set_default('g:vimtex_mappings_math_mode', 1)
call vimtex#util#set_default('g:vimtex_mappings_leader', '`') call vimtex#util#set_default('g:vimtex_mappings_leader', '`')
endfunction endfunction
@ -106,79 +105,6 @@ endfunction
" }}}1 " }}}1
function! vimtex#mappings#init_buffer() " {{{1 function! vimtex#mappings#init_buffer() " {{{1
if !g:vimtex_mappings_enabled | return | endif
nmap <silent><buffer> <localleader>li <plug>(vimtex-info)
nmap <silent><buffer> dse <plug>(vimtex-delete-env)
nmap <silent><buffer> dsc <plug>(vimtex-delete-cmd)
nmap <silent><buffer> cse <plug>(vimtex-change-env)
nmap <silent><buffer> csc <plug>(vimtex-change-cmd)
nmap <silent><buffer> tse <plug>(vimtex-toggle-star)
nmap <silent><buffer> tsd <plug>(vimtex-toggle-delim)
nmap <silent><buffer> <F7> <plug>(vimtex-create-cmd)
imap <silent><buffer> <F7> <plug>(vimtex-create-cmd)
imap <silent><buffer> ]] <plug>(vimtex-close-env)
if g:vimtex_latexmk_enabled
nmap <silent><buffer> <localleader>ll <plug>(vimtex-compile-toggle)
nmap <silent><buffer> <localleader>lo <plug>(vimtex-compile-output)
nmap <silent><buffer> <localleader>lk <plug>(vimtex-stop)
nmap <silent><buffer> <localleader>lK <plug>(vimtex-stop-all)
nmap <silent><buffer> <localleader>le <plug>(vimtex-errors)
nmap <silent><buffer> <localleader>lc <plug>(vimtex-clean)
nmap <silent><buffer> <localleader>lC <plug>(vimtex-clean-full)
nmap <silent><buffer> <localleader>lg <plug>(vimtex-status)
nmap <silent><buffer> <localleader>lG <plug>(vimtex-status-all)
endif
if g:vimtex_motion_enabled
nmap <silent><buffer> % <plug>(vimtex-%)
xmap <silent><buffer> % <plug>(vimtex-%)
omap <silent><buffer> % <plug>(vimtex-%)
nmap <silent><buffer> ]] <plug>(vimtex-]])
nmap <silent><buffer> ][ <plug>(vimtex-][)
nmap <silent><buffer> [] <plug>(vimtex-[])
nmap <silent><buffer> [[ <plug>(vimtex-[[)
xmap <silent><buffer> ]] <plug>(vimtex-]])
xmap <silent><buffer> ][ <plug>(vimtex-][)
xmap <silent><buffer> [] <plug>(vimtex-[])
xmap <silent><buffer> [[ <plug>(vimtex-[[)
omap <silent><buffer> ]] <plug>(vimtex-]])
omap <silent><buffer> ][ <plug>(vimtex-][)
omap <silent><buffer> [] <plug>(vimtex-[])
omap <silent><buffer> [[ <plug>(vimtex-[[)
xmap <silent><buffer> ie <plug>(vimtex-ie)
xmap <silent><buffer> ae <plug>(vimtex-ae)
omap <silent><buffer> ie <plug>(vimtex-ie)
omap <silent><buffer> ae <plug>(vimtex-ae)
xmap <silent><buffer> i$ <plug>(vimtex-i$)
xmap <silent><buffer> a$ <plug>(vimtex-a$)
omap <silent><buffer> i$ <plug>(vimtex-i$)
omap <silent><buffer> a$ <plug>(vimtex-a$)
xmap <silent><buffer> id <plug>(vimtex-id)
xmap <silent><buffer> ad <plug>(vimtex-ad)
omap <silent><buffer> id <plug>(vimtex-id)
omap <silent><buffer> ad <plug>(vimtex-ad)
endif
if g:vimtex_toc_enabled
nmap <silent><buffer> <localleader>lt <plug>(vimtex-toc-open)
nmap <silent><buffer> <localleader>lT <plug>(vimtex-toc-toggle)
endif
if g:vimtex_labels_enabled
nmap <silent><buffer> <localleader>ly <plug>(vimtex-labels-open)
nmap <silent><buffer> <localleader>lY <plug>(vimtex-labels-toggle)
endif
if g:vimtex_view_enabled
nmap <silent><buffer> <localleader>lv <plug>(vimtex-view)
if has_key(b:vimtex, 'rsearch')
nmap <silent><buffer> <localleader>lr <plug>(vimtex-reverse-search)
endif
endif
if g:vimtex_mappings_math_mode if g:vimtex_mappings_math_mode
call s:init_math_mappings(s:mappings) call s:init_math_mappings(s:mappings)
call s:init_math_mappings(s:mappings_math) call s:init_math_mappings(s:mappings_math)