-
Notifications
You must be signed in to change notification settings - Fork 16
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
[wip] Open file #32
base: master
Are you sure you want to change the base?
[wip] Open file #32
Conversation
Maybe you can use xdg-open to find a default reader? I do not know whether Windows has something similar, but this would be good to have as a fallback. This would also address remote files which would be opened in the browser. |
Ah yeah, I totally forgot xdg-open existed. That's perfect. I'm thinking we shouldn't really handle remote files differently for the time being. As you pointed out xdg-open will handle them and some readers (evince in particular) will also handle remote files. It doesn't feel worth the extra complexity for now. |
This is a real rough first draft at opening files specified in the bibtex entry. To call it one runs `:Telescope bibtex`. The selected entry can be opened by using `<c-o>`. ``` require('telescope').setup { extensions = { bibtex = { reader = { 'evince' }, } } } ``` would open the file in evince
Configuration now looks like ``` require('telescope').setup { extensions = { bibtex = { reader = { djvu = 'evince', pdf = 'zathura' }, } } } ``` This would open djvu files in evince and pdf files in zathura
Implemented a basic parser instead of using luas string substitution to deal with file lists. In theory we can now deal with : and ; being in file names. It now parses two styles of entries: - `{/path/to/file}` - `{name:/path/to/file:ext}` and can do a list of entires with mixed styles. Currently the first one is opened instead of actually dealing with the list of entries.
The parser remembered its state between invocations which caused it to fail to parse a second time. Declared variables as local to fix this problem.
The parser always appended a single empty item to the end of every parse. This has been fixed.
This pr aims to address #20. It is currently rather rough and not quite ready, this is just to track process on it / enable feedback.
Specifically it aims to provide a file opening action where if a bibtex entry has a file field following one of the following forms:
file = {/path/to/article.pdf}
file = {name:/path/to/article.pdf:PDF}
file={name:/path/to/article.pdf:PDF;name:/path/to/supplementary_materials.pdf:PDF}
we should be able to open it in a user specified reader.
Currently we only work with the second style of file fields. That is fields of the form
name:/path/to/article:ext
given a config entry called reader like so:it will open djvu files in evince and pdf files in zathura. Currently it is rather bodged together and will not work if there is a
:
in the path anywhere.Still left to todo:
{/path/to/article}
:
in their pathsmaybe handle remote files? For instance something likefile = {:http\://arxiv.org/pdf/2003.05580v3:PDF}