2

I like using the CtrlP plugin's CtrlPBuffer command for quickly switching between buffers, as well as using CtrlP for navigating to files not yet opened. However, I have one annoyance I'd like to fix. When I use CtrlPBuffer, it shows a list of files with the filename in the first column and the containing path in the second column. This means when I want to match a file, I need to enter the filename first and then the path. However, for the regular CtrlP command, this is reversed. I'd like to have this consistent, i.e. that for CtrlPBuffer I can enter parts of the path before entering parts of the filename.

For example, if my directory tree contains:

folder/file.py
folder2/file.py

Entering 2f will match the second file when using CtrlP, but not when using CtrlPBuffer. Is there any way to make this work?

2

Set ctrlp_bufname_mod on your .vimrc file:

let g:ctrlp_bufname_mod = ':p'

You can finetune this, check filename-modifiers in CtrlP docs (:help filename-modifiers)

| improve this answer | |
  • Nice, thanks! I've settled on let g:ctrlp_bufname_mod = ':~:.', which does exactly what I want. – Mark May 9 '17 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.