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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
48 views

How to apply a specific syntax to a range within a file?

My cypher files are properly highlighted, however I have python files that include large texts of cypher like so I would like the cypher part to be have the same cypher syntax highlighting like so I ...
abbood's user avatar
  • 673
1 vote
1 answer
38 views

Disable syntax expansion on cursor hover

I use Neovim with Vimwiki for a personal wiki of mine. I frequently use its syntax for changing typeface; for example _ _ for italic and * * for bold. The syntax is expanded when the cursor is on a ...
efefe's user avatar
  • 11
1 vote
1 answer
32 views

How to replace the default python syntax in Neovim without a plugin manager?

As the title, I would like to replace the default python syntax with the more modern one in https://github.com/vim-python/python-syntax. I managed to do this in Neovim 0.9.4 with the vim-plug plugin ...
IvanProsperi94's user avatar
2 votes
1 answer
60 views

syntax coloring does not work for flex file

I'm using nord theme, it works normally with other kind of files but not flex file I have syntax on and filetype on I tried switching colorthing from gruvbox to nord but it still behaving the same. ...
Danh Le's user avatar
  • 23
1 vote
2 answers
44 views

How can I extend syntax highlighting with my own keywords?

I already have syntax highlighting for javascript, but what I'd like to do is extend it with some additional rules. What I've been trying to start, is using highlight "Prototype" with a cyan ...
Sophie McCarrell's user avatar
2 votes
0 answers
33 views

Syntax match only within a particular region (but also within other nested ones)

Is it possible to get VIM to recognize syntax changes inside a particular region? Specifically, I am trying to get LaTeX3's \ExplSyntaxOn...\ExplSyntaxOff syntax to be highlighted, but only inside a ...
karlh's user avatar
  • 405
0 votes
1 answer
77 views

How to disable lsp server syntax highlighting?

I found out that my lsp servers is somehow adding this ugly highlighting to my code (this happened after I updated my Homebrew for some reason), here are before and after pics: Here is my lsp server ...
abbood's user avatar
  • 673
0 votes
0 answers
15 views

Syntax match array of builtin types

I'm writing a syntax file for Solidity files. Solidity has several built-in types, such as uint8, uint16, ..., uint256, bytes1, bytes2, ... bytes32, etc. One can have arrays for pretty much all types ...
Henrique Barcelos's user avatar
1 vote
0 answers
41 views

How to distinguish between built-in and user-defined functions in Vim syntax highlighting for C?

I'm currently using the following code in my c.vim to highlight function names in C: syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cParen,cCppParen hi def link ...
N00B_141's user avatar
1 vote
1 answer
39 views

Set different colours for different HTML tags

Can we set different colours for different tags in HTML syntax? For example, set a tags to green and div tags to yellow. In VsCode this extension makes HTML tags coloured inside .html, .jsx, .tsx and ...
mohamadi_arch's user avatar
2 votes
1 answer
35 views

Fixing JSON highlighting refresh

When I manually edit json files, I end up with red boxes falsely alerting me to syntax problems until I take manual action to refresh those lines. I start with a file with a key/value pair: { &...
Stewart's user avatar
  • 123
3 votes
1 answer
63 views

Vim syntax highlighting: conceal does not work when opening files from netrw

I use Vim version 8.2.4919 without 3rd party plug-ins on Ubuntu 22.04.2 LTS running via WSL2. I want to have italic syntax highlighting for words encapsulated in underscores in comments of my cpp ...
0x706173696D75's user avatar
1 vote
1 answer
30 views

Different Context Mode for highlight group

I can define different highlight groups for different documents. For example, in a general text document, I would define highlight groups as Header1, Header2, Header3, and Normal Text, with different ...
athos's user avatar
  • 135
1 vote
1 answer
25 views

How to use different font size for different highlight group?

There is a similar question gVim - Use different fonts using :highlight but no answer yet. In short, is it possible to apply different font size to different highlight group? For example, while normal ...
athos's user avatar
  • 135
1 vote
0 answers
38 views

How to prevent the ansible format from getting overwritten?

I am using this plugin for ansible: ansible-vim, I am installing it with lazy like this: return { 'pearofducks/ansible-vim', build = 'UltiSnips/generate.sh', lazy = false } When opening a file ...
nbari's user avatar
  • 131
0 votes
1 answer
41 views

I've switched to nvim and init.lua, which pulls in onedark colorscheme. How can I add a custom rule?

I have C-style comments inside PHP strings that contain SQL code, so I can easily understand what the query is doing when I see it running on the server. DB::runQuery('/* this is my SUPER complicated ...
Codemonkey's user avatar
1 vote
0 answers
23 views

How to add a syntax rule to LaTeX filetype?

How can I colorize elements of the regex rule "\w\+:\w\+:\d\{4\}" in a LaTeX file ? If I open a new document with no filetype and add the two following command : syn match Bib3Dots '\w\+:\w\+...
chuugar's user avatar
  • 11
1 vote
0 answers
63 views

\zs not working in syntax file?

Udated 2023-09-11: Changed example to asterisk as it is simpler and the question now refers to \zs instead of \ze as \zs seems to be the issue. I am trying to adapt the VIM Markdown syntax file so ...
StaticNoiseLog's user avatar
0 votes
0 answers
48 views

What options do I have to give time-only (i.e dependent on a call to a DB vai http) dependent coloring to the words matching a regex?

Say the special strings are those matching the regex \<prefix[0-9]\+\>, and say that an HTTP request I can do via system can tell me that that item is in one of three states, Green, Red, or Blue....
Enlico's user avatar
  • 2,172
0 votes
1 answer
69 views

MacOS - Vim overriding my highlight config in ~/.vimrc

~/.vimrc: set backspace=2 set nocompatible set clipboard^=unnamed,unnamedplus syntax on set expandtab tabstop=2 shiftwidth=2 set smartindent set hlsearch set incsearch set ignorecase set number ...
ray's user avatar
  • 1
1 vote
1 answer
40 views

Conceal highlighting not applying to Vim help files

The Conceal highlighting is not working properly when I edit a Vim help file. When I'm in insert mode on a line with concealed text, the concealed characters will be black on black. I can only see ...
Starfish's user avatar
  • 113
1 vote
1 answer
48 views

Syntax highlighting of a submatch

I have the following syn match specialNumber /1/ contained syn match normalNumber /\d/ contained syn match line /^\d$/ contains=specialNumber,normalNumber hi def link ...
xvf99680's user avatar
0 votes
1 answer
57 views

External syntax highlighting

Is there a way (even theoretical) for Vim to use an external program for syntax highlighting? For instance a program that reads buffer content from stdin and prints single-character colour identifiers ...
ngn's user avatar
  • 163
0 votes
1 answer
28 views

Cross-compiled Vim on ARM - only colours are bold, & underline

I cross-compiled Vim 9.0 for ARM / arm-linux-gnueabihf (after also cross-compiling ncurses): # ac_cv_sizeof_int=4 \ vim_cv_getcwd_broken=no \ vim_cv_memmove_handles_overlap=yes \ ...
Kingsley's user avatar
  • 121
3 votes
1 answer
89 views

Do not red underline unicode control points as misspelled words

Vim highlights Unicode control points as misspelled words. So correctly spelled words with Unicode strikethrough (overline, ...) always appear misspelled. Ideally this would be corrected as a setting ...
kevinlawler's user avatar
1 vote
1 answer
63 views

Proper regex to prevent a match when keyword is preceded by a period

I'm writing a color syntax highlighting file for a derivative of Pick Basic. Two of the oddities that this language allows is periods in variable names and embedding a keyword in a variable name, ...
Corydon76's user avatar
0 votes
1 answer
33 views

Is there a way to apply syntax highlighting to the results of :g?

I do a lot of work with log files, and I use a lot of hi def foo and syn match foo in my .vimrc. Is there a way to apply that syntax formatting to the results of a :g command?
Brian J's user avatar
0 votes
1 answer
51 views

Block comment syntax colouring being lost while moving, but redraw will fix

I frequently use block comments to disable sections of terraform code using /* to start disabling and */ to complete. As expected, the code will turn "grey" and lose syntax highlights. ...
Peter McEvoy's user avatar
0 votes
1 answer
243 views

TSEnable highlight - true by default

I'm using the plugin 'nvim-treesitter/nvim-treesitter', and I can enable syntax highlighting by using the command: :TSEnable highlight However, once I close n/vim it reverts back to disabled. I'm ...
Ari's user avatar
  • 101
1 vote
2 answers
584 views

Is there a way to disable Treesitter in Telescope?

I have max file size rule for files, setup in treesitter config, it works: require 'nvim-treesitter.configs'.setup { highlight = { enable = true, is_supported = function() if vim.fn.strwidth(...
Vlad Mosienko's user avatar
0 votes
2 answers
74 views

Capturing a group in a pattern used in a Vim autocmd

I need Vim to ignore the .tmpl file extension to enable syntax highlighting. How can I rewrite this: autocmd BufNewFile,BufRead *.lua.tmpl set filetype=lua to be more general? I want to match the lua ...
Nikita M. Grimm's user avatar
1 vote
1 answer
436 views

Syntax highlighting breaks with rust analyzer

I have been using neovim for several months with basically no issue and enjoying it very much. I have recently started receiving a problem with the syntax highlighting in Rust. When the file first ...
funnyboy_roks's user avatar
4 votes
0 answers
996 views

How to disable semantic highlighting for certain filetypes only?

Using Neovim's native LSP interface, I noticed that semantic highlighting provided by LSP makes things worse for certain languages, so I want to disable it based on filetype. I know about possibility ...
Thunderbeef's user avatar
0 votes
0 answers
53 views

NeoVim stopped working correctly: multiple distributions show same errors

I was writing some code. Everything was working fine, and at some point syntax highlighting broke. When a file loads at first everything is ok. Then after about 10 seconds the highlighting changes. ...
Rick's user avatar
  • 1
2 votes
1 answer
2k views

Disable treesitter highlighting for neovim 0.9

I do not use syntax highlighting, except for a few elements like errors, matched parentheses, search results, and diffs. Yesterday I updated NeoVim installation to v0.9.0 and now I see colors in for ...
Karolis Koncevičius's user avatar
0 votes
0 answers
43 views

syntax highlighting for . and : in Lua function calls

Is there a syntax token name that can be used to configure syntax highlighting for the . and : characters in Lua function calls? I tried the following with every possible value of TOKEN-NAME I'm aware ...
Mark Volkmann's user avatar
-1 votes
1 answer
124 views

How can I remove inverted background colors with Dracula colorscheme?

I'm using Dracula colorscheme without anything in .vimrc byte/int/void has background highlight, how can I disable it ? Update: removing hi! link Type DraculaCyanItalic worked
whoopdedoo's user avatar
0 votes
1 answer
497 views

How to get list of highlight groups for a region under cursor? (problem with synIDtrans function)

My purpose is to get information which would explain why the region under cursor has that particular color. Yes, there are several very similar questions, but still my question is different. I can get ...
lesnik's user avatar
  • 441
0 votes
1 answer
140 views

Use regex pattern as argument to function

I want to be able to pass a plain regular expression like so autocmd BufReadPost * call TextEnableCodeSnip('bash', /^hello/, /^world/, 'SpecialComment') To a function and use it within as a regular ...
drcomputer's user avatar
0 votes
2 answers
97 views

GNU Octave octave.vim syntax file auto indent not working

Before introducing the octave syntax file in ~/.config/nvim/syntax/octave.vim from here auto-indent worked as expected. After introducing the file, the syntax coloring works, but the auto-indentation ...
notabot's user avatar
0 votes
1 answer
263 views

How to set the ALE configuration `g:ale_exclude_highlights`?

I use ALE to check coding style, but I want to ignore the warning type:line too long, like this picture: And I find the related setting g:ale_exclude_highlights, this is its explanation in :help ale :...
theabc50111's user avatar
0 votes
0 answers
22 views

How can I make SyntaxRange#Include for another language balance the braces?

Currently I'm doing the following call SyntaxRange#Include('\v\\(py|pyc|pyq|pycq)\s*\{', '}', 'python', 'Statement') so that code such as \py{print(1)} highlights the part inside as Python code. ...
user202729's user avatar
9 votes
2 answers
1k views

Syntax highlighting for shell scripts broken

Since recently my syntax highlighting for ft=sh (also syn=sh is set) is broken: Why is that? How can I fix it? Edit: I'm using Vim 9.0 with patches 1-1302. I add here the code from the screenshot. ...
pfnuesel's user avatar
  • 704
0 votes
0 answers
242 views

Is there a way to prioritize native syntax highlighting groups over nvim-treesitter in Neovim?

So I've been trying to add some syntax highlighting for lua-language-server annotations in Neovim. The language server is set up using lspconfig so I don't get builtin support for those highlights the ...
Gwen Reynolds's user avatar
0 votes
2 answers
62 views

Prevent a syntax file from being sourced?

I want to use filetype=nasm to get syntax highlighting in assembly files (ending with a .asm extension). I have the following autocommand for it: augroup FileTypes au! au BufNewFile,BufRead *....
First User's user avatar
0 votes
1 answer
38 views

How to predefine functions in syntax file?

I have a syntax file for CSV files. To be able setting the separator, there is a function ChangeChar() and the syn match ... terms are variable. To initialize it ; is used. But to call the SetMatches()...
Andy A.'s user avatar
  • 225
0 votes
1 answer
88 views

How to use variable in syntax match

I have made (better said got) a syntax file for CSV files. This works fine so far. But there is the semicolon used as seperator. I want to be able to change the seperator e.g. by a function / mapping /...
Andy A.'s user avatar
  • 225
0 votes
0 answers
16 views

Exclude a single level of nesting region from another region

I am trying to define syntax highlighting (and more importantly, folding) for the following region (a Rust doc comment preceding e.g. a function): 1┌ /// <- region starts here, at the first triple-...
Circonflexe's user avatar
0 votes
0 answers
332 views

nvim [syntax highlighting]

I'm using macOS with the kitty terminal emulator. The problem I have is when working with .tex files: The syntax highlighting of nvim is overlapping to colors so I have to mark those spots in order to ...
hal3m's user avatar
  • 1
5 votes
1 answer
44 views

How can I recursively use syntax inclusion for two languages?

In Vim, I want the syntax \begin{pycode} ... \end{pycode} to syntax highlight the content inside the environment in Python, and the syntax (#TeX r""" ... """) to syntax ...
user202729's user avatar

1
2 3 4 5
14