简体   繁体   English

Linux vim中缺少文件资源管理器

[英]Lack of file explorer in Linux vim

In vim 7.3 on OSX, if I type 在OSX的vim 7.3中,如果输入

vim ~/myfiles

vim will put me into the Vim File Explorer for that directory, and I can open or rename files. vim会将我放到该目录的Vim File Explorer中,并且我可以打开或重命名文件。

In vim 7.4 on Ubuntu, I get the unhelpful error message 在Ubuntu上的vim 7.4中,我收到了无用的错误消息

"~/myfiles" is a directory

Looking through the compiled options (vim --version) and online documentation, I see no obvious way to activate this functionality through, say, a command-line or compile-time option. 查看编译的选项(vim --version)和在线文档,我看不出明显的方法可以通过命令行或编译时选项激活此功能。 It is such a great feature of vim that I'm surprised it is not enabled on the version of vim available in the Linux package. vim如此强大的功能令我感到惊讶,Linux软件包中提供的vim版本没有启用该功能。

:E命令用于资源管理器模式。

The ability to edit a directory like this depends on a plugin. 像这样编辑目录的能力取决于插件。 Most of the time, that plugin is the "netrw" plugin provided with Vim in the official runtime files. 大多数时候,该插件是Vim在官方运行时文件中提供的“ netrw”插件。 In Ubuntu (and Debian) you install that runtime separately so that every Vim package can use it rather than duplicating functionality. 在Ubuntu(和Debian)中,您分别安装该运行时,以便每个Vim软件包都可以使用它,而不是复制功能。 Try installing the vim-runtime package, and maybe a more feature-full Vim while you are at it, if you have not already done so. 如果尚未安装,请尝试安装vim-runtime软件包,或者安装功能更全的Vim。

To summarize and answer my own question... 总结并回答我自己的问题...

File explorer functionality is actually provided by a plug-in, "netrw", which seems not to be installed by default in the two or three versions of vim I tried via apt-get. 文件浏览器功能实际上是由插件“ netrw”提供的,在我通过apt-get尝试的两个或三个版本的vim中,默认情况下似乎未安装该文件。

Installing NERDTree solved the problem brilliantly - it can do so much more than the default explorer. 安装NERDTree可以很好地解决该问题-它可以做的比默认资源管理器还多。 I have not yet figured out how to rename a file using NERDTree - something that is easy with 'netrw', but that is a minor irritant and there is probably a way to do it. 我还没有弄清楚如何使用NERDTree重命名文件-使用'netrw'很容易,但这是一个小麻烦,可能有一种解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM