kelly-lin / ranger.nvim

Ranger plugin for neovim
MIT License
152 stars 13 forks source link

[FEATURE] open directory using nvim #23

Closed VardanHeroic closed 2 weeks ago

VardanHeroic commented 1 month ago

Some times when I'm opening nvim I forgot to write full path of file and when I accidentally opened directory instead of file it just opened ranger in home directory and needed to exit nvim and write command again. So I decided to make it open the directory I wrote.

kelly-lin commented 4 weeks ago

Hi @VardanHeroic, thanks for your contribution. Just had a play around with it and looks good to me. Only thing I found is that with the current implementation is that ranger will open with the focus on the directory passed in and its current directory set to the parent of the directory passed in.

I think it would make more sense if we set the rangers current directory to the directory passed in instead of the parent. We can do this by adding in the flag --cmd="cd $DIR_PATH" to the ranger command.

We also need to add a check if the directory exists or not, if it doesn't exist then we should fallback to the default behaviour.

VardanHeroic commented 3 weeks ago

If directory doesn't exist it just opens empty editor

kelly-lin commented 2 weeks ago

LGTM! Thanks for your contribution!