-
Notifications
You must be signed in to change notification settings - Fork 68
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
citekey: link to BibDesk (in wiki.vim too) [feature request] #341
Comments
Just for completeness, could you give one or more examples of wiki text with citekeys? As a very simple, first step, I've added a handler for |
Here is an example:
I've just tested it and can confirm that it works: when I type |
Ok, so what is missing now is to connect let g:wiki_link_default_schemes = { 'cite': 'bdsk' } Can you test this and see if it is actually a sufficient solution here? |
That did it! Once I added this line to my nvim configuration, it worked perfectly: with cursor over the As I tested it further, I noticed a "bug" related to that wiki-ft.vim query of mine from a year ago: if the citekey contains I think the solution to that "bug" would be the same as for |
Ditto for |
Great, glad to hear it!
Could you give a couple of examples of this? And, just for the sake of clarity, is this a bug in wiki.vim or in wiki-ft.vim? Or both? |
Nevermind, I think I figured out what you want and I think my latest commit fixes it. Please update and test. |
Thanks for the fix! I've just tested it now, and in the case of In the case of |
Huh, strange. Can you type |
Also, can you give me an example of how that link looks like? |
Ah, but curiously when I put my cursor over the
But even then, |
This makes me wonder whether there are two problems:
|
I pushed another commit that at least fixes one of these issues. That is, the type should now be cite. However, the next problem is probably a bit harder. One thing we can try is to see if url encoding works here. You could try something like this: function! ResolverBdsk(url) abort
let a:url.stripped = wiki#url#utils#url_encode(a:url.stripped)
return a:url
endfunction
" Change the wiki scheme resolver
let g:wiki_link_schemes = {
\ 'bdsk': {
\ 'resolver': function('MyWikiResolver'),
\ }
\} Or, simply just try this to use this link: |
Sorry, my mistake: Notice the name mismatch: |
I could add this url encoding as a default built-in behaviour here, but if so, I should first check if it works with Zotero. |
That fixed it! Now the last link (the one with the colon) works perfectly. I do think it would make sense to make this the default built-in behavior, assuming it doesn't cause any problems for Zotero. Maybe it could be used only in the case that the BibDesk option is set? |
Yes. However, I believe it does make sense to do this at the url level. That is, if I did url encoding only for the cite links, then it won't apply the url encoding for e.g. And as such, I think the pragmatic choice for now is to just add this as the default behaviour for bdsk url's, and then consider this for Zotero if anyone should want it/ask for it. |
That makes sense to me. Thank you for this significant improvement to wiki.vim!
… On Apr 4, 2024, at 10:04 PM, Karl Yngve Lervåg ***@***.***> wrote:
Yes. However, I believe it does make sense to do this at the url level. That is, if I did url encoding only for the cite links, then it won't apply the url encoding for e.g. [[bdsk:LINK]] or <bdsk:...> or similar, only for @my:citation.
And as such, I think the pragmatic choice for now is to just add this as the default behaviour for bdsk url's, and then consider this for Zotero if anyone should want it/ask for it.
—
Reply to this email directly, view it on GitHub <#341 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABURL6TUW6BZCBP4JF5JVRDY3WW6DAVCNFSM6AAAAABFSENOSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZYGEYTAOBXGI>.
You are receiving this because you authored the thread.
|
No problem; I pushed the change now, so you can remove the latest update to your config. Let me know if it works :) |
(I also removed the additional code from my config.) |
Sorry! I'll fix that asap. |
There... |
It works now, thank you! |
Great, glad to hear it! |
This is a feature request just like the one I just opened for
vimtex
. It too is based on an old thread from a year ago about how doing so might be feasible.What I would like is to be able to enter a single command (in the case of wiki.vim, simply
<CR>
) in order to open the citekey under the cursor in BibDesk (on MacOS). Unlike in vimtex, I don't think wiki.vim "knows" which.bib
file to use, so perhaps it would make most sense for it to simply be a reference to whatever.bib
file is open in BibDesk at the time. I think this might be whatopen x-bdsk://citekey
(see description here) does by default anyway.The text was updated successfully, but these errors were encountered: