如何在Vim中使用默认的pdf应用程序打开pdf文件?

11

我希望能够在我的osx系统上,使用默认的pdf阅读器Preview,通过文件链接从Vim中打开pdf文件。

Vim中有一个名为gf的普通命令,可以打开一个文件链接。但pdf文件应该在外部应用程序中打开。


6
“gx” 是你正在寻找的内容,但需要使用“netrw”才能实现。 - Spice
2
@Ken 既然 netrw 已经与 Vim 捆绑在一起了,那就是正确的答案。考虑将其发布为答案。 - glts
@Spice 我配置了 netrw 来使用指定的外部程序,这些程序根据文件扩展名打开!请查看我的回答。 - 71GA
2个回答

8

正如@Ken在评论中所说,你应该使用gx

Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
best seen with a special handler (ie. a tool provided with your computer).
Netrw allows one to invoke such special handlers by:

    * when Exploring, hit the "x" key
    * when editing, hit gx with the cursor atop the special filename

更多信息可以在:help gx中找到。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接