[vim/vim] Wrong syntax coloring (#6331)

30 views
Skip to first unread message

Enrico Maria De Angelis

unread,
Jun 24, 2020, 12:19:40 PM6/24/20
to vim/vim, Subscribed

Describe the bug
I'm not sure this is a real bug, but I perceive it so.

The line

Plug 'k-takata/matchit.vim'

in my .vimrc has an error in the syntax coloring: 'k-takata/matchit.vim' is not colored as a string, but as the sequence of different groups. What triggers the error is the first two characters being a [a-zA-Z0-9] and a -.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run vim -u NONE file.vim
  2. Execute :syntax on
  3. Add the line Plug 'k-takata/matchit.vim' to the buffer
  4. Observe the coloring

Expected behavior
'k-takata/matchit.vim' should be colored as a whole string.

Screenshots

Environment (please complete the following information):

  • Vim version [e.g. 8.2]:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 21 2020 16:11:23)
Included patches: 1-814
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl/dyn
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl/dyn          +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           +ruby/dyn          +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

K.Takata

unread,
Jun 24, 2020, 11:20:40 PM6/24/20
to vim/vim, Subscribed

I can confirm that:
'k is shown as vimMark.
- is shown as vimOper.
. is shown as vimOper.
vim is shown as vimCommand.

@cecamp Could you check this?

BTW, k-takata/matchit.vim is now merged into chrisbra/matchit, and it is included in the official Vim repository.

Shane-XB-Qian

unread,
Jun 25, 2020, 4:31:41 AM6/25/20
to vim/vim, Subscribed

not only -, but + and , also.
perhaps ! too ..

Charles Campbell

unread,
Jun 25, 2020, 10:34:05 PM6/25/20
to vim...@googlegroups.com
K.Takata (Vim Github Repository) wrote:
>
> I can confirm that:
> |'k| is shown as vimMark.
> |-| is shown as vimOper.
> |.| is shown as vimOper.
> |vim| is shown as vimCommand.
>
> @cecamp <https://github.com/cecamp> Could you check this?
>
> BTW, |k-takata/matchit.vim| is now merged into |chrisbra/matchit|, and
> it is included in the official Vim repository.
>
>
I'll look into it.  However, I just got internet back today after a
several day outage, and I'm busy for the next several days.

I know I'm supposed to use "view it on GitHub" to reply to this, but
GitHub wants a 6-digit verification code.  Unfortunately, it sends such
to a no-longer-active email account I used to have, so apparently I've
got to figure out how to fix that.

Also, the changes to matchit probably explain its no longer working
correctly (for me).

In .vim/after/syntax/c/c.vim I have:

syn match    cFolding            "{{{\d\+" containedin=cComment
syn match    cFolding            "}}}\d\+"    containedin=cComment

and

let b:match_skip='synIDattr(synID(line("."),col("."),1),"name") =~?
"cComment\\|character\\|special\\|ChipDbg\\|cFolding"'

which was supposed to skip over comments and the {{{3 I sometimes have
embedded therein.  It doesn't work, and so effectively the "%" operation
no longer works well.

Regards,
Chip Campbell

Charles Campbell

unread,
Jun 25, 2020, 10:39:48 PM6/25/20
to vim...@googlegroups.com
Charles Campbell wrote:
> K.Takata (Vim Github Repository) wrote:
>>
>> I can confirm that:
>> |'k| is shown as vimMark.
>> |-| is shown as vimOper.
>> |.| is shown as vimOper.
>> |vim| is shown as vimCommand.
>>
>> @cecamp <https://github.com/cecamp> Could you check this?
>>
>> BTW, |k-takata/matchit.vim| is now merged into |chrisbra/matchit|,
>> and it is included in the official Vim repository.
>>
>>
> I'll look into it.  However, I just got internet back today after a
> several day outage, and I'm busy for the next several days.
Well, I looked at

../vim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
../vim/runtime/pack/dist/opt/matchit/autoload/matchit.vim

and neither 'k nor `k appear there.  Want to try to send me the errant
plugin and tell me what lines are affected?  (I have 8.2.894)

Thanks,
Chip Campbell

Christian Brabandt

unread,
Jun 26, 2020, 3:25:27 AM6/26/20
to vim...@googlegroups.com

On Do, 25 Jun 2020, Charles Campbell wrote:

I think it is not about matchit itself, it was just an example. The
thing was when using a plugin manager like vim-plug and you want to
enable the matchit plugin, you use:

Plug 'k-takata/matchit.vim'

in your vimrc. And apparently, the ' is not detected as a string, but
rather as a mark command (or something similar). I am not sure if it
will be easy to fix however.

Mit freundlichen Grüßen
Christian
--
Aus Murphy's Gesetze:
Dein Vordermann erwischt immer die letzte Parklücke.

Charles Campbell

unread,
Jun 27, 2020, 2:33:46 PM6/27/20
to vim...@googlegroups.com
Christian Brabandt wrote:
> On Do, 25 Jun 2020, Charles Campbell wrote:
>
> I think it is not about matchit itself, it was just an example. The
> thing was when using a plugin manager like vim-plug and you want to
> enable the matchit plugin, you use:
>
> Plug 'k-takata/matchit.vim'
>
> in your vimrc. And apparently, the ' is not detected as a string, but
> rather as a mark command (or something similar). I am not sure if it
> will be easy to fix however.
>
Oh -- Plug is a command set up by a plugin.  Yeah -- I don't see a good
way to differentiate between marks and strings for it, either.
Chip

cecamp

unread,
Jun 29, 2020, 2:31:09 PM6/29/20
to vim/vim, Subscribed

I take back my earlier vimdev comment, there is a (simple!) way to avoid the unwanted highlighting. Please try the newest syntax/vim.vim from my website

cecamp

unread,
Jun 29, 2020, 2:31:12 PM6/29/20
to vim/vim, Subscribed

Closed #6331.

Shane-XB-Qian

unread,
Jun 29, 2020, 3:44:26 PM6/29/20
to vim/vim, Subscribed

try the newest syntax/vim.vim from my website

BTW: probably we needed a ci method freq to fetch the newest builtin packages into vim patch always, or (if not a builtin plugin) then to vim.org as well as vim-script github repo (looks some of them had been out-of-date).

K.Takata

unread,
Jun 29, 2020, 7:24:18 PM6/29/20
to vim/vim, Subscribed

Runtime files should be always sent to Bram by the authors explicitly to avoid including the wrong versions.
(The latest files can be still under development.)

Shane-XB-Qian

unread,
Jun 30, 2020, 1:14:37 AM6/30/20
to vim/vim, Subscribed

sent to Bram by the authors explicitly

yea, it's ok if to runtime/builtin plugins, but to those legacy/classic but not a builtin plugin, i am a little worried ..
e.g: dbext.vim in vim.org looks newer/updated than there ..
though 'vim-scripts' repo perhaps (?) was not a official site of vim, but some plugin mgr tools needs github repo as its source.
so if it sync/ci-method can freq fetch vim.org to 'vim-scripts' repo that would be great,
specially to those no individual github repo (by plugin owner) but only ftp(ed) to vim.org ..
// that's ok: we kept updating pkg to vim.org,
// but probably better: it had a mirror (even readonly - no pr/issue track - owner still kept its offline patching/sending workflow - contact by mail at file header - etc) all in (e.g:) 'vim-scripts' repo also,
// unless owner had his/her own ..

K.Takata

unread,
Jun 30, 2020, 1:28:24 AM6/30/20
to vim/vim, Subscribed

The vim-scripts repo has ended. https://vim-scraper.github.io/

Shane-XB-Qian

unread,
Jun 30, 2020, 1:38:00 AM6/30/20
to vim/vim, Subscribed

The vim-scripts repo has ended. https://vim-scraper.github.io/

yes, i see, that's one of worried ..
or we may (or just to myself) can write a spider to compare version between vim.org and vim-scripts by git-tag, then get the latest one from one of them. :)
ok then, if no vim-scripts anymore, looks i figure out a workaround (to myself at least) .. :)

Bram Moolenaar

unread,
Jun 30, 2020, 9:54:42 AM6/30/20
to vim/vim, Subscribed

It is quite dangerous to fetch from multiple repo's on github. If someone's account is compromised it's easy for a trojan horse to sneak in, since nobody actually looks at the content. Having one central version reduces the risk by a few orders of magnitude. AFAIK there is no virus scanner for Vim script, this relies on manual inspection and reporting.

Shane-XB-Qian

unread,
Jun 30, 2020, 11:45:55 AM6/30/20
to vim/vim, Subscribed

yea, that's true. even it was an open source code - still had such risk ..
// anyway, "good" news is those legacy plugins (not the runtime builtin in vim itself) had been very less which no owner owned repo, we can manually compare / dwn / upd (from vim.org) as well ..

Reply all
Reply to author
Forward
0 new messages