wincent/ferret

Play nicely with 'autochdir'

samuelallan72 opened this issue · 3 comments

Firstly, I use ferret all the time - great plugin! However, I also like autochdir (or at least a custom function that doesn't conflict with plugins like dirvish, and this have written a small wrapper around ferret to walk up directories until it finds a .git/ directory and run ferret from there to search project-wide. (See function in my dotfiles)
However, this has stopped working, because it seems that ferret now returns relative file names or something like that so when I open the file from the quickfix window it displays as a new file instead (because the file wasn't found). I'm wondering if there would be a way to make this work again, or if it would be possible to build this feature into ferret itself?

I don't know much vimscript, but would be happy to experiment and submit a pull request if possible (and I get a little support).

Thanks.

Thanks for posting the issue @swalladge. I don't specifically recall any changes in ferret to relativize paths, although it's possible that I am just forgetting them; I thought it just dealt with the paths as returned by the underlying search tool (ag, rg etc).

I'd be open to accepting a PR to support 'autochdir', but it's not something I personally would work on because I consider that to be a bit of an anti-feature (it's caused problems in Command-T; I generally think you're better off building and using tools that assume you stay in the project root: it makes things a lot simpler). We'd just need to be careful to make sure that it worked with all the underlying tools, and in the different execution environments (Neovim, Vim 7, Vim 8 etc).

Fair enough. Maybe I need to modify my workflow to remove the need for autochdir, since that messes up several plugins. Thanks.

I think that would be a good idea, but that's just my opinion. If 'autochdir' were "wrong" then the setting wouldn't exist, so each person has to figure out what works best for them.

I'm going to close this because I am not going to actively work on it myself, but I'd still be open to accepting PRs if anybody cares to look into it.