Vim:我如何知道函数是在哪里定义的? (

发布于 2024-09-01 17:03:14 字数 1345 浏览 6 评论 0原文

我昨天刚刚安装了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

白芷 2024-09-08 17:03:14

使用 :verbose 前缀命令:

:verbose function Tex_ViewLaTeX

输出的第二行(函数体的正上方)是定义函数的位置。

Use the :verbose prefix command:

:verbose function Tex_ViewLaTeX

In the second line of output (just above the function's body) is the location of where the function was defined.

彻夜缠绵 2024-09-08 17:03:14

我在 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

掐死时间 2024-09-08 17:03:14

一种搜索方法是在您认为源文件所在的目录树上执行 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

兮颜 2024-09-08 17:03:14

将其放入您的 .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'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文