1

for example, here I am editing the i3 config file. It shows syntax error just because a line is broken into multiple lines, with newline's being escaped.

vim editor: editing i3wm config file, syntax anomaly

I have noticed that syntax highlighting breaks on other escape characters too. for example "abc \" def" breaks syntax at the middle ".

Steps to reproduce:

  1. Open a new file with syntax on and :set filetype=i3config.
  2. Type the following text:
exec --no-startup-id kitty
exec --no-startup-id \
    kitty

Notice the difference in syntax in the two lines.

5
  • Welcome to Vim. In order to help people to reproduce your problem could you: add a small example of a text that trigger a warning (not as screenshot but as text), tell us what is the filetype of the buffer (:set ft?)? Commented Apr 22, 2022 at 10:22
  • When I follow your instructions I get no colorization at all. Do you have a plugin installed for i3config? Commented Apr 22, 2022 at 12:22
  • @VivianDeSmedt I have only one plugin, that is gruvbox colorscheme. Nothing I have specific to filetype i3config. My .vimrc sources $VIMRUNTIME/defaults.vim and I have done only few extra configuration outside it.
    – Amith
    Commented Apr 22, 2022 at 14:26
  • Sorry Amith I can't reproduce the behavior. Can you tell us which version of vim your are using. Are you using a Vim distribution like Amix or SpaceVim Commented Apr 23, 2022 at 6:44
  • @VivianDeSmedt my vim version is 8.2. I have gvim installed from debian testing repo. Here is my vimrc in completion if it helps: pastebin.com/su1TWVww . thanks for all the help!
    – Amith
    Commented Apr 24, 2022 at 13:05

1 Answer 1

2

This code uses the i3ConfigLineCont rule.

syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ ...

end=/^.*$/ needs to be end=/^[^\\]*$/ to fix the highlight error. There is a pull request with this fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.