Comments (11)
This should work now, both wrt. links and completion.
from wiki.vim.
Thanks; should be fixed now. The allowed characters in the citekey is now alphanumeric and -
and _
. This seems like a safe and useful set.
I assume you've read the docs on the Zotero scheme in :help wiki-links-urls
? I've found that this feature works very well when I ensure authorYear
style citekeys for my references. Omni completion also works very well when combined with find
and fd
(faster).
from wiki.vim.
Let me start by trying to explain how the links are implemented in wiki.vim. I've taken to distinguish between a link and a url. A link is the combination of a link text and a link url (which may be of several schemes). This is best explained by examples (see also :help wiki-links
):
[text](url)
(markdown style links)[[url|text]]
(wiki style links; the|text
part is optional)[target]
or[text][target]
(reference style links)- this is followed by a
[target]: url
below the text
- this is followed by a
scheme:address
(url without link; is also detected as long as the scheme is included)
Note that the scheme
part of the url is not necessary in the first three types of links. If it is not there, then the wiki
scheme is assumed.
With that; my first thought is that the syntax @citekey
could be implemented as a shortcut for an url specification, e.g. @citekey
is synonymous to zot:citekey
. This should not be too difficult to implement (that is, it should be easy). This would be similar to your proposal, except instead of @citekey
implying [citekey](zot:citekey)
it would only imply zot:citekey
. I would make sure that it would still be detected as a free url, of course.
However, the bracketed form [@citekey]
and [@c1; @c2]
is worse, because it conflicts with the reference style link defined above. I think you might be right that this could be solved by ensuring that ampersands are not allowed in reference style links.
Thus, I think the following seems a sensible implementation route:
- Add support for
@citekey
as a synonym forzot:citekey
type urls. - Change reference style links so that the single bracket
[content]
is only valid if there are no ampersands incontent
.
Comments?
from wiki.vim.
Thanks for the explanation. I agree, that sounds like a good plan :).
Adding @citekey
as a synonym for zot:citekey
would already be "good enough" for my use:
@citekey
is less typing than[@citekey]
, and I would use the simplest syntax for notes;- Via your Zotero handler, we would presumably get omnicompletion and the PDF open function;
- We can export the wiki file via Pandoc, and the references should be readable and make sense;
- Changing e.g.
\citet
to\cite
as a postprocessing step after Pandoc LaTeX export is much less work than trying to change unrecognizedzot:
links to\cite
.
Having [@citekey1; @citekey2]
available would be a nice bonus feature if it's not too much work :). Implementing this, I think, would also be solved by your proposed solution for #59?
from wiki.vim.
Works great! Thanks for implementing this :)
from wiki.vim.
My pleasure; seems useful to me as well :)
from wiki.vim.
@lervag It seems if I use @some-citekey-string
instead of zot:some-citekey-string
, wiki#url#zot#parse
doesn't seem to work properly.
- For
@some-citekey-string
, echoself.stripped
inwiki#url#zot#parse
will returnome
(i.e. missing the first character and the text at and after the first-
). - For
zot:some-citekey-string
, echoself.stripped
inwiki#url#zot#parse
will returnsome-citekey-string
from wiki.vim.
That's quick! Thanks @lervag
I've found that this feature works very well when I ensure authorYear style citekeys for my references.
Do you mean having something like [auth:lower][year]
as your "Citation key format" under Zotero -> Preferences -> Better BibTeX -> Citation Keys?
from wiki.vim.
That's quick! Thanks @lervag
My pleasure :)
Do you mean having something like [auth:lower][year] as your "Citation key format" under Zotero -> Preferences -> Better BibTeX -> Citation Keys?
Yes, precisely! I combine this with the Zotfile extension with filenames formatted as %b - {%T - } {%t}
. When it is properly set up, I get nice autocompletion. I also have a simple shell function that uses fzf for quickly opening any pdf:
z() {
pdf=$(fd -t f -e pdf . ~/.local/zotero | fzf -m -d '/' --with-nth=-1)
if [ -f "$pdf" ]; then
echo ${pdf#*zotero/storage/}
zathura $pdf &
fi
}
This relies on fd
for finding the files and fzf
for interactive choosing.
from wiki.vim.
That's quick! Thanks @lervag
My pleasure :)
Do you mean having something like [auth:lower][year] as your "Citation key format" under Zotero -> Preferences -> Better BibTeX -> Citation Keys?
Yes, precisely! I combine this with the Zotfile extension with filenames formatted as
%b - {%T - } {%t}
. When it is properly set up, I get nice autocompletion. I also have a simple shell function that uses fzf for quickly opening any pdf:z() { pdf=$(fd -t f -e pdf . ~/.local/zotero | fzf -m -d '/' --with-nth=-1) if [ -f "$pdf" ]; then echo ${pdf#*zotero/storage/} zathura $pdf & fi }This relies on
fd
for finding the files andfzf
for interactive choosing.
Nice! I think I'll make some modification of your script and create a new script with rga
so that I can search within PDFs too.
from wiki.vim.
Nice! I think I'll make some modification of your script and create a new script with
rga
so that I can search within PDFs too.
I was not aware of rga
. It seems interesting. Thanks for making me aware of it!
from wiki.vim.
Related Issues (20)
- Possible to use one prefix to delimit a line of tags? HOT 3
- WikITocGenerate for more filetypes HOT 3
- WikiJournalNext / WikiJournalPrev navigate out of journal folder HOT 7
- Backlinks don't update immediately HOT 16
- WikiExport: cmd should use double quote under windows HOT 18
- How can g:wiki_export be configured to support HTML, docx, and PDF? HOT 4
- Using custom resolver breaks WikiJournalNext/WikiJournalPrev HOT 10
- Disabling default mappings might be broken HOT 2
- Provide dictionaries containing default mappings HOT 6
- Enhancement request for WikiJournalIndex: reverse order and update HOT 3
- Is it possible for wiki-link-types to support jumping to Vim help? HOT 7
- WikiTags can't work under gvim 9.1 or neovim 0.10 + win 10 pro HOT 19
- Infinite loop on template rendering if function starts at index 0 in template file HOT 1
- HTML text objects are overwritten by text objects for link texts HOT 3
- WikiLinkAdd in visual mode HOT 12
- Add completion source for `:WikiOpen` HOT 3
- List index out of range for `wiki#graph#find_backlinks` HOT 5
- Delay in `<leader>wgb` or fetching backlinks after `<leader>wr` or file rename HOT 1
- Suggestion: Enabling closing parenthesis in `markdown` link HOT 1
- [REQ] transform TOC url HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiki.vim.