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

parser gets confused by single bar (|) #9

Closed
justinmk opened this issue Sep 2, 2022 · 1 comment · Fixed by #16
Closed

parser gets confused by single bar (|) #9

justinmk opened this issue Sep 2, 2022 · 1 comment · Fixed by #16

Comments

@justinmk
Copy link
Member

justinmk commented Sep 2, 2022

Example from autocmd.txt:. The '|' seems to confuse the parser, and changing it to "|" doesn't help. Likely | should be treated as a literal if any whitespace follows it before the closing |.

The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
See |autocmd-buflocal|.

Note: The ":autocmd" command can only be followed by another command when the
'|' appears where the pattern is expected.  This works: >
	:augroup mine | au! BufRead | augroup END
But this sees "augroup" as part of the defined command: >
	:augroup mine | au! BufRead * | augroup END
	:augroup mine | au BufRead * set tw=70 | augroup END
Instead you can put the group name into the command: >
	:au! mine BufRead *
	:au mine BufRead * set tw=70
Or use `:execute`: >
	:augroup mine | exe "au! BufRead *" | augroup END
	:augroup mine | exe "au BufRead * set tw=70" | augroup END
@justinmk
Copy link
Member Author

justinmk commented Sep 2, 2022

Likely | should be treated as a literal if any whitespace follows it before the closing |.

Similar for *. Here's a sample from autocmd.txt where the parser gets confused by a literal *:

Note that the autocommands for the *ReadPre events and all the Filter events
are not allowed to change the current buffer (you will get an error message if
this happens).  This is to prevent the file to be read into the wrong buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant