When I'm browsing folders in LeaderF is there a way to move to the parent folder?

Background: I'm building a vim (Neovim) profile and looking at file/buffer explorers, and LeaderF seems useful. (I've used CtrlP previously and liked it; I can't make heads or tails of denite.) It makes sense that LeaderF starts in the same directory as the current file (I have set autochdir): this is usually what I want. However it seems to me that in many cases I would want to broaden the scope of my search by moving to the parent folder.

I expected that LeaderF would provide a binding for this and the fact that the functionality doesn't exist makes me think that I'm using it wrong.

How do others typically use LeaderF?

New contributor
Michael Iles is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • I haven't used LeaderF, but for me it makes sense that a fuzzy finder is pinned to the project root in some way. I normally keep Vim's notion of the current directory pinned to the project root because then everything is relative to that. CtrlP lets you control this behavior, where the default is to search up your directory tree until it finds a source control file/directory indicating the root (e.g. a .git folder), and use that to pin the search, but you can also have it use the current directory or Vim's working directory. LeaderF may have a similar setting. – Jim Stewart 2 days ago
  • @JimStewart LeaderF works this way, but in some cases you don't have .git or other project markers. So you try to open a file and there is current file directory+subdirectories list and no way to go up. The workaround is to close LeadefF and reopen it with :LeaderfFile .. – Maxim Kim yesterday

I have similar setup (set autochdir) and sometimes I face the same issue for the folders without root markers (.git, .hg ...).

I was using workaround described in comment to your question -- close and reopen leaderf with parent folder:

:LeaderfFile ..

I have cnoremap lf LeaderfFile defined, so it is easy to type.

But today I have come up with the other solution.

You can change "normal" mappings of leadefF:

    let g:Lf_NormalMap = {
    \ "File":   [["u", ':LeaderfFile ..<CR>']]
    \}

This way you can press <tab> to go to LeaderfFile normal mode and then press u to reopen LeadefFile with parent folder.

PS,

There is also g:Lf_CommandMap that is used to remap some bindings in the prompt but I am not sure if I can run ex commands there.

Your Answer

Michael Iles is a new contributor. Be nice, and check out our Code of Conduct.
 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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