Closed drazulay closed 3 years ago
Update:
I got it partially working by using this code instead:
function! s:init_fern() abort
if exists('b:fern')
call fern#action#call("project-top:reveal")
endif
endfunction
augroup my-fern
au! *
au BufReadCmd fern://* call s:init_fern()
augroup END
It takes a few times opening and closing the drawer before the tree is rendered completely, so it's still not optimal.
Do you have suggestions for getting it to load and expand the tree at once?
Thanks!
See :help ++nested
I assume you mean to use au BufReadCmd fern://* nested call s:init_fern()
-- actually that's what I started out with because I plucked that straight from your fern code.
However, this doesn't change the behavior for me. I think it's more likely there should be another hook specific to the functionality of project-top instead of init_fern
, say.. project_top_reveal_after
or something like that. At least that would work for me.
Meanwhile I moved to another solution for filesystem navigation, so if you don't think this is an issue feel free to close it.
Ah, I'm sorry I misunderstood your question. Well, there is a viewer:ready
hook for that purpose which is documented in the developer's help
https://github.com/lambdalisue/fern.vim/blob/master/doc/fern-develop.txt#L281
Not sure if the below works or not. Use it at your own risk.
call fern#hook#add('viewer:ready', { -> fern#action#call('project-top:reveal') })
That's what I was looking for, thanks.
@lambdalisue I call a fern action like:
After re-sourcing config, the drawer shows nothing the first time, then doesn't open at all.
Could it be that
fern#action#call('project-top:reveal')
is executed too soon?Thank you for your outstanding modules :)