I'm writing a plugin that lists related files to the file in the current buffer. It's mainly for working with MVC frameworks where view, model, and template files use the same filename (with different file extensions). I really like the list prompt in ctrlp.
However, there's one problem. If there's only one related file found, I'd like it to accept the file right away but couldn't get it to work. I've tried ctrlp#acceptfile() and sending key combo <CR> but none worked. I would much appreciate it if anyone can give me some advice on this.
How exactly did you do those? Checking if there's only one file then call the accept function right from the init function should do it. If you want to send <cr>, try using feedkey().
Actually, I don't think this is possible, at least not yet. The init function is called before the prompt is rendered to properly close it. And there's no other point to accept the file until a selection is made by the user.
Both ctrlp#accept and feedkeys didn't work. Wish there were hooks before and after the prompt is rendered with the list built in initx passed in. Might be there's no other uses beside my case.
Anyways, I really appreciate your help :)
+1 for this functionality!