[wip] Open file - #32
Draft
erooke wants to merge 7 commits into
Draft
Conversation
Collaborator
|
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. |
Contributor
Author
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:extgiven 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}