Open VolkovIlia opened 3 years ago
If telescope supports specifying result-sensitive actions this should be possible. However this is not a feature I have in mind for this plugin (at least right now, as I am busy doing other stuff and development of new features for this project is paused). I might look into it another time if more such actions come up. For now I see this more as a hack for a very specific use-case.
You can implement it yourself and then either open a PR or use it locally, of course.
I would start here: telescope docs under replace_if
. There you can specify the condition and change the action.
I have bodged together an implementation for this over at https://github.com/erooke/telescope-bibtex.nvim/tree/open-file. Simply specify the pdf reader in the config:
require('telescope').setup {
extensions = {
bibtex = {
reader = { 'evince' },
}
}
}
then call Telescope bibtex open
and select what you want opened.
Currently has a quirk where if you close the terminal hosting vim before closing vim the reader closes. I'm not sure how to stop that happening.
This looks good. How exactly is the format of the file field in the entry?
To solve the problem of the viewer closing: plenary.Job takes a table of arguments to pass to libUV.
LibUV has the option detached
which acts like a disown and would keep the viewer alive even after neovim exits.
(see options
after uv.spawn(...)
at libUV
This looks good. How exactly is the format of the file field in the entry?
That is a great question I wish I had an answer to. I was unable to find a good description of what was going on. The following is my best guess based on searching through all the bib files in the jabref repository:
file = {:http\://arxiv.org/pdf/2003.05580v3:PDF}
The current implementation deals with very little:
For my use case all of that is true but it's the main reason I hadn't submitted it as a pull request yet as it feels too hacky at the moment.
For what its worth helm-bibtex has implemented this feature. They support:
File = {/path/to/article.pdf}
File = {:/path/to/article.pdf:PDF}
File = {:/path/to/article.pdf:PDF;:/path/to/supplementary_materials.pdf:PDF}
as file specifications.
I've proposed a reply here : https://github.com/nvim-telescope/telescope-bibtex.nvim/issues/73#issuecomment-2058456940
uses mappings to add this feature.
I have bibtex file that is generated with link to pdf document (jabref and papers-cli generate it). Is it any opportunity to bind key for opening it while I search it in telescope... ?