Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim.vim syntax highlighting bug when option string starts with 'z' #124

Closed
GoogleCodeExporter opened this issue Aug 18, 2015 · 5 comments
Closed

Comments

@GoogleCodeExporter
Copy link

I came upon this in the following manner.  In my vimrc, I added colorscheme 
zenburn.  The colorscheme is correctly highlighted, but the 'z' in zenburn 
doesn't appear to be correct. (See attached screenshot)  Checking the 
highlighting rules that are applied, the z was 'VimIsCommand,vimCommand' while 
the remainder of the word is 'vimIsCommand'.

It appears that in revision 916c90b37ea9adbe7dc1e866f85c6e5b49cfba25 
http://code.google.com/p/vim/source/detail?spec=svn916c90b37ea9adbe7dc1e866f85c6
e5b49cfba25&r=916c90b37ea9adbe7dc1e866f85c6e5b49cfba25 , the regex for 
vimCommand was changed and this leads to the bug.  Is there a distinct reason 
for that change, or should it be reverted back or modified somehow?

Original issue reported on code.google.com by ikirudennis on 21 Mar 2013 at 10:56

Attachments:

@GoogleCodeExporter
Copy link
Author

Still seems to be an issue. CC'ing Charles, as he is the maintainer of the vim 
syntax file.

I think this patch fixes it:
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -23,7 +23,7 @@ syn keyword vimCommand contained      abc[lea
 syn keyword vimCommand contained       abo[veleft] arge[dit] au bl[ast] br bro[wse] bun[load] cad[dexpr] cc
 syn keyword vimCommand contained       al[l] argg[lobal] bad[d] bm[odified] brea[k] bu bw[ipeout] caddf[ile
 syn keyword vimCommand contained       ar argl[ocal] ba[ll] bn[ext] breaka[dd] buf c cal[l] ce[nter] cg[etf
-syn match   vimCommand contained       "\<z[-+^.=]\="
+syn match   vimCommand contained       "\<z[-+^.=]\=\>"
 syn keyword vimStdPlugin contained     DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns

 " vimOptions are caught only when contained in a vimSet {{{2

Original comment by chrisbr...@googlemail.com on 30 Sep 2014 at 8:13

@GoogleCodeExporter
Copy link
Author

Original comment by chrisbr...@googlemail.com on 30 Sep 2014 at 9:23

  • Added labels: Runtime

@GoogleCodeExporter
Copy link
Author

Original comment by chrisbr...@googlemail.com on 9 Jan 2015 at 12:26

  • Added labels: patch

@GoogleCodeExporter
Copy link
Author

This bug has been fixed for awhile; looks like I neglected to close it.

Original comment by drc...@campbellfamily.biz on 9 Jan 2015 at 2:44

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

This change is not in the distribution yet.  Perhaps you need to send your Vim 
syntax file to me?

Original comment by brammool...@gmail.com on 9 Jan 2015 at 6:28

justinmk pushed a commit to neovim/neovim that referenced this issue Jul 8, 2017
Update a flawed match pattern for the vimCommand syntax group. To see
the effect of this fix, open a vimscript buffer,

  nvim -u NONE foo.vim

configure a couple highlight groups,

  :hi! vimIsCommand ctermfg=Green
  :hi! vimCommand ctermfg=Red
  :syntax enable

and add the following lines to the buffer:

  let foo=xFoo
  let bar=zBar

You'll notice the "z" in zBar is Red, while xFoo and the rest of Bar are green. This will
be the case as long as the word following `=` starts with the letter "z". This has already
been fixed upstream by adding a "\>" word boundary to the match pattern:

  vim/vim#124
  vim/vim@e271909#diff-86da060e2153c8ce5dc317a7b4b5a29dR27

This particular match pattern was also mentioned in issue #5491, but in reference to a bug
that was related to the generated part of syntax/vim.vim, whereas this bug lives in the
non-generated part of the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant