preservim / vim-textobj-quote

Use ‘curly’ quote characters in Vim
Other
123 stars 6 forks source link

[bug] helptags will fail #29

Closed Freed-Wu closed 3 years ago

Freed-Wu commented 3 years ago

Same as https://github.com/Shougo/dein.vim/issues/345, because there are non-english characters in https://github.com/preservim/vim-textobj-quote/blob/master/doc/textobj-quote.txt (e.g. “‘curly’”), but vim help files which has an extension named 'txt' are allowed to have only english character, so the helptags will fail.

A simple solution is to rename the file extension from txt to ??x. (?? should be a two-letter language code).

thanks!

alerque commented 3 years ago

Huh what‽ Do you have a link to the documentation for this being the accepted solution for this issue?

Freed-Wu commented 3 years ago

See https://github.com/vim/vim/issues/2213#issuecomment-337878041

I prefer to keep the help tags ASCII, so that they still work when 'encoding' is some code page. Some people still use that. And there is not much point in non-ASCII characters in help tags.

Bram Moolenaar don't allow any non-ascii characters exist in vim help file.

you can delete all non-ascii character in the first line, like https://github.com/pechorin/any-jump.vim/issues/46 https://github.com/pechorin/any-jump.vim/commit/0bc35858f2b855cdb927f485fb75bb89850de439

or change the help file's extension from txt to ??x.

telemachus commented 3 years ago

Can you say a little more about how "the helptags will fail"?

I just reinstalled this plugin and rebuilt my helptags. I didn't get an error message, and as far as I can tell, navigation via links works fine within the helpfile. So, in what sense do the non-ascii characters cause failure?

If we need to do something, I vote to change the filename rather than remove the non-ascii characters. After all, the whole point of this library is that it provides support for non-ascii quotes!

Freed-Wu commented 3 years ago
❯ ls
airline.txt  textobj-quote.txt
❯ vi -u NONE -c'helptags .'
Error detected while processing command line:
E670: Mix of help file encodings within a language: ./textobj-quote.txt
Press ENTER or type command to continue

You must have at least two *.txt.

Except changing txt to ??x, another way is to delete the curly quotes in the first line.

diff --git a/doc/textobj-quote.txt b/doc/textobj-quote.txt
index 3f5033a..72d2cd0 100644
--- a/doc/textobj-quote.txt
+++ b/doc/textobj-quote.txt
@@ -1,4 +1,4 @@
-*textobj-quote.txt*    Support typographic (“‘curly’”) quote characters.
+*textobj-quote.txt*    Support typographic (curly) quote characters.

 ==============================================================================
 CONTENTS                   *textobj-quote-contents*
telemachus commented 3 years ago

You must have at least two *.txt.

I have more than two helpfiles, but I haven't seen an error. I'll try again with your specific experiment.

Except changing txt to ??x, another way is to delete the curly quotes in the first line.

To clarify, you mean that we can fix the problem by changing only the first line? If so, we should probably do that. We need curly quote marks in the document, but they don't have to be on the first line.

Freed-Wu commented 3 years ago

To clarify, you mean that we can fix the problem by changing only the first line?

I have tested. If the first line don't have curly quotes, E670 will not occur.

I also think it is a good idea to delete the curly quotes in the first line.

telemachus commented 3 years ago

@Freed-Wu Thanks for teaching me about this corner case in Vim. I've submitted a pull request with the necessary change. I also apologize: I didn't read your earlier comment carefully enough. I didn't see that we only needed to change one line. Once I realized that, I agree that a one-line change is simpler than changing the filename.

@alerque Let us know what you think. Thanks.

Freed-Wu commented 3 years ago

@Freed-Wu Thanks for teaching me about this corner case in Vim. I've submitted a pull request with the necessary change. I also apologize: I didn't read your earlier comment carefully enough. I didn't see that we only needed to change one line. Once I realized that, I agree that a one-line change is simpler than changing the filename.

@alerque Let us know what you think. Thanks.

No serious!

I am happy to discuss any question with you excellent people.

I learned the corner case from https://github.com/Shougo/dein.vim/issues/345. Shougo should be credited.

Thanks!