Skip to main content

New answers tagged

0 votes

How can I have syntax (e.g. Statement) inside PreProc inherit PreProc's background?

Syntax items can not inherit attributes from parent group, unless intentionally defined as :h :syn-transparent. So, no, you can't.
Matt's user avatar
  • 21.3k
0 votes

Make my edit session turn off highlighting if on a black and white (BW or B/W) terminal

Keep it simple. There is no need to devise cool heuristics for things that are easily done in interactive mode. If you want to switch off syntax highlighting for some file then type :set syntax=off ...
Matt's user avatar
  • 21.3k
1 vote
Accepted

Make my edit session turn off highlighting if on a black and white (BW or B/W) terminal

This is an excerpt of the default.vim that Vim uses when there are no .vimrc available: " Switch syntax highlighting on when the terminal has colors or when using the " GUI (which always has ...
Vivian De Smedt's user avatar
0 votes

Multiple nesting in syntax highlighting

This is not an answer, but a placeholder of graphics in response to Matt, I've transferred his answer (and jiggle it some more for effect) into here. " Debugging pattern " hi link test_any ...
John Greene's user avatar
2 votes
Accepted

Multiple nesting in syntax highlighting

This one looks absolutely straightforward to me. syn region level1 start=/header/ end=/trailer/ contains=level2,error1 syn match error1 /anything except trailer, empty space or {/ contained syn region ...
Matt's user avatar
  • 21.3k
1 vote

Multiple nesting in syntax highlighting

If I broke the EBNF down a bit further such that: By focusing on the lowest, deepest grouping (block_2), we get " Inside nest 2 " hi link trailer2 Number syn match trailer2 "trailer2&...
John Greene's user avatar
1 vote
Accepted

Neovim syntax highlighting from STDIN

I would do the following. I would add a json.vim file into your ~/.config/nvim/ftdetect folder with the following content: autocmd BufEnter,BufRead * \ if matchstr(getline(1) . getline(2) . getline(...
Vivian De Smedt's user avatar
0 votes

syntax highlighting needs rejoining back to common regexes

Vim's match (or region) always wants to know both "start" and "end" condition beforehand (though inner matches may extend it afterwards). This is what you're missing in your ...
Matt's user avatar
  • 21.3k
1 vote

syntax highlighting needs rejoining back to common regexes

I'll attempt a short answer here. Based on my experience, it seems you are trying to use classical parsing in a way that is not possible Vim's syntax engine. I would instead "embrace" the ...
Karl Yngve Lervåg's user avatar
2 votes

Where is a good resource on AND-OR-XOR-NOR logic of using `syntax`

No, it doesn't work like this. Vim tests possible matches according to the current context. That is, topmost level vs. inside of some particular region (or match). On the topmost level it tries every ...
Matt's user avatar
  • 21.3k
2 votes

Using cluster, the shorter regex pattern 'rt' matched but not longer 'rt0', 'rt2', 'rt4' pattern

You must match also the next item or, at least, first few chars of it in order to resolve the conflict between rt, rt0, etc. The extra match could be discarded then with the help of :h /\ze or :h :syn-...
Matt's user avatar
  • 21.3k
1 vote

Questions about spelling

For anyone having the same problem, the default English vim spellfile en.utf-8.spl found here has four relevant entries where /regions=usaucagbnz: i/13 i.e./245 e/134 e.g./245 Note how i and e cover ...
Tom's user avatar
  • 137
0 votes

Questions about spelling

Vim's spell file for English does in fact not contain "e.g." or "i.e.". Single letters are included in the spell file, this is why "e.g." isn't marked as an error itself. ...
Friedrich's user avatar
  • 2,815

Top 50 recent answers are included