【问题标题】:How to open a pdf file from Vim using the default pdf application?如何使用默认的 pdf 应用程序从 Vim 打开 pdf 文件?
【发布时间】:2015-10-27 19:50:24
【问题描述】:

我想在默认的 pdf 查看器应用程序中使用来自 Vim 的文件链接打开 pdf 文件,该应用程序是我的 osx 上的 Preview。

gf 普通命令指向open Vim 内部的文件链接。但是 pdf 文件应该在外部应用程序中打开。

【问题讨论】:

  • gx 是您要查找的内容,但需要 netrw
  • @Ken 因为 netrw 与 Vim 捆绑在一起,所以这是正确的答案。考虑将其发布为答案。
  • @Spice 我配置netrw 使用根据文件扩展名打开的指定外部程序!检查我的答案。

标签: pdf vim


【解决方案1】:

正如@Ken 在 cmets 中所说,您应该使用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找到。

【讨论】:

    【解决方案2】:

    这是我的解决方案: Vim - set custom editors to open `.md` & '.pdf' files

    我们还需要启用打开带有 #page=101#chapter_example 前缀的 PDF 和 MARKDOWN 文档。

    【讨论】:

      猜你喜欢
      • 2019-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多