Vim 拼写标点符号为 ?

Sar*_*use 8 vim spell-checking

我发现自己越来越多地使用讽刺点 (?)。但是,vim 拼写不会将其识别为有效的标点符号。

如何将它添加到 vim 以便拼写有效?

Tyl*_*den 5

解决这个问题的一种方法是将字符作为定义的标点符号直接添加到 vim 中。这样做的方法是修改vim 源文件,mbyte.c然后重新编译vim。此文件位于主 /src 主干中(请参阅https://code.google.com/p/vim/source/browse/src/mbyte.c)。你要修改的函数是这样开始的:

/*
* Get class of a Unicode character.
* 0: white space
* 1: punctuation
* 2 or bigger: some class of word character.
*/
int
utf_class(c)
int c;
{
   /* sorted list of non-overlapping intervals */
   static struct clinterval
   {
      unsigned int first;
      unsigned int last;
      unsigned int class;
   } classes[] =
      {
         {0x037e, 0x037e, 1}, /* Greek question mark */
         {0x0387, 0x0387, 1}, /* Greek ano teleia */
         {0x055a, 0x055f, 1}, /* Armenian punctuation */
         {0x0589, 0x0589, 1}, /* Armenian full stop */
         ... etc and so on
Run Code Online (Sandbox Code Playgroud)

您将您的字符添加到此列表中,重新编译后它将被视为标点符号。

  • 在这种情况下,您可能应该向 `vim` 报告一个带有提议的代码更改的功能请求,否则您的更改将无法在下一次升级中保留... (2认同)

Sar*_*use 1

正如uml\xc3\xa4ute在评论中建议的那样,对于Tyler Durden回答,我在 vim 中打开了功能请求/错误报告问题 258 。该修复位于补丁7.4.444中。

\n