Vim ctrlp插入加载我的电脑中的所有文件而不是当前目录(Vim ctrlp plug in loading all files in my computer instead of current

编程入门 行业动态 更新时间:2024-10-28 12:18:40
Vim ctrlp插入加载我的电脑中的所有文件而不是当前目录(Vim ctrlp plug in loading all files in my computer instead of current directory)

我正在使用MacVim的ctrlp插件来查找文件。 它应该只将当前目录中的文件加载到文件缓冲区。 例如,我曾经可以cd到目录中,然后在命令行输入mvim 。 这将加载当前目录中的所有文件,并且只加载该目录,这对于Rails项目来说非常棒。 然后我的文件发现只会在该目录中搜索。

但是,最近当我在某个目录中键入mvim时,vim文件缓冲区就是我的计算机上的所有文件,而不是当前目录中的文件,因此找到我需要的确切index.html.haml是不可能的。

奇怪的是,当我说mvim . 它只会告诉我当前目录中的文件和文件夹,这是我所期望的。 当我键入:pwd ,它告诉我我所在的路径是当前目录(一个Rails项目)。 但是当我输入时,t找到一个文件,它就是我电脑上的所有文件。

这是一个截图。 我已经编辑了一个Rails项目并输入了,t来使用ctrlp插件启动文件导航器,然后我键入config.rb ,它应该只显示该目录的config.rb文件,但是相反,它是所有的config.rb在我的系统上!

I'm using MacVim with the ctrlp plug in for a file finder. It's supposed to load files in just the current directory to the file buffer. For example, I used to be able to cd into a directory, and then type mvim at the command line. That would load all the files in the current directory and only that directory, which was awesome for, say, a Rails project. Then my file finds would only search in that directory.

Recently, though, when I type mvim in a certain directory, the vim file buffer is all the files on my computer, rather than in the current directory, so finding the exact index.html.haml I need is impossible.

The weird thing is that when I say mvim ., it only tells me the files and folders in the current directory, which I would expect. And when I type :pwd, it tells me that the path I'm in is the current directory (a Rails project). But when I type ,t to find a file, it's all the files on my computer.

Here is a screenshot. I've cded into a Rails project and have typed ,t to bring up the file navigator using the ctrlp plugin, and I typed config.rb which should only bring up that directory's config.rb file, but instead, it's all the config.rb's on my system!

最满意答案

我去了ctrlp的GitHub页面提出问题,并遇到了这个问题。 针对某个问题的建议修复方法是将当前目录中的默认行为作为关闭对象,所以我只是明确地将默认值添加到了~/.vimrc ,它修复了它:

let g:ctrlp_working_path_mode = 0

编辑

虽然将该行添加到我的~/.vimrc确实可以解决问题,但没有解决此问题的根本原因。 ctrlp的创建者建议我在我的home文件夹( ctrlp正在查找)中创建了一个git存储库,我以某种方式拥有该存储库。 因此,针对此问题的另一个更根本的解决方法是只删除我的主文件夹中的.git目录:

$ rm -r ~/.git

I went to the GitHub page for ctrlp to file an issue and came across this issue. The suggested fix for an issue was to turn off starting in the current directory as a default behavior, so I just explicitly added the default to ~/.vimrc, which fixed it:

let g:ctrlp_working_path_mode = 0

EDIT

While adding that line to my ~/.vimrc did indeed fix the problem, it didn't address the root cause of this issue. The creator of the ctrlp suggested that I had created a git repository in my home folder (which ctrlp was looking in), which I somehow had. So another, more root fix for this issue was to just remove the .git directory in my home folder:

$ rm -r ~/.git

更多推荐

本文发布于:2023-08-07 18:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465711.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脑中   而不是   我的电   加载   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!