-1

Vim 有一个花哨的 NetRW 插件,可以让我输入

vim ftp://ftp.example.com/

并获得一个不错的目录列表,我可以通过在文件顶部按 CR 来编辑文件。

但是,我似乎无法对目录执行此操作。在我按 F1 时出现的帮助文件中,它说我应该能够:

BROWSING                                                netrw-cr {{{2

Browsing is simple: move the cursor onto a file or directory of interest.
Hitting the <cr> (the return key) will select the file or directory.
Directories will themselves be listed, and files will be opened using the
protocol given in the original read request.

但是,当我使用j/k导航到目录并按<cr>尝试打开它时,我得到:

somedirectory: Not a regular file

Vim 试图访问ftp://ftp.example.com/somedirectory. 请注意,它没有添加表示它是目录的斜杠。

我不知道为什么会发生这种情况。我怎样才能在 Vim 中简单地进入该目录,而不必退出 Vim 并重新键入vim ftp://ftp.example.com/somedirectory/

我在 Ubuntu 14.04 上运行 Vim 7.4。

4

1 回答 1

1

Vim 似乎并不知道我的目录真的是一个目录,因为/在目录列表中它后面没有显示符号。

幸运的是,我找到了一种方法来强制 NetRW 像一个文件一样是一个目录:gd.

FORCING TREATMENT AS A FILE OR DIRECTORY        netrw-gd netrw-gf {{{2

Remote symbolic links (ie. those listed via ssh or ftp) are problematic
in that it is difficult to tell whether they link to a file or to a
directory.

To force treatment as a file: use
        gf

To force treatment as a directory: use
        gd

因此,只需按gd而不是<cr>切换到光标下的目录。

我仍然不确定为什么 NetRW 认为我的目录是一个文件。帮助消息只说“远程符号链接”,它们不是(我认为)。它可能与我的网络主机(iPage)有关,它可能在任何地方都使用符号链接而不是实际目录。或者,也许我的结果有些无聊。

于 2014-09-13T23:14:12.773 回答