首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让CtrlP找到我的文件

如何让CtrlP找到我的文件
EN

Stack Overflow用户
提问于 2013-10-04 15:19:53
回答 1查看 3K关注 0票数 1

我在配置vim插件CtrlP时遇到问题。我通常在3种不同的目录(例如C:/AC:/B/DJ:/A )中处理文件,当我启动vim并尝试查找文件时,CtrlP没有找到任何文件。

那么,如何才能让CtrlP首先查看这些目录呢?其次,我希望CtrlP记住我打开的所有文件,因为我很可能再次打开它们,我如何告诉CtrlP这样做呢?

这是我的配置

代码语言:javascript
复制
"=============================
"=========== CTRLP ===========
"=============================
">>Use this option to change the mapping to invoke CtrlP in |Normal| mode
let g:ctrlp_map = '<c-p>'
">>Set the default opening command to use when pressing the above mapping
let g:ctrlp_cmd = 'CtrlP'
">>searching by filename (as opposed to full path)
let g:ctrlp_by_filename = 0 "in {0,1}
">>When opening a file, if it's already open in a window somewhere, CtrlP will try
"  to jump to it instead of opening a new instance
let g:ctrlp_switch_buffer = 'E'
">>Set the directory to store the cache files
let g:ctrlp_cache_dir = 'C:/Travail/Tools/vim-7.4.020-python-2.7-python-3.3-windows-x86/bundle/ctrlp.vim-master/cacheFiles'

附加问题:在这个插件中,和其他插件一样,我想提到$VIM,对我来说它就是C:/Travail/Tools/vim-7.4.020-python-2.7-python-3.3-windows-x86,但是在这里,看起来CtrlP不理解它,我如何修改g:ctrlp_cache_dir以使用$VIM

EN

回答 1

Stack Overflow用户

发布于 2013-10-04 15:49:04

您的问题实际上与CtrlP无关,因为它只是试图遵循Vim自己的模式。

其中一个模式是“工作目录”:它是在Vim启动时自动设置的,以后可以更改,但它通常是项目的顶级目录。要使CtrlP和Vim能够找到您的文件,您必须将工作目录设置为三个目录的父目录。这是在:cd /path/to/dir上完成的,但我的印象是,您将无法在Windows上找到这样的dir。

或者,可以将映射添加到您的vimrc中。

代码语言:javascript
复制
nnoremap <key> :CtrlP /path/to/dir1<CR>
nnoremap <key> :CtrlP /path/to/dir2<CR>
nnoremap <key> :CtrlP /path/to/dir3<CR>

并使用:CtrlPMRU:CtrlPMixed

我同意Ingo的观点,这是问题追踪器的东西。

但是,实际上,你需要的是整合你所有的东西和修正你的工作流程。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19184923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档