From :help syntax_cmd:
"enable" ":syntax enable" command. Only define colors for groups that
don't have highlighting yet. Use ":syntax default".
default is not a valid subcommand for :syntax.
:syntax default
E410: Invalid :syntax subcommand: default
But it is for :highlight (which is the command executed by syncolor.vim; not :syntax):
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 5811cf2aa..ce32bddea 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5493,7 +5493,7 @@ syntax/syncolor.vim files are loaded: "on" ":syntax on" command. Highlight colors are overruled but links are kept "enable" ":syntax enable" command. Only define colors for groups that - don't have highlighting yet. Use ":syntax default". + don't have highlighting yet. Use ":highlight default". "reset" ":syntax reset" command or loading a color scheme. Define all the colors. "skip" Don't define colors. Used to skip the default settings when a
At :help E679:
*E679*
Notice that the tag is highlighted with helpExample instead of helpHyperTextEntry. That's because the previous example was not properly terminated:
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 5811cf2aa..2e4fb8017 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5477,7 +5477,7 @@ For Unix you can use the file ~/.vim/after/syntax/syncolor.vim. Example: > else highlight comment ctermfg=green guifg=green endif - +< *E679* Do make sure this syncolor.vim script does not use a "syntax on", set the 'background' option or uses a "colorscheme" command, because it results in an
There is one consequence for using the pseudo-key <Cmd> which is not documented at :help <Cmd>. The rhs is not subject to abbreviations nor to other mappings, even if the mapping is recursive:
nmap <F3> <Cmd>echomsg 'no issue'<CR> cnoreabbrev echomsg invalid feedkeys("\<F3>")
no issue
Without <Cmd>, echomsg would have been expanded in the rhs, causing an error:
nmap <F3> :echomsg 'no issue'<CR> cnoreabbrev echomsg invalid feedkeys("\<F3>")
E492: Not an editor command: invalid 'no issue'
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index b700c822e..c434854db 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -346,6 +346,8 @@ Note: - For the same reason, |keycodes| like <C-R><C-W> are interpreted as plain, unmapped keys. - The command is not echo'ed, no need for <silent>. +- The {rhs} is not subject to abbreviations nor to other mappings, even if the + mapping is recursive. - In Visual mode you can use `line('v')` and `col('v')` to get one end of the Visual area, the cursor is at the other end. - In Select mode, |:map| and |:vmap| command mappings are executed in
From :help :unmap:
Remove the mapping of {lhs} for the modes where the map command applies.
This reads as if :unmap could only be passed the lhs of a mapping. It can also be passed the rhs:
$ vim -Nu NONE --cmd 'nnoremap lhs rhs' --cmd 'nunmap rhs' --cmd 'map' --cmd 'q'
No mapping found
If this is working as intended, then it might be worth documenting:
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index b700c822e..b694b613b 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -96,6 +96,7 @@ modes. Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. + Note: You can also pass the {rhs} instead of the {lhs}. Note: Trailing spaces are included in the {lhs}. This unmap does NOT work: > :map @@ foo
From :help autocmd-define:
Note: The ":autocmd" command can only be followed by another command when the
'|' appears before {cmd}.
:autocmd can never be followed by another command.
Also, the whole sentence doesn't make any sense. Of course a bar must appear before {cmd}; that's the whole purpose of a bar; to tell Vim when a command ends, and when the next one starts.
Besides, the next examples are supposed to support this point. They do not. If that was the case, then we should be able to find a {cmd} where there is no bar before, in at least one of them. There is no such example. In every single one of them {cmd} is :augroup, and before every :augroup there is a bar.
This works: >
:augroup mine | au! BufRead | augroup END
It does not work:
augroup mine autocmd BufRead * eval 0 + 1 autocmd BufEnter * eval 0 + 2 augroup END augroup mine | au! BufRead | augroup END autocmd BufLeave * 'this ends up in "mine"; but it should not' autocmd
mine BufEnter
* eval 0 + 2
mine BufLeave
* 'this ends up in "mine"; but it should not'
Notice that the BufLeave autocmd has been unexpectedly installed in the mine augroup. That's wrong. It was written outside the mine augroup (i.e. after augroup END), therefore it should have been installed in the default group. The issue is that :au! BufRead has consumed | augroup END.
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index fdac7daad..642607132 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -82,12 +82,11 @@ triggered. /<start } -Note: The ":autocmd" command can only be followed by another command when the -'|' appears before {cmd}. This works: > - :augroup mine | au! BufRead | augroup END -But this sees "augroup" as part of the defined command: > +Note: The `:autocmd` command can not be followed by another command. +This does NOT work: > :augroup mine | au! BufRead * | augroup END :augroup mine | au BufRead * set tw=70 | augroup END +Because `:autocmd` sees the bar as part of its arguments. See |:bar|. Instead you can put the group name into the command: > :au! mine BufRead * :au mine BufRead * set tw=70
Final suggested patch:
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index fdac7daad..642607132 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -82,12 +82,11 @@ triggered. /<start } -Note: The ":autocmd" command can only be followed by another command when the -'|' appears before {cmd}. This works: > - :augroup mine | au! BufRead | augroup END -But this sees "augroup" as part of the defined command: > +Note: The `:autocmd` command can not be followed by another command. +This does NOT work: > :augroup mine | au! BufRead * | augroup END :augroup mine | au BufRead * set tw=70 | augroup END +Because `:autocmd` sees the bar as part of its arguments. See |:bar|. Instead you can put the group name into the command: > :au! mine BufRead * :au mine BufRead * set tw=70 diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index b700c822e..1faa7217b 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -96,6 +96,7 @@ modes. Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. + Note: You can also pass the {rhs} instead of the {lhs}. Note: Trailing spaces are included in the {lhs}. This unmap does NOT work: > :map @@ foo @@ -346,6 +347,8 @@ Note: - For the same reason, |keycodes| like <C-R><C-W> are interpreted as plain, unmapped keys. - The command is not echo'ed, no need for <silent>. +- The {rhs} is not subject to abbreviations nor to other mappings, even if the + mapping is recursive. - In Visual mode you can use `line('v')` and `col('v')` to get one end of the Visual area, the cursor is at the other end. - In Select mode, |:map| and |:vmap| command mappings are executed in diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 5811cf2aa..cbed7ffb9 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5477,7 +5477,7 @@ For Unix you can use the file ~/.vim/after/syntax/syncolor.vim. Example: > else highlight comment ctermfg=green guifg=green endif - +< *E679* Do make sure this syncolor.vim script does not use a "syntax on", set the 'background' option or uses a "colorscheme" command, because it results in an @@ -5493,7 +5493,7 @@ syntax/syncolor.vim files are loaded: "on" ":syntax on" command. Highlight colors are overruled but links are kept "enable" ":syntax enable" command. Only define colors for groups that - don't have highlighting yet. Use ":syntax default". + don't have highlighting yet. Use ":highlight default". "reset" ":syntax reset" command or loading a color scheme. Define all the colors. "skip" Don't define colors. Used to skip the default settings when a
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
![]()
It does not work:
Now it works (since 8.2.3626).
But the sentence in the help still makes no sense:
Note: The ":autocmd" command can only be followed by another command when the
'|' appears before {cmd}.
This does:
Note: The ":autocmd" command can only be followed by another command when the
'|' appears after {event}.
I think that at some point when {cmd} starts with a bar was not seen as
an argument, but the next command. Since there is no point to start
{cmd} with a bar. This might actually be a bug. Also because what
follows is silently ignored, no warning about that. And some tests also
assume this works.
OK, so IIUC, :autocmd does not consume the bar if it's written right afterward:
:augroup mine | au! | augroup END
^
✔
Or right after an event:
:augroup mine | au! BufRead | augroup END
^
✔
But it does when the bar is written right after a pattern:
:augroup mine | au! BufRead * | augroup END
^
✘
So, instead of locating the bar relative to the next {cmd}, we should probably locate it relative to :autocmd itself or to its optional event argument:
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index fdac7daad..268d4eadd 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -82,8 +82,9 @@ triggered. /<start }
-Note: The ":autocmd" command can only be followed by another command when the -'|' appears before {cmd}. This works: >
+Note: The `:autocmd` command can only be followed by another command when the +'|' appears right after `:autocmd` or right after its optional event argument. +This works: > :augroup mine | au! BufRead | augroup END But this sees "augroup" as part of the defined command: > :augroup mine | au! BufRead * | augroup END
I'll include most of the suggestions.
Thank you. Closing then.
Closed #9164.