Re: [Proposal] Updated defaults.vim. (Add "mM" to 'formatoptions')

2018-10-06 Fir de Conversatie h_east
Hi Bram and Vim developers,

2018-10-6(Sat) 4:09:47 UTC+9 Bram Moolenaar:
> Hirohito Higashi wrote:
> 
> > By default, 'm' is not contained in 'formatoptions', so automatic
> > wrapping not work when multi-byte characters are continuously input.
> > Of course, I should set it up with my .vimrc, but I saw some people in
> > trouble with this case.
> > I am very happy if you can include an attached patch.
> > I think this change does not affect non-multi-byte-inputting people.
> 
> AFAIK this should only be done for Asian languages.  There are many
> other languages where multi-byte characters are used, such as Greek,
> where spaces are used to separate words.  Like Tony also mentioned.
> 
> Would it work to $LANG for a match with a list of languages for which
> these 'formatoptions' are useful?

Maybe yes.
However, when that happens, more greed will come out.
'fileencodings', 'ambiwidth', ... :-)

I would like to hear more opinions from various people.

--
Best regards,
Hirohito Higashi (h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Proposal] Updated defaults.vim. (Add "mM" to 'formatoptions')

2018-10-05 Fir de Conversatie Bram Moolenaar


Hirohito Higashi wrote:

> By default, 'm' is not contained in 'formatoptions', so automatic
> wrapping not work when multi-byte characters are continuously input.
> Of course, I should set it up with my .vimrc, but I saw some people in
> trouble with this case.
> I am very happy if you can include an attached patch.
> I think this change does not affect non-multi-byte-inputting people.

AFAIK this should only be done for Asian languages.  There are many
other languages where multi-byte characters are used, such as Greek,
where spaces are used to separate words.  Like Tony also mentioned.

Would it work to $LANG for a match with a list of languages for which
these 'formatoptions' are useful? 

-- 
Although the scythe isn't pre-eminent among the weapons of war, anyone who
has been on the wrong end of, say, a peasants' revolt will know that in
skilled hands it is fearsome.
-- (Terry Pratchett, Mort)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Proposal] Updated defaults.vim. (Add "mM" to 'formatoptions')

2018-10-04 Fir de Conversatie h_east
Hi Tony,

2018-10-5(Fri) 11:52:47 UTC+9 Tony Mechelynck:
> On Fri, Oct 5, 2018 at 4:19 AM h_east wrote:
> >
> > Hi Bram,
> >
> > By default, 'm' is not contained in 'formatoptions', so automatic wrapping 
> > not work when multi-byte characters are continuously input.
> > Of course, I should set it up with my .vimrc, but I saw some people in 
> > trouble with this case.
> > I am very happy if you can include an attached patch.
> > I think this change does not affect non-multi-byte-inputting people.
> 
> In UTF-8, anything above U+007F is multibyte, and Cyrillic, Greek,
> Hebrew, Arabic, IPA, or some "extra" Latin glyphs such as the French œ
> (oe) ligature, are not only multibyte but also above U+00FF i.e. above
> 255. Adding m would allow breaking Cyrillic, Greek, Hebrew or Arabic
> anywhere in the middle of a word, and such common French words as
> "bœuf" (ox or beef), "œil" (eye), "clin d'œil" (wink), "œuf" (egg),
> "jaune d'œuf" (yolk), "sœur" (sister), etc. immediately before or
> after the œ. Similarly, adding M would IIUC glue together any
> Cyrillic, Greek, Hebrew or Arabic words, as well as French words the
> second of which starts in œ as in "un œil" (an eye) or "un œuf" (an
> egg). This is definitely unwanted and breaks upwards compatibility.
> Adding mM to 'formatoptions' should IMHO be restricted to files in CJK
> scripts, and since it is buffer-local it could very well be set in the
> modelines of said files. *Please* do NOT make fo+=mM the Vim default.

Ah, I understand.
Thank you for explaining in detail.

--
Best regards,
Hirohito Higashi (h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Proposal] Updated defaults.vim. (Add "mM" to 'formatoptions')

2018-10-04 Fir de Conversatie Tony Mechelynck
On Fri, Oct 5, 2018 at 4:19 AM h_east  wrote:
>
> Hi Bram,
>
> By default, 'm' is not contained in 'formatoptions', so automatic wrapping 
> not work when multi-byte characters are continuously input.
> Of course, I should set it up with my .vimrc, but I saw some people in 
> trouble with this case.
> I am very happy if you can include an attached patch.
> I think this change does not affect non-multi-byte-inputting people.

In UTF-8, anything above U+007F is multibyte, and Cyrillic, Greek,
Hebrew, Arabic, IPA, or some "extra" Latin glyphs such as the French œ
(oe) ligature, are not only multibyte but also above U+00FF i.e. above
255. Adding m would allow breaking Cyrillic, Greek, Hebrew or Arabic
anywhere in the middle of a word, and such common French words as
"bœuf" (ox or beef), "œil" (eye), "clin d'œil" (wink), "œuf" (egg),
"jaune d'œuf" (yolk), "sœur" (sister), etc. immediately before or
after the œ. Similarly, adding M would IIUC glue together any
Cyrillic, Greek, Hebrew or Arabic words, as well as French words the
second of which starts in œ as in "un œil" (an eye) or "un œuf" (an
egg). This is definitely unwanted and breaks upwards compatibility.
Adding mM to 'formatoptions' should IMHO be restricted to files in CJK
scripts, and since it is buffer-local it could very well be set in the
modelines of said files. *Please* do NOT make fo+=mM the Vim default.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Proposal] Updated defaults.vim. (Add "mM" to 'formatoptions')

2018-10-04 Fir de Conversatie h_east
Hi Bram,

By default, 'm' is not contained in 'formatoptions', so automatic wrapping not 
work when multi-byte characters are continuously input.
Of course, I should set it up with my .vimrc, but I saw some people in trouble 
with this case.
I am very happy if you can include an attached patch.
I think this change does not affect non-multi-byte-inputting people.

--
Best regards,
Hirohito Higashi (h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/defaults.vim b/runtime/defaults.vim
index 0dcb92245..9d43da91f 100644
--- a/runtime/defaults.vim
+++ b/runtime/defaults.vim
@@ -59,6 +59,11 @@ endif
 " confusing.
 set nrformats-=octal
 
+" 'm': Allow auto-wrap even when multi-byte characters are followed.
+" 'M': When joining lines, don't insert a space before or after a multi-byte
+" character.
+set formatoptions+=mM
+
 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
 if has('win32')
   set guioptions-=t
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6a34b774b..5413cd67e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3534,7 +3534,8 @@ A jump table for the options with a short description can be found at |Q_op|.
 	NOTE: This option is set to "" when 'compatible' is set.
 
 	*'formatoptions'* *'fo'*
-'formatoptions' 'fo'	string (Vim default: "tcq", Vi default: "vt")
+'formatoptions' 'fo'	string (Vim default: "tcq", Vi default: "vt",
+	"mM" is added in |defaults.vim|)
 			local to buffer
 			{not in Vi}
 	This is a sequence of letters which describes how automatic