rafaqz / citation.vim

Zotero and bibtex citations for Vim
MIT License
98 stars 7 forks source link

UTF8 #20

Closed bepolymathe closed 5 years ago

bepolymathe commented 6 years ago

Thank you for this wonderful plugin. I just have a problem. I write in French, so there are accented letters "é" /"è" for example. When I insert a quotation note (citation/note)... it does not insert all accented characters. My text and my zotero are in UTF8. Can it come from the plugin? Thanks in advance

rafaqz commented 6 years ago

It could be, UTF8 accross vim/python/bibtex/zotero can have some problems, and the csutom key generation is a bit hackey

I also depends how you are making your citation keys. So:

Are you using zotero or bibtex? If zotero, do you use better-bibtex? Look in our exported bibtext file, does the key match what is in the bibtex?

If you're not using better-bibtex, try putting this in your config:

let g:citation_vim_key_clean_regex=''

And see what the difference is.

bepolymathe commented 6 years ago

Hi,

I'am using Zotero with better-bibtex and keys matches...

bepolymathe commented 6 years ago

Nothing change with suggested option. Maybe i need to clean by hand zotero.squite en cache folder ?

rafaqz commented 6 years ago

also delete your citation_vim_cache file wherever you set your cache to be.

If you are using better bibtex make sure you don't use this line:

let g:citation_vim_key_format="{author}{date}{title}"

Or have it equal:

let g:citation_vim_key_format=""

But also please check the exported bibtex file and the citation key in zotero to make sure they actually show what you want.

bepolymathe commented 6 years ago

Thank you for that clarification. So my configuration looks like this.

capture du 2018-08-11 10-50-32

I deleted the cache files and made a new quote... the problem remains.

rafaqz commented 6 years ago

I want to get this fixed, but this is the most important step:

Look in your exported bibtext file, does the key match what is in the bibtex?

These keys are generated by better bibtex, not citation.vim, and its possible that's where the problem is.

If your exported bibtex file doesn't match the key, please send the links to a few papers that do this so I can try with the same characters.

bepolymathe commented 6 years ago

Okay, I understand better. Yes, my keys match. Would there be a setting in Zotero to make sure the encoder is in UTF8? Thanks for your help.

bepolymathe commented 6 years ago

My zotero configuration look like this

capture du 2018-08-11 13-50-10

bepolymathe commented 6 years ago

And if I do a Zotero to BetterBibLaTex export, I do have the right keys and UTF8 notes without losing any characters. Strange...

rafaqz commented 6 years ago

Just to be clear in Zotero the keys also don't show the characters you want?

Send a link to an article that does this so I can try it out.

bepolymathe commented 6 years ago

Yes in Zotero it works. I see all the characters.

capture du 2018-08-12 10-22-38

The only thing that makes me doubt is that firefox underlines the words as if they were misspelled.

An example of an article I work with. https://www.cairn.info/revue-cahiers-de-l-action-2018-1-page-37.htm

rafaqz commented 6 years ago

Thanks, I can see the problem now! That should be fixable. I'm very busy this week so it might be in a few weeks.

On Sun, Aug 12, 2018 at 6:34 PM, bepolymathe notifications@github.com wrote:

Yes in Zotero it works. I see all the characters.

[image: capture du 2018-08-12 10-22-38] https://user-images.githubusercontent.com/29939805/44000119-6beb2914-9e1a-11e8-95f9-84d4a50baae7.png

The only thing that makes me doubt is that firefox underlines the words as if they were misspelled.

An example of an article I work with. https://www-cairn-info.inshs.bib.cnrs.fr/revue-cahiers-de- l-action-2018-1-page-21.htm

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rafaqz/citation.vim/issues/20#issuecomment-412327656, or mute the thread https://github.com/notifications/unsubscribe-auth/ACaqeasPZJCXypsf-UppFg6uApbRrWY5ks5uP-ivgaJpZM4VzhZQ .

bepolymathe commented 6 years ago

That's wonderful! I'm waiting for you and don't hesitate to ask if you want me to try it out. Thank you anyway for this work. It's really very useful! I'm not leaving Vim anymore -)

bepolymathe commented 6 years ago

Well, I have another dream too, so I share it.

When I read PDF articles I highlight them and often extract the highlighted passages (or notes) using Zotero. This creates a note for me with all the highlighted passages and it's convenient for the next article. Nevertheless, everything is in one note.

capture du 2018-08-12 10-55-00

The ideal would be that the insertion of notes with quotation.vim could be made according to extracts. Maybe that would be enough to take the ")" caracter followed by a line break as an indicator for each extract ? This would allow you to choose which extract of the same article you wish to insert...

But maybe it's very complicated to integrate?

rafaqz commented 6 years ago

You can probably already do that in a kind of clunky way:

citation/abstract should be the source.

This inserts abstracts:

nnoremap <silent><leader>ca :<C-u>Unite -buffer-name=citation/abstract   -default-action=insert citation/abstract<cr>

But you could use yank instead of insert, then you could do that manipulation on the yank buffer, with a little vimscript.

But I try not to add features, as its pretty customisable and its complicated enough as is!

bepolymathe commented 6 years ago

Thanks for the answer. The idea with "abstract" is good but I'am affraid that it poses the same problems in the long run as the insertion of the "note" field. For "vimscript" I would have to try to do this kind of thing but it's not very easy for me. I'm not a developer... but maybe you have some examples that could inspire me? Have a nice day.

bepolymathe commented 6 years ago

Besides I also realize that if I have two notes attached to the same reference, I see only the first one in "unit" after using "citation/notes"

rafaqz commented 6 years ago

Oh yeah 'citation/notes' !!

Yes maybe it just grabs the first one. I've never used more than one note! Do you?

I could consider joining all the notes together into a mega note if that was needed, its a trivial change.

Sorry I have no advice for the other part, except yank to a register, then google how to access and manipulate text in vim registers :) you might also need to learn a little regex to do that. Fun times?

bepolymathe commented 6 years ago

regex... Thank you for filling my free time ! Yes, I often use several notes per reference. In principle, I have a first note that contains extracts of text and other paragraphs or ideas that accompany a specific project (draft article, book, etc.). So yes I would be interested in being able to find all the content of my notes. The ideal would be to be able to choose between the notes which one inserted but if it is complicated, I would make with the first proposal. Thank you very much.

rafaqz commented 6 years ago

I'll see what I can do. Joining them in one chunk is the simplest with the current code (probably only 2 lines of code), getting them separately in Unite is probably more like 50 lines. If anyone else wants to do it I would be open to it. But I'm happier to go with the 2 line option ;)

rafaqz commented 6 years ago

I'll add some kind of text separator between each note so you can cut them up with regex :)

bepolymathe commented 6 years ago

Ok perfect.

bepolymathe commented 6 years ago

Hi @rafaqz , any news about this ?

rafaqz commented 5 years ago

I'm having a look now. I'm too busy with other coding lately...

rafaqz commented 5 years ago

Characters should be printing now. And all available notes are inserted already for me.

bepolymathe commented 5 years ago

Thanks @rafaqz ! It works fine for me too. You really created a great tool. Thank you again. Have a nice day.