4

I'm having hard time configuring CtrlP for vim the way I want it to work.

Ideally I'd like CtrlP to open with a list of files in most recently used order. However, when I start typing it would switch to searching for files under my current working directory.

This would allow me to switch buffers by pressing a button and then navigating recent files up and down, switch between two views with to presses and open a file in the project by typing its partial name.

My current CtrlP settings are as follows

nmap § :CtrlPClearCache<CR>:CtrlPMRUFiles<CR>

let g:ctrlp_working_path_mode='ra'
let g:ctrlp_match_window_bottom=0
let g:ctrlp_max_depth=10
let g:ctrlp_max_files=500
let g:ctrlp_mruf_relative=1

.. and I invoke CtrlP by pressing §.

Any tips how to improve my config to get the functionality I'm after, or teaching me a better way to achieve fast switching of buffers.

samuke
  • 450
  • 1
  • 5
  • 15
  • What about `:CtrlPBuffer`? – romainl May 20 '13 at 15:51
  • :CtrlPBuffer shows the open buffers. But what I'm aiming at instead is, when I start typing CtrlP should switch to just CtrlP, i.e. finding files inside current working directory. – samuke May 20 '13 at 15:53
  • `:CtrlPBuffer` *is* a "better way to achieve fast switching of buffers"; it is in fact the dedicated command for switching buffers so I don't know how you think it could be made faster. Also, what would be the point of showing a list of recent files and actively preventing you to filter it by replacing it with another list as soon as you type something? Isn't `` enough for changing "modes"? Anyway, could you please explain what you want with more clarity? – romainl May 20 '13 at 16:14
  • I'm trying to configure CtrlP so that whenever I open it I can select a recently opened file with arrow keys and enter. But should I start typing it would switch to looking for all the files in the project and not just the files I have recently opened. This would enable me to use CtrlP for both jumping between files I'm currently working with and opening new files I haven't touched lately. (Looking at the docs switches between matching file name and full path) – samuke May 20 '13 at 16:31
  • 1
    I meant ``, sorry. What you ask is not possible, AFAIK, but feel free to ask this feature to the plugin's author. The closest you can get is `:CtrlMixed` which mixes bufffers, files and mru. – romainl May 20 '13 at 17:11
  • I might just do that, thanks for your help. I looked :CtrlPMixed as one of the options, but it didn't display the most recently used items initially. – samuke May 20 '13 at 17:16
  • There's no "initially" possible at the moment. The only way to change the data source of the list is to actively switch modes. – romainl May 20 '13 at 18:46

1 Answers1

2

I've been asking myself the same question, and I realised CtrlP is not the right plugin for this task. So I went ahead implementing my own. Check out Bufstop. It allows fast switching between recent buffers using three, two or even one single key press.

mihai
  • 37,072
  • 9
  • 60
  • 86
  • Thanks for mentioning Bufstop. It does what I'd like CtrlP to do when I open it, namely displaying the open buffers. But what I'd like in addition is to be able to search for files starting from the current working directory by typing. So your plugin is not a fit for me, although an interesting one. – samuke May 23 '13 at 20:08
  • true, Bufstop is just a buffer switcher, you'll have to rely on CtrlP for fuzzy finding. You could try `CtrlPCurWD` for that job. – mihai May 23 '13 at 20:36