vimrc

My Vim configuration
git clone git://pcardenasb.com/vimrc
Log | Files | Refs | Submodules

thesis.vim (908B)


      1 edit document.tex
      2 syntax on
      3 set nolist
      4 autocmd TextChanged *.tex :write
      5 norm Gzb{{+
      6 
      7 function! Synctex()
      8         execute "silent !zathura -x \"vim --servername thesis --remote-expr \\\"execute('edit \\\%{input} | \\\%{line} | call Synctex()')\\\"\" --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " output/document.pdf >/dev/null 2>&1 &"
      9         redraw!
     10 endfunction
     11 
     12 function! ViewRef()
     13 	let match_list = matchlist(getline('.'), "^%% \\(\\a\\+\\d\\+\\) \\(\\d\\+\\)+\\(\\d\\+\\) \\(.*\\)$")
     14 	let ref = $BIB_DATA . "/" . match_list[1] . ".pdf"
     15 	let page = match_list[2] + match_list[3]
     16 	let search = match_list[4]
     17 	execute "silent !zathura " . ref . " -P " . page . " -f '" . search . "' >/dev/null 2>/dev/null&"
     18 
     19 	redraw!
     20 endfunction
     21 
     22 function! Action()
     23 	if match(getline('.'), "^\s*%%") == -1
     24 		call Synctex()
     25 	else
     26 		call ViewRef()
     27 	endif
     28 endfunction
     29 
     30 map <C-j> :call Action()<cr>
     31