Vim:我如何知道函数是在哪里定义的? (
我昨天刚刚安装了 macvim 并且安装了 vim Latex 今天。
菜单项之一是调用损坏的函数(TeX-Suite -> view
)。
当我单击菜单时间时,它会进行以下调用:
:silent! call Tex_ViewLatex()
问题:在哪里可以找到该函数?有什么方法可以找出它的定义位置吗?
出于好奇,我删除了沉默部分并运行了以下命令:
:call Tex_ViewLatex()
哪个产生:
Error detected while processing function Tex_ViewLaTeX:
line 34:
E121: Undefined variable: s:viewer
E116: Invalid arguments for function strlen(s:viewer)
E15: Invalid expression: strlen(s:viewer)
line 39:
E121: Undefined variable: appOpt
E15: Invalid expression: 'open '.appOpt.s:viewer.' $*.'.s:target
line 79:
E121: Undefined variable: execString
E116: Invalid arguments for function substitute(execString, '\V$*', mainfname, 'g'
)
E15: Invalid expression: substitute(execString, '\V$*', mainfname, 'g')
line 80:
E121: Undefined variable: execString
E116: Invalid arguments for function Tex_Debug
line 82:
E121: Undefined variable: execString
E15: Invalid expression: 'silent! !'.execString
Press ENTER or type command to continue
我怀疑如果我可以看到源函数,我可以找出哪些输入是错误的或者它正在寻找什么。
I just installed macvim yesterday and I installed vim latex today.
One of the menu items is calling a broken function (TeX-Suite -> view
).
When I click on the menu-time it makes this call:
:silent! call Tex_ViewLatex()
Question: Where can I find that function? Is there some way to figure out where it is defined?
Just for curiosity sake I removed the silent part and ran this:
:call Tex_ViewLatex()
Which produces:
Error detected while processing function Tex_ViewLaTeX:
line 34:
E121: Undefined variable: s:viewer
E116: Invalid arguments for function strlen(s:viewer)
E15: Invalid expression: strlen(s:viewer)
line 39:
E121: Undefined variable: appOpt
E15: Invalid expression: 'open '.appOpt.s:viewer.' $*.'.s:target
line 79:
E121: Undefined variable: execString
E116: Invalid arguments for function substitute(execString, '\V$*', mainfname, 'g'
)
E15: Invalid expression: substitute(execString, '\V$*', mainfname, 'g')
line 80:
E121: Undefined variable: execString
E116: Invalid arguments for function Tex_Debug
line 82:
E121: Undefined variable: execString
E15: Invalid expression: 'silent! !'.execString
Press ENTER or type command to continue
I suspect that if I could see the source function I could figure out what inputs are bad or what it is looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用
:verbose
前缀命令:输出的第二行(函数体的正上方)是定义函数的位置。
Use the
:verbose
prefix command:In the second line of output (just above the function's body) is the location of where the function was defined.
我在 windows 和 Latex-suite 上安装了 gVim 7.2,还有 miktex
我尝试了你所说的,编译和查看后,我可以查看dvi文件
错误消息似乎表明这是视图的问题
latex-suite的文档说Macintosh的查看器未设置,也许这就是问题所在
我认为你可以尝试在 .vimrc 文件中设置一些变量,为 PDF 文件设置正确的查看应用程序
Tex_ViewLaTeX 的源代码在这里:
http://www.tedpavlic.com/research_lated/tpavlic_masters_thesis/compiler.vim
顺便说一句,我也在我的 Macbook Pro 上安装了 MacVim,但是我从来没有用 vim 来进行 LaTeXing,因为我发现 TextMate 和它的 Latex 包比 MacVim 优越得多,你一定会喜欢它
I installed gVim 7.2 on windows and latex-suite, and miktex too
I tried what you said, after compile and view, I can view the dvi files
The error message seemed like to indicate it's the view's problem
The document for latex-suite said the viewer for Macintosh is not set, maybe it's where the problem lies
I think you can try to set a few variables in your .vimrc file, to set up the proper viewing app for PDF files
And the source code for Tex_ViewLaTeX is here:
http://www.tedpavlic.com/research_related/tpavlic_masters_thesis/compiler.vim
By the way, I also installed MacVim on my Macbook Pro, however I never used vim for LaTeXing, because I find TextMate and its latex bundle is much superior than MacVim, you'll definately like it
一种搜索方法是在您认为源文件所在的目录树上执行 grep 或 vimgrep。搜索“函数 Tex_ViewLatex”或“函数!” Tex_ViewLatex'。
我相信在通常的安装中它将位于 .../ftplugin/latex-suite/compiler.vim 文件中,作为 Latex-suite 插件的一部分。有几个 ftplugin 目录,因此请确保您找到正确的一个(一个位于主 vim 安装树中,另一个可能位于您的主 .vim 目录之外。
似乎 OS X 上的 Tex_ViewLatex 函数存在错误。请检查此处一些信息:
http://comments.gmane.org/gmane.comp。 editors.vim.latex.devel/775
One way to search would be to do a grep or vimgrep on directory tree where you thought the source file was located. Search for 'function Tex_ViewLatex' or 'function! Tex_ViewLatex'.
I believe in the usual install it would be in a .../ftplugin/latex-suite/compiler.vim file, as part of the latex-suite plugin. There are a couple ftplugin directories, so make sure you get right one (one is in tree of main vim install and other may be off your home .vim directory.
It seems there is a bug with the Tex_ViewLatex function on OS X. Check here for some info:
http://comments.gmane.org/gmane.comp.editors.vim.latex.devel/775
将其放入您的 .vimrc 中,为我解决了问题。
让 g:Tex_ViewRule_pdf = '打开 -a Preview.app'
Put this in your .vimrc, solved the problem for me.
let g:Tex_ViewRule_pdf = 'open -a Preview.app'