[vim/vim] runtime/syntax/vim: Fix vimOper ordinal, repeat count. (#7966)

30 views
Skip to first unread message

Tsuyoshi CHO

unread,
Mar 15, 2021, 10:41:30 AM3/15/21
to vim/vim, Subscribed

Problem

Below code highlight do not work expect result.

if &filetype !~# '^v'
  echo 1
endif

Solution

This PR fix below:

  • vim operator !~= do not highlight, fix vimOper order.
  • vim operator do not have ==?? / ==## and other, use ? instead {0,2}

I'm created PR reason: #7464


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/7966

Commit Summary

  • vim operator syntax fix

File Changes

Patch Links:


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

codecov[bot]

unread,
Mar 15, 2021, 10:44:16 AM3/15/21
to vim/vim, Subscribed

Codecov Report

Merging #7966 (bbedbda) into master (c80f647) will decrease coverage by 86.60%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@

##           master    #7966       +/-   ##

===========================================

- Coverage   89.09%    2.49%   -86.61%     

===========================================

  Files         148      146        -2     

  Lines      165201   160138     -5063     

===========================================

- Hits       147185     3990   -143195     

- Misses      18016   156148   +138132     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 2.49% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/autocmd.c 2.08% <0.00%> (-89.73%) ⬇️
src/eval.c 0.10% <0.00%> (-96.12%) ⬇️
src/evalfunc.c 0.00% <0.00%> (-96.00%) ⬇️
src/evalvars.c 5.31% <0.00%> (-90.77%) ⬇️
src/ex_docmd.c 0.00% <0.00%> (-94.75%) ⬇️
src/session.c 0.00% <0.00%> (-82.11%) ⬇️
src/version.c 0.86% <ø> (-91.48%) ⬇️
src/vim9compile.c 0.00% <0.00%> (-94.08%) ⬇️
src/vim9execute.c 0.00% <0.00%> (-93.24%) ⬇️
src/vim9script.c 0.00% <0.00%> (-93.54%) ⬇️
... and 146 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c80f647...fecc652. Read the comment docs.

Tsuyoshi CHO

unread,
Mar 15, 2021, 11:12:43 AM3/15/21
to vim/vim, Push

@tsuyoshicho pushed 1 commit.


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

Tsuyoshi CHO

unread,
May 31, 2021, 6:06:57 AM5/31/21
to vim/vim, Push

@tsuyoshicho pushed 1 commit.


You are receiving this because you are subscribed to this thread.

Tsuyoshi CHO

unread,
Sep 28, 2021, 10:41:53 AM9/28/21
to vim/vim, Push

@tsuyoshicho pushed 1 commit.


You are receiving this because you are subscribed to this thread.

View it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Tsuyoshi CHO

unread,
Oct 1, 2021, 7:10:21 PM10/1/21
to vim/vim, Push

@tsuyoshicho pushed 1 commit.


You are receiving this because you are subscribed to this thread.

Charles Campbell

unread,
Oct 1, 2021, 7:59:46 PM10/1/21
to vim...@googlegroups.com
Tsuyoshi CHO (Vim Github Repository) wrote:
>
> @tsuyoshicho <https://github.com/tsuyoshicho> pushed 1 commit.
>
> * 419101f
> <https://github.com/vim/vim/commit/419101fb03dd48e8c73f9a419db666577311542e>
> vim operator syntax fix
>
>
Hello, Tsuyoshi:

Unfortunately, github is telling me that it can't find your commit.
Would you please send a diff to me and an example illustrating the issue.

Thank you,
Chip Campbell

Bram Moolenaar

unread,
Oct 2, 2021, 12:22:39 PM10/2/21
to vim...@googlegroups.com, Charles Campbell
Adding ".diff" often helps. Strangely, on github there is no button for
this.

https://github.com/vim/vim/commit/419101fb03dd48e8c73f9a419db666577311542e.diff

diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 1fd94752b79..25a4eb4698d 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -228,9 +228,9 @@ syn keyword vimAugroupKey contained aug[roup]
" Operators: {{{2
" =========
syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment
+syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile
-syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup
syn region vimOperParen matchgroup=vimSep start="#\={" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")

--
From "know your smileys":
8-O "Omigod!!" (done "rm -rf *" ?)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Charles Campbell

unread,
Oct 2, 2021, 2:06:37 PM10/2/21
to vim...@googlegroups.com, Bram Moolenaar
Hello, Bram!

So it seems that its a changing of priority for the matching, as he
simply moved a line to an earlier point in the file. I'd still like an
example if the OP would please provide one so I can put it into my test
suite.

Chip Campbell

Tsuyoshi CHO

unread,
Oct 17, 2021, 6:04:38 AM10/17/21
to vim/vim, Push

@tsuyoshicho pushed 2 commits.


You are receiving this because you are subscribed to this thread.

Tsuyoshi CHO

unread,
Oct 22, 2021, 9:11:00 AM10/22/21
to vim/vim, Subscribed

@cecamp san,

Show PR affect.

vimOper as Operator, syntax fix.

Original Result:

This PR's fix applied Result:


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub.

cecamp

unread,
Oct 22, 2021, 11:30:15 AM10/22/21
to vim/vim, Subscribed

Hmm, your change didn't seem to affect the example for me. Probably something I've updated. Anyway, please try http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM, version 8.2-09.


You are receiving this because you are subscribed to this thread.

cecamp

unread,
Oct 22, 2021, 11:32:19 AM10/22/21
to vim/vim, Subscribed

Sorry, I got my markdown mixed up. Try [syntax/vim.vim](http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM].


You are receiving this because you are subscribed to this thread.

cecamp

unread,
Oct 22, 2021, 11:35:22 AM10/22/21
to vim/vim, Subscribed

Maybe a third time? syntax/vim.vim


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Oct 22, 2021, 1:09:08 PM10/22/21
to vim/vim, Subscribed

For what it's worth: with the current copy of the Vim syntax I do see this problem.


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Oct 22, 2021, 1:13:34 PM10/22/21
to vim/vim, Subscribed

You can use a non-breaking space character:
return "nice\u00a0stl"


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Oct 22, 2021, 1:14:06 PM10/22/21
to vim/vim, Subscribed

Oops, wrong issue.


You are receiving this because you are subscribed to this thread.

Tsuyoshi CHO

unread,
Oct 23, 2021, 1:32:25 AM10/23/21
to vim/vim, Subscribed

@cecamp said

Maybe a third time? syntax/vim.vim

Tested that latest syntax (vim.vim.gz), This problem fixed it!

They can close this PR if the next release contains modified syntax file.
Thanks.


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Oct 23, 2021, 7:01:29 AM10/23/21
to vim/vim, Subscribed

I'll receive an update from Charles soon, no reason to keep this open.


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Oct 23, 2021, 7:01:32 AM10/23/21
to vim/vim, Subscribed

Closed #7966.


You are receiving this because you are subscribed to this thread.

Tsuyoshi CHO

unread,
Oct 23, 2021, 7:13:31 AM10/23/21
to vim/vim, Subscribed

Thanks all.


You are receiving this because you are subscribed to this thread.

Reply all
Reply to author
Forward
0 new messages