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.
788 questions
1
vote
0
answers
32
views
Syntax-highlighting is gone
I am writing some Go code in VIM - Vi IMproved 9.1 on a Lubuntu laptop.
From around line 800 onward (my file has currently around +-1200 lines) Vim can not recognize strings and the syntax-...
1
vote
0
answers
36
views
+150
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 ...
2
votes
1
answer
641
views
Why is "1" colored differently than "-4" in "ls -d [1-4]" with Bash syntax highlighting?
As far as I know, I can set Bash syntax highlighting for a buffer with :set syntax=bash.
So I open a new buffer and insert ls -d [1-4], and do :set syntax=bash. Then, I see that 1 in 1-4 is colored ...
0
votes
1
answer
50
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
3
answers
126
views
How can I avoid garish vimdiff change highlighting without going into deep vim voodoo?
I am but a simple man… I work on a black-background, light-gray foreground terminal, and I am a long-time, but in no way an expert, user of Vim. Disliking the default color scheme, many years ago I ...
1
vote
1
answer
110
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 \...
1
vote
2
answers
66
views
Syntax Highlighting - highlight command not working as expected
I created a new custom file type called foo:
$ cat ~/.vim/ftdetect/foo.vim
au BufRead,BufNewFile *.foo set filetype=foo
I created a new syntax group:
$ cat ~/.vim/after/syntax/foo.vim
syntax keyword ...
2
votes
1
answer
89
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 ...
0
votes
1
answer
115
views
How to highlight text inside [...] differently than text inside ![...]!
The goal is to highlight text inside [...] with a different color than text inside ![...]!
Also everything should be nestable such that [...] could contain ![...]! inside of it or vice versa and the ...
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 ...
1
vote
1
answer
106
views
How to highlight across regions?
I have a special format in .html.specialext, it is basically an HTML file with special regions delimited by {{ and }}, containing Lua code.
Here is my syntax file (specialext.vim):
if exists("b:...
0
votes
0
answers
85
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 = {
...
2
votes
2
answers
477
views
Problems with syntax highlighting
I'm using gVim v9.1 on Microsoft Windows 10.
I tried to get syntax highlighting going for CNC Gcode files but ran into all sorts of problems. I looked up the Vim documentation and searched on the ...
1
vote
1
answer
191
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
0
answers
97
views
Vim slow upwards scrolling in file with vim9script
If I open the file popup.vim in vim and go to the bottom with G, then scrolling upwards with k is extremely laggy.
The problem only occurs if I hold down k, pressing it repeatedly it works fine. ...