有没有办法让 vim 识别文件名末尾的行号?
我几乎只在终端中工作,并且经常需要查看错误堆栈跟踪中出现的文件。一种非常常见的格式是 /some/file:99
,其中 99 是行号。我希望能够复制该行,并在 vim 中轻松打开 goto 该行。
我正在寻找的是执行 :e /some/file:99
的能力,并且 vim 会在第 99 行自动打开该文件。是否存在这样的东西?如果没有的话可以写一个插件吗?
I work almost exclusively in the terminal, and very often I need to view files that appear in error stacktraces. A very common format is /some/file:99
, where 99 is the line number. I'd like to be able to copy that line, and open goto that line easily in vim.
What I'm looking for is the ability to do :e /some/file:99
, and vim automatically opens that file at line 99. Does something like this exist? If not, is it possible to write a plugin for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
编辑命令可以带选项,所以试试这个:
刚刚找到这个链接:
http://vim。 runpaint.org/basics/opening-files/
The edit command can take options, so try this:
Just found this link:
http://vim.runpaint.org/basics/opening-files/
如果您可以将
/some/file:99
重定向到文件,那么只需按gF
即可跳转到第 99 行的/some/file
当光标位于文件名上时。If you can redirect
/some/file:99
to a file then you can jump to/some/file
at line 99 by just pressinggF
when you cursor is on file's name.这个插件的设计考虑到了这个特定的目的:file:line
This plugin was designed with this specific purpose in mind: file:line
这个
/some/file:99
来自哪里?它是某些外部命令的输出吗?如果是这样,您应该阅读与快速修复模式相关的文档。 (:h 快速修复
)。Where does this
/some/file:99
comes from ? Is it the output of some external command ? If so, you should read the documentation related to the quickfix mode. (:h quickfix
).