Questions tagged [syntax-highlighting]
Syntax highlighting is the use of colours, size, typeface, or other attributes to visually indicate it has a special meaning and therefore make it easier to understand the text. For example, marking language keywords with a specific colour.
787 questions
1
vote
0
answers
24
views
How to syntax highlight SQL placeholders like ":myParam" in PHP when I'm using nvim & Treesitter
I'm using treesitter inside neovim, for all of the awesome reasons we already know.
My (legacy) code has a lot of SQL statements in PHP strings. Using TS I've got it to recognise SQL inside PHP ...
0
votes
1
answer
48
views
Loading a colorscheme in a white-on-black terminal results in various built-in highlight groups being cleared
(This is a second attempt at solving the underlying problem from `hi clear` in colorscheme unsetting certain LaTeX highlights, posted in response to comments made under Maxim Kim's answer.)
I am using ...
1
vote
1
answer
109
views
`hi clear` in colorscheme unsetting certain LaTeX highlights
I am using Vim 9.1.1800, installed via Homebrew on macOS Sonoma 14.7.8. Currently, when I open the following minimal *.tex document in Vim:
\documentclass{article}
\begin{document}
\textbf{Bold} and \...
2
votes
1
answer
88
views
synID() on treesitter highlighting
My script includes synID() but does not work on a help file after nvim 0.10.0. It is because nvim starts to use treesitter highlighting and does not set the syntax option. Is there any alternative ...
1
vote
1
answer
78
views
Why are TypeScript files with shebang in nvim rendered in gray?
I have installed the up-to-date tree-sitter-typescript, and it works well in typescript files without shebang.
I searched online but couldn't find any particularly similar questions. Some people ...
0
votes
0
answers
83
views
How to ignore missing modules for pyright LSP in nvim-lspconfig?
I have this right now,
local servers = {
pyright = vim.tbl_deep_extend('force', default_settings, {
settings = {
python = {
analysis = {
...
1
vote
1
answer
187
views
How to set a highlight group on the captured name of a tree-sitter node?
I'm using nvim v0.11.1 with nvim-treesittter.
I often edit Python code with strings containing SQL, and I would like to apply highlighting on the SQL strings.
I've created a file ~/.config/nvim/...
1
vote
2
answers
180
views
TeX syntax: is it possible to change from "stylish" to "non-stylish" after the file is loaded?
When editing a .tex file, is it possible to change the syntax highlighting after a file is loaded so that @ is able to be recognized as part of a command? Normally, this is done at load-time when .sty,...
0
votes
1
answer
91
views
:hi command in ~/.vimrc not being read
I have set several commands in my .vimrc file, all of which work besides:
:hi MatchParen cterm=none ctermbg=white ctermfg=red
My other commands are:
:colorscheme wildcharm ...
2
votes
1
answer
129
views
syntax match not working
I want to stop Vim from spell checking inside LaTeX comments. In my .vimrc I have the line:
syntax match Comment /%/ contains=@NoSpell
It does not work, but if I reload .vimrc with :so ~/.vimrc it ...
0
votes
1
answer
165
views
How to color pairs of parentheses?
I am looking to color the parentheses in Python and other languages and the the tags in HTML. But the thing is, I want the parentheses at different levels to be colored differently.
Basically, I am ...
2
votes
2
answers
137
views
Vim colorscheme is different on launch and after any inputs
I recently updated zsh and homebrew, and cannot determine where the error arose. When I launch vim, I see the usual syntax highlighting like this:
The moment I interact with vim in any way (cursor ...
0
votes
0
answers
31
views
How to highlight the remaining invalid pattern of a word?
I was using this method for highlighting invalid pattern of variable names:
hi link variable_name Variable
syntax match variable_name "\v[A-Za-z][A-Za-z0-9]{0,15}" skipwhite contained
\ ...
0
votes
1
answer
65
views
How to add more keywords to Vim colorscheme?
I stumbled across this amazing colorscheme (I wish I knew where to find it): screenshot
I recreated the python file shown and I noticed that that colorscheme has several more syntactical elements ...
-1
votes
1
answer
79
views
Tree theory; Vim syntax (for highlighting) supports non-directed graph or acyclic graph?
This question is about Tree theory and the handling of such tree concept used by Vim syntax/highlighting in a typical syntax/mylanguage.vim.
Is it true, for Vim, that exactly one path is ONLY ...
0
votes
2
answers
103
views
Where to put the extra coloring of highlights (not found in most colorschemes)?
Working on a new syntax file for nftables (here).
If a syntax file has introduced (oh, let us) say about 50 more unique colors via highlight (and highlight link) statements, where should these many ...
1
vote
1
answer
89
views
nML syntax highlighting
I'm trying to use Vim with ASIP Designer and read files written in nML, a description language for processor designs. I searched Google and the community with the tag "nML" but saw no ...
0
votes
1
answer
361
views
How to make Vim highlight the content of a Markdown code span or code block?
When I format text either as a Markdown code span or Markdown code block, using backticks, like
```
code block
```
`code span`
then Vim highlights only the backticks, not the text inside.
For me it ...
1
vote
1
answer
150
views
Setting a custom highlight for a certain filetype
I'm trying to set up a minimal Vim configuration, and want to highlight all instances of the words FOO and BAR inside all *cpp files.
My .vimrc:
syntax enable
source config/highlights.vim
Inside ...
1
vote
1
answer
30
views
jsRegexpString makes syntax highlighting so slow
I have some javascript files with hard coded base64 strings, and there is horrible lag between cursor commands.
When I did a syntime report, I am seeing:
3.553307000 589 38 0.196905000 0....
0
votes
0
answers
36
views
Debugging syntax highlighting - trying to mix C and TT2
I've tried to create syntax file for C code generated via Perl's Template::Toolkit 2, using same sourcing like as in tt2html.vim - just changed html.vim to c.vim (those are all in standard ...
1
vote
0
answers
50
views
Typescript syntax highlighting uses Error for keywords
I'm having trouble getting good syntax highlighting for typescript files. The issue is that reserved words are highlighted as Error:
Looking at :scriptnames I see the default typescript highlighting ...
1
vote
0
answers
44
views
syntax regions "contains" behave differently when included by another syntax?
I'm trying to resolve https://github.com/chr4/nginx.vim/issues/24, where Lua code embedded inside Nginx config is highlighted incorrectly:
I've managed to trim down the highlighting code to a minimal ...
0
votes
0
answers
75
views
Write a temporary one-liner to the bottom line after opening a file?
When opening a file whose filetype extension is governed by ftdetect, i wish to write a single-line to the vim status bar (bottom line) that says something like:
To enable syntax highlighting for this ...
0
votes
3
answers
143
views
Multiple nesting in syntax highlighting
I've got a EBNF that needs to be Vim-syntaxed:
header :== 'header' ( '{' 'header1' ( '{ 'header2' nest_3? 'trailer2' '}' )? 'trailer1' '}' )? 'trailer'
Railroad diagram gets me:
And I'm struggling ...