I nearly successfully migrated my vim settings form Linux (ubuntu) on Mac. What I liked was the latex-suite for vim with the forward (press the compiling buttons and the generated dvi file will jumo straightly to this position) and inverse search (press CTR and the left mouse button in the dvi file and it will jump right to the place in the code of the tex file where you pressed). Under Linux it is working but not under MacVim. Here is a picture of the error message:
Here are my .vimrc settings for the latex suite:
" LateX SUITE HACKS
" =================
" inverse | forward search (http://forum.ubuntuusers.de/topic/vim-vim-latexsuite-vim-gtk)
" her are the forward search
:let g:Tex_ViewRule_dvi = 'xdvi -editor "vim --servername xdvi --remote +\%l \%f" $* &'
:let g:Tex_ViewRuleComplete_dvi = 'xdvi -editor "vim --servername xdiv --remote +\%l \%f" $* &'
" settings for determining tex filetype
:let g:tex_flavor = "latex"
map ,lj :execute '!cd ' . expand(Tex_GetMainFileName(':p:h')) . ' && xdvi -editor "vim --servername 'v:servername' --remote-wait +\%l \%f" -sourceposition ' . line(".") . substitute(expand('%:p'),expand(Tex_GetMainFileName(':p:h')).'\/','','') . " " . expand(Tex_GetMainFileName(':p:r')) . ".dvi &" <CR><CR>
" default output of compiling (pressing ,lj) is dvi
:let g:Tex_DefaultTargetFormat="dvi"
I got these settings from http://vim.wikia.com/wiki/Vim_can_interact_with_xdvi I'm starting vim with an alias like:
alias vi='/Applications/MacVim.app/Contents/MacOS/Vim -g'
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim -g'
It must have something to do with the xserver or maybe some wrong argument passing in the settings mentioned above. Hope someone can help me.
Matthias
in your vimrc try changing the lines with vim --servername
to use the full path of /Applications/MacVim.app/Contents/MacOS/Vim
you could put this in a variable
let g:vimPath = "/Applications/MacVim.app/Contents/MacOS/Vim"
then
:let g:Tex_ViewRule_dvi = 'xdvi -editor "' . g:vimPath . ' --servername xdvi --remote +\%l \%f" $* &'
:let g:Tex_ViewRuleComplete_dvi = 'xdvi -editor "' . g:vimPath . ' --servername xdiv --remote +\%l \%f" $* &'
" settings for determining tex filetype
:let g:tex_flavor = "latex"
map ,lj :execute '!cd ' . expand(Tex_GetMainFileName(':p:h')) . ' && xdvi -editor "' . g:vimPath . ' --servername 'v:servername' --remote-wait +\%l \%f" -sourceposition ' . line(".") . substitute(expand('%:p'),expand(Tex_GetMainFileName(':p:h')).'\/','','') . " " . expand(Tex_GetMainFileName(':p:r')) . ".dvi &" <CR><CR>
Please note MacVim is different to plain gvim in a number of ways and is not a standard X client application, the differences can be found with the command :help macvim
. The servername switch is still supported however so the above should help. Let me know how you go.