tom-anders / telescope-vim-bookmarks.nvim

Integrates vim-bookmarks into telescope.nvim
MIT License
114 stars 23 forks source link

File paths are relatively shown depending on other files #2

Closed qualious closed 3 years ago

qualious commented 3 years ago
Screenshot 2021-05-23 at 21 47 31

Instead of showing either file name or shortened path given by telescope I've decided to implement a custom file name finder which behaves as such:

given files

a/b/c/d/e/f/
a/b/c/q/h/u
a/b/c/d/e/h

it shows

./e/f
./q/h/u
./e/h

Please feel free to modify the code.

tom-anders commented 3 years ago

Hmm this look like it's not really related to vim-bookmarks, i.e. some of Telescope's builtin pickers could also benefit from this, right? Maybe you should actually try to add this to the main Telescope repo?

Just a general remark, try to not mix whitespace/indentation-related changes with actual code changes, it makes the diff harder to read and review.

qualious commented 3 years ago

It's not related to vim-bookmarks but to this extension itself. I agree that Telescope can benefit from some similar logic but this doesn't handle all the edge cases (I covered as much as I can) and I'm not ready for that PR to Telescope.

Sorry for the formatting thing. I understand it makes it hard to follow but since there isn't a set formatter configuration I figured it's open to interpretation.

As it is, it works. If you want, you can merge it. If not, we can wait for Telescope to eventually release something like this.

tom-anders commented 3 years ago

No problem, I wasn't saying that you shouldn't change the formatting in general, just that it should be a separate commit (see git add -p).

Tbh I think (like you said) that this would be useful for Telescope in general. Maybe @tjdevries or @Conni2461 can take a look at this? Hope I'm not annoying them by randomly tagging them here 😬

Conni2461 commented 3 years ago

There is currently a effort in telescope core which tries to unify the whole filename/path "transforming" into a util function. That way extensions could also profit from that. This PR could be added to that util function as well that way everyone can profit easily :)

See https://github.com/nvim-telescope/telescope.nvim/pull/839

tom-anders commented 3 years ago

Ah perfect, I'd go with that approach then and close this PR here for now.

qualious commented 3 years ago

@tom-anders @Conni2461

I know this PR is closed but just wanted to mention that the PR is now open. It's on the hands of @caojoshua now.