New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling fugitive links in quickfix #3021
Comments
Is this a bug? For |
No, I create issue about feature request.
Quickfix. without preview instead of something like this My cfg: defaults = {
scroll_strategy = 'limit',
layout_strategy = 'bottom_pane',
layout_config = {
bottom_pane = {
height = 15, -- TODO
prompt_position = 'bottom',
},
},
border = false,
path_display = { truncate = 5 }, --TODO
borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└' }, -- TODO
dynamic_preview_title = true,
} |
Bad news for me. That's the main reason I created this issue. Without I just can't see which file I choose, It makes telescope unusable in this case. I'm honestly surprised support for this wasn't added earlier, I seemed vim-fugitive is very popular. What if I implement this on my own in my spare time, can it be combined? |
Problem is, URIs come in variety of types and figuring out which are usable as path (ideally for a local file - we probably won't support fetching non-local files for preview purposes) could be tricky.
Probably obviously the If you or anyone else has thoughts, I'm open to them. |
Oh I just had a quick idea, I think there's something like |
As I said, we can use
this output of { "4f3ae7ef3c36f06ecf1c9c467de8e0e7ca117031:hosts/liveCD/default.nix", "/home/name_snrl/nixos-configuration/.git" } Now we just need to truncate the hash to 7 characters and show it to the user:
We are talking about files in git, I don't think they are stored as plain files in the git directory, but we can easily use the output of git --git-dir=/home/name_snrl/nixos-configuration/.git show 4f3ae7ef3c36f06ecf1c9c467de8e0e7ca117031:hosts/liveCD/default.nix |
The only thing I'm not sure about is that we should use or ask @tpope |
This isn't exclusively a fugitive issue though. It's a general issue with how telescope handles file path type URIs. So I don't really want a fugitive specific solution. |
I apologize, I misunderstood you. In any case, I don't think there can be one single solution that will also cover fugitive URI. Going back to the previous question, if I implement what I described above through a matching for a fugitive URI, will it merge? |
Fugitive does offer an API that attempts to fulfill these requirements. Take the scheme of the URL ( So preview could conceivably be backed by |
Wouldn't this still require all plugins telescope interacts with that uses file URIs support a similar Reason why |
Yes, any solution would require some sort of common API. This is the only one I'm aware of that's been designed. Mirroring the Vim API means it's not designed with Fugitive's needs in mind; it covers everything Vim can do (Neovim specific APIs not withstanding).
oil.nvim is free to implement it. Might make sense to extend it to |
Is your feature request related to a problem? Please describe.
Yes, for the
fugitive://
files, preview andpath_display
don't work. You can check it bv running:G difftool <hash> <hash>
.Describe the solution you'd like
The
vim-fugitive
provides theFugitiveParse()
function, which returns a list that containing commit_hash:relative_path and git_dir strings. We can use this to display a more informative entries.It also has
fugitive#BufReadCmd()
, this function is run by autocmd when you open a buffer to fill it with a file from a particular commit. I'm not very familiar with vimL, but as I understand it, it just callsgit cat-file
orgit show
under the hood. I also don't know much about both, fugitive and telescope, to say which is a better way to fix the preview using this function, or write our own that will call git commands.The text was updated successfully, but these errors were encountered: