Skip to content

Opening files with CtrlP while in Fern Buffer #803

Description

@alexandersokolow

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions