Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get CtrlP to set working dir as root folder

Tags:

vim

vim-plugin

Im working on project that is in fact composed of several subproject, under a common git repository:

Project
   - Sub Project A
   - Sub Project B
   - ...

I never work on the main folder, and always start from one of the sub projects, the problem is no matter what I try CtrlP always does the search starting from the main folder where the repo is.

I've tried a few settings from the project repo but no matter, such as bellow, but still can't get it to make any effect.

let g:ctrlp_working_path_mode = 'ca'

Any tips please?

like image 807
Luis Martins Avatar asked Apr 01 '15 19:04

Luis Martins


Video Answer


1 Answers

Looking at the CtrlP docs suggests that you have three options:

  1. Disable CtrlP's working directory searching: let g:ctrlp_working_path_mode = ''. It will then only search under Vim's current working directory, so just :cd to one of your sub projects' directories.
  2. Ignore the sub project directories that you are not interested in: let g:ctrlp_custom_ignore = { 'dir': '\v[\/]Sub Project [AB]$' } (untested).
  3. Add Sub Project A, Sub Project B, etc. as root markers: let g:ctrlp_root_markers = ['Sub Project A', 'Sub Project B']. This should stop CtrlP from traversing up beyond those sub directories.

I would suggest the first option since the others are a bit too hacky for my taste. The last option also didn't work for me in a quick test.

like image 200
Walter Avatar answered Sep 30 '22 14:09

Walter