New answers tagged syntax-highlighting
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.
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 ...
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 ...
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 ...
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 ...
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&...
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(...
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 ...
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 ...
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 ...
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-...
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 ...
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.
...
Top 50 recent answers are included
Related Tags
syntax-highlighting × 784vimrc × 73
colorscheme × 62
highlight × 59
neovim × 53
vimscript × 52
regular-expression × 47
filetype × 27
filetype-markdown × 27
filetype-tex × 24
conceal × 23
folding × 21
color × 20
gvim × 19
spell-checking × 18
terminal × 17
filetype-python × 17
filetype-c × 13
indentation × 9
macvim × 9
filetype-c++ × 9
filetype-html × 9
filetype-javascript × 9
microsoft-windows × 8
plugin-system × 8