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
1 vote
1 answer
41 views

Highlight link description in vimwiki

I'm trying to customize the colorscheme One for Markdown under Vimwiki. I'd like to change the color of the Description in [Description](URL). In my .vimrc I have the following relevant lines: call ...
Ludenticus's user avatar
0 votes
0 answers
21 views

Why is the VHDL file syntax not working properly? [closed]

If open a vhdl file, syntax highlight looks strange. Like below screenshot, comment color is wrong. If run syntax on, color becomes correct. Below are my .vimrc syntax settings. filetype plugin on ...
Fisher's user avatar
  • 1,086
1 vote
1 answer
37 views

Syntax highlight for .tpl / cloud-config / cloud-init files

I am using cloud-init to parametrize cloud clusters. This is achieved via #cloud-config files, which usually have a .tpl or .tf.tpl extension. Here are a few examples, one of them illustrated below: #...
Adama's user avatar
  • 111
0 votes
1 answer
27 views

Text randomly shown in italics after being sent to a REPL with iron.nvim

Some parts of my code, apparently at random, are rendered in italics, and when I type it goes back and forth from italics to normal. Why is that and how I can avoid that? EDIT: Contrary to what I ...
robertspierre's user avatar
1 vote
2 answers
43 views

In gVim 9.1 how to have different backgrounds for text and the empty area to the right of <EOL>, with hlsearch ans syntax highlight still working?

I would like to use two different backgrounds colors bg1 and bg2 with: bg1 for all text on a line (possibly nothing if line is empty) up to the end-of-line, bg2 for the empty area after the end-of-...
gilgron31's user avatar
3 votes
2 answers
77 views

Vimdiff bad line alignment and subsequent diff visualization

Let's say I have two files with the following contents: this is some important text another different line if another is needed here it is and this is some important text we now first add two new ...
Svalorzen's user avatar
  • 131
1 vote
1 answer
78 views

How can I enable highlighting such that all Python variables use the same color?

When I was using VSCode as my main code editor, many extensions like The One Dark Pro theme offered variable highlighting. This is not Semantic highlighting, where each variable is assigned its own ...
KhodeNima's user avatar
  • 131
0 votes
0 answers
39 views

Remove Vim highlighting on double quotes

I have syntax highlighting enabled so that I can change my comment colors in Vim. However, I don't want Vim to highlight something like this "text here, including the speech marks get ...
john smith's user avatar
0 votes
1 answer
55 views

How to customize comment?

For a specific type of file, want to define customized comment with below requirements. Comment is start with -comment. Comment content is surround by curly brackets { }. Only show comment content ...
Fisher's user avatar
  • 1,086
1 vote
1 answer
58 views

Vim in tmux and WSL: cannot highlight using ctermbg

I'm using Vim inside tmux, which runs in WSL (due to work reasons). As per documentation, I decided to change my Visual highlighting style using :hi cterm=NONE ctermbg=<insert-color-here>. ...
linhns's user avatar
  • 11
0 votes
1 answer
54 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
  • 713
1 vote
1 answer
49 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
53 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
69 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
71 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
39 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
373 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
  • 713
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
50 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
52 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
40 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
79 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
34 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
34 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
93 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
63 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
69 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
139 views

What options do I have to give time-only (i.e dependent on a call to a DB via 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,184
0 votes
1 answer
98 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
48 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
49 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
69 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
35 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
98 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
70 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
35 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
52 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
321 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
844 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
85 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
630 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
1 answer
1k 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
61 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
3k 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
45 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
155 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
618 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
  • 451
0 votes
1 answer
294 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
106 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

1
2 3 4 5
14