bib.vim (1178B)
1 command! BibOpenFile exe 'call system("open '.findfile(expand("<cfile>")).'")' 2 nnoremap go :BibOpenFile<CR> 3 4 setlocal suffixesadd+=.pdf 5 let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '') 6 let b:undo_ftplugin .= 'setlocal suffixesadd<' 7 8 function! s:NextSection(backwards, visual) 9 if a:visual 10 normal! gv 11 endif 12 let pattern = '\v(^\@[a-zA-Z]+\{)|%^|%$' 13 execute 'silent normal! ' . (a:backwards ? '?' : '/') . pattern . (a:backwards ? '?' : '/') . "b\r" 14 endfunction 15 16 noremap <script> <buffer> <silent> ]] 17 \ :call <SID>NextSection(0, 0)<cr> 18 19 noremap <script> <buffer> <silent> [[ 20 \ :call <SID>NextSection(1, 0)<cr> 21 22 noremap <script> <buffer> <silent> ][ 23 \ :call <SID>NextSection(0, 0)<cr> 24 25 noremap <script> <buffer> <silent> [] 26 \ :call <SID>NextSection(1, 0)<cr> 27 28 vnoremap <script> <buffer> <silent> ]] 29 \ :<c-u>call <SID>NextSection(0, 1)<cr> 30 31 vnoremap <script> <buffer> <silent> [[ 32 \ :<c-u>call <SID>NextSection(1, 1)<cr> 33 34 vnoremap <script> <buffer> <silent> ][ 35 \ :<c-u>call <SID>NextSection(0, 1)<cr> 36 37 vnoremap <script> <buffer> <silent> [] 38 \ :<c-u>call <SID>NextSection(1, 1)<cr>