Closed Shatur closed 4 years ago
Probably, this tip helps you.
https://github.com/lambdalisue/fern.vim/wiki/Tips#perform-tcd-when-enterleave-only-in-drawer-style
Got it. It's a bit complicated than I thought and the tips does not work currently. I'm working on this issue on #108 👍
@lambdalisue, thanks! Should I use on of these commands in the tip above instead?
I'll mention you once the PR become ready to test 👍
Okay, thanks :)
I tried the following mappings, but this the directory still mapped to the previous dir. Am I using it ok?
nmap <buffer><expr> <S-k> '<Plug>(fern-action-leave)<Plug>(fern-action-cd:root)'
nmap <buffer><expr> <C-CR> '<Plug>(fern-action-enter)<Plug>(fern-action-cd:root)'
That's why the PR said "partial". Please check #108 and give me your opinion. @Shatur95
And actually your usage was wrong. You need to use "
and escape <Plug>
or <C-x>
or soon with \
when you use string in mapping
That's why the PR said "partial". Please check #108 and give me your opinion.
Tested, works! But it looks like fern-action-cd:root
changes directory only for current fern buffer. I would expect to change directory globally.
And actually your usage was wrong. You need to use " and escape
or or soon with \ when you use string in mapping
Did not know about it. I used the following mappings and it works as expected:
nmap <buffer><expr> m '<Plug>(fern-action-move)'
nmap <buffer><expr> r '<Plug>(fern-action-rename)'
nmap <buffer><expr> d '<Plug>(fern-action-trash)'
nmap <buffer><expr> y '<Plug>(fern-action-clipboard-copy)'
nmap <buffer><expr> c '<Plug>(fern-action-clipboard-move)'
Also, the following works too:
nmap <buffer><expr><silent> <S-k> '<Plug>(fern-action-leave):call fern#smart#ready("\<Plug>(fern-action-tcd:root)")<CR>'
nmap <buffer><expr><silent> <C-CR> '<Plug>(fern-action-enter):call fern#smart#ready("\<Plug>(fern-action-tcd:root)")<CR>'
Also, in documentation you have examples without ' and ". Is it a typo?
Tested, works! But it looks like fern-action-cd:root changes directory only for current fern buffer. I would expect to change directory globally.
It's strange. I confirmed that cd
action invoke :cd
command and it change global cwd.
Are you sure that no :lcd
or :tcd
had applied? These command fix cwd on buffers.
Also, in documentation you have examples without ' and ". Is it a typo?
My bad. I didn't know that '
is accepted and \
escape is not required for <expr>
mapping. These are required for :normal
thus I mis-understood.
I changed the way. Please check https://github.com/lambdalisue/fern.vim/pull/112 @Shatur95
I like new way much more :)
Tested, it works, but I have the same issue with cd. Here is the video, maybe I doing something wrong:
(I missed \
for enter
action, but it do not used on the video)
Only 2 does not work
Yes, also it looks like mappings to keyboard with <expr>
works too:
nmap <buffer><expr> m '<Plug>(fern-action-move)'
nmap <buffer><expr> r '<Plug>(fern-action-rename)'
nmap <buffer><expr> d '<Plug>(fern-action-trash)'
nmap <buffer><expr> y '<Plug>(fern-action-clipboard-copy)'
I'd love to classify the issue so please execute cd:root
action and cd
action directly (from hitting a
) and see what happen.
Additionally, I guess that cd:root
or cd
does not work on your environment so please provide me your environment information (OS, Vim/Neovim, version, etc.)
Closed by #112
You are right, the problem is in cd
and cd:root
command in my environment. I will test without any plugins first (except fern.vim) and then will open a new issue.
The last thing about current issue: I can automatically make a command to cd:root
after Fern execution in my shortcut, but maybe add an option to cd to current root automatically on -reveal
?
I will test without any plugins first (except fern.vim) and then will open a new issue.
I'm very sorry, the issue not in fern.vim at all. For some reason when opening a buffer from Startify :cd
(even Ex command) do not affects to this opened buffer when executed in other buffer. Very strange.
Then Startify may invoke :lcd
or :tcd
internally. Use tcd:root
action instead then.
Then Startify may invoke :lcd or :tcd internally. Use tcd:root action instead then.
I tried, even :tcd
Ex command not work :(
I tried, even :tcd Ex command not work :(
I looked as Startify source code and it uses :lcd
. After :lcd
I can't change current directory for such buffers even with :tcd
.
I tried, even :tcd Ex command not work :(
That's sad. But I understand that lcd is more specific than tcd....
I looked as Startify source code and it uses :lcd. After :lcd I can't change current directory for such buffers even with :tcd.
Then probably you should maka an issue report on startify.
NERDTree have the ability to automatically synchronize vim working directory with current root. Could you add an option for it in Fern? For example, change vim working directory on
fern-action-leave
,fern-action-enter
, etc. and onreveal
.