kien / ctrlp.vim

Fuzzy file, buffer, mru, tag, etc finder.
kien.github.com/ctrlp.vim
7.26k stars 677 forks source link

Opening files with CtrlP while in Fern Buffer #803

Open alexandersokolow opened 2 years ago

alexandersokolow commented 2 years ago

Hi,

when opening a file with CtrlP while in Netrw, the file would open in the current buffer.

Now I am using fern (https://github.com/lambdalisue/fern.vim) as my filebrowser & wanted to achieve the same behavior. However, when I am in a fern buffer and open a file with CtrlP, it opens in a vertical split.

I found a very hacky fix for that. In the main ctrlP file in the ctrlp#normcmd function I've changed the last line from retu a:0 ? a:1 : 'bo vne' to retu a:0 ? a:1 : 'e'

Obviously that suppresses the vertical split, but it probably produces some other problems. Haven't noticed any so far, when in a file with unsaved changes new files still open in a split, no problem there.

I'm pretty sure, that the problem arises because fern is using a custom buffertype / name (or whatever you'd call it). What I mean by that is, that when I am in fern and write :file I get something like "fern://...".

So ... Will this cause problems? If yes, is there another, better fix for it? Ideally it would be something, that I can put into my .vimrc, so that I don't have to change the code everytime I install the plugin on some machine ...

Greetings, Alexander

alexandersokolow commented 2 years ago

Yep, causes problems ... but that was predictable lol. Help would be appreciated :)