在 macvim 中启用 dvi 文档的逆搜索
我几乎成功地从 Mac 上的 Linux (ubuntu) 迁移了我的 vim 设置。我喜欢的是 vim 的 Latex 套件,具有正向搜索(按下编译按钮,生成的 dvi 文件将直接跳转到该位置)和反向搜索(在 dvi 文件中按 CTR 和鼠标左键,它将向右跳转)到 tex 文件代码中您按下的位置)。在 Linux 下可以工作,但在 MacVim 下不行。这是错误消息的图片:
这是我的 Latex 套件的 .vimrc 设置:
" 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"
我得到这些设置来自 http://vim.wikia.com/wiki/Vim_can_interact_with_xdvi 我用这样的别名启动 vim:
alias vi='/Applications/MacVim.app/Contents/MacOS/Vim -g'
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim -g'
它必须与 xserver 有关,或者可能是在上面提到的设置中传递了一些错误的参数。希望有人能帮助我。
马蒂亚斯
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的 vimrc 中尝试使用
vim --servername
更改行以使用/Applications/MacVim.app/Contents/MacOS/Vim
的完整路径,你可以将其放在变量then
请注意 MacVim 在很多方面与普通 gvim 不同,并且不是标准的 X 客户端应用程序,可以使用命令
:help macvim
找到差异。不过,服务器名称开关仍然受支持,因此上述内容应该有所帮助。让我知道你进展如何。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 variablethen
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.