我正在处理一个由多个子项目组成的项目,它们都在同一个 Git 代码库中:
Project
- Sub Project A
- Sub Project B
- ...
我从不在主文件夹上工作,总是从其中一个子项目开始,问题是无论我尝试什么,CtrlP始终从存储库所在的主文件夹开始搜索。
我已经尝试了一些项目存储库中的设置,如下所示,但仍然无法使其产生任何效果。
let g:ctrlp_working_path_mode = 'ca'
请问有什么提示吗?
我正在处理一个由多个子项目组成的项目,它们都在同一个 Git 代码库中:
Project
- Sub Project A
- Sub Project B
- ...
我从不在主文件夹上工作,总是从其中一个子项目开始,问题是无论我尝试什么,CtrlP始终从存储库所在的主文件夹开始搜索。
我已经尝试了一些项目存储库中的设置,如下所示,但仍然无法使其产生任何效果。
let g:ctrlp_working_path_mode = 'ca'
请问有什么提示吗?
let g:ctrlp_working_path_mode = ''
。然后它只会在Vim的当前工作目录中搜索,所以只需要:cd
到你的子项目目录之一。let g:ctrlp_custom_ignore = { 'dir': '\v[\/]Sub Project [AB]$' }
(未经测试)。let g:ctrlp_root_markers = ['Sub Project A','Sub Project B']
。这应该阻止CtrlP超越这些子目录。.git
文件夹),并将其视为顶层目录。.git
目录在我的家目录中。
'g:ctrlp_working_path_mode'
When starting up, CtrlP sets its local working directory according to this variable: let g:ctrlp_working_path_mode = 'ra'
c - the directory of the current file. a - like "c", but only applies when the current working directory outside of CtrlP isn't a direct ancestor of the directory of the current file. r - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr _darcs w - begin finding a root from the current working directory outside of CtrlP instead of from the directory of the current file (default). Only applies when "r" is also present. 0 or <empty> - disable this feature.
Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as a fallback) when a root can't be found.
Note #2: you can use a b:var to set this option on a per buffer basis.