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
0answers
29 views

Create syntax filetype

I'm trying to create a syntax file for a new language/filetype. I followed this tutorial. Here is my (not complete) syntax file, created in directory ~/.vim/syntax/scad.vim: if exists("b:...
0
votes
0answers
27 views

E254: Cannot allocate color SlateBlue

I just freshly installed vim via brew install vim... and presently have version 8.2.3450. In ~/.vimrc I have syntax on, and when I run vim, I get: E254: Cannot allocate color SlateBlue If I delete / ...
0
votes
3answers
41 views

List/navigate specific syntax elements in a file?

I would like to jump through specific syntax elements in a file. For example, quickly navigate to the next string element. In a .vim file strings are defined as vimString syntax elements. For ...
2
votes
1answer
90 views

How to change the color of the prefix "b", "r", "f" or "u" before strings?

Is there any way to do this ? I'm using vim 8.2 with this python plugin. The inside of f strings for example is correctly highlighted but not the "f"
0
votes
1answer
29 views

Using a vim syntax file, I would like some Keywords, such as ??, to be colored

I have been trying to get through the syntax file documentation on vim help, https://vimhelp.org/syntax.txt.html#%3Asyn-files but it's quite the read and I figured someone here may know how to go ...
0
votes
1answer
53 views

Syntax highlighting is incomplete on neovim, fixed by calling Telescope

I have this problem that I would really like to get to the bottom of. If I open a file on neovim it will display like the broken syntax highlighting, see image below. Now, If I run :Telescope ...
2
votes
1answer
33 views

Markdown lists items three levels or deeper are not syntax highlighted

In a Vim markdown file (:set filetype=markdown), special items such as links and itacized text are normally syntax highlighted, but when they appear in a list more than three levels deep, they appear ...
1
vote
1answer
20 views

Modify syntax highlighting dynamically

Is it possible to write a vim plugin that modifies buffer in real time? As a first step, would it for example be possible to modify syntax highlighting of unused variables as suggested in a similar ...
2
votes
2answers
48 views

Custom syntax highlighting: highlight match following keyword

This question might be related to Custom syntax highlighting: highlight word following keyword but after studying that for hours, I could not get it to work. What I want is to highlight vulkan types ...
0
votes
2answers
48 views

Why does an empty vimrc file change my configuration (e.g. disable syntax highlighting)?

Here is the sshconfig syntax highlighting when i do not have any .vimrc file: Let's create an empty .virmc : $touch ~/.vimrc Now let's edit that same file again: Why is this happening? I'd like to ...
2
votes
1answer
28 views

Changing syntax highlight rules priority

I want Vim to highlight tags (#tag) in my Markdown files. I extended the default highlighting by creating ~/.vim/after/syntax/markdown.vim with the following content: syn match mdTag '#\w\+' hi link ...
0
votes
2answers
38 views

What's missing to fold vimscript consecutive comments with "syntax" foldmethod inside function, if, while, etc?

This syntax region fold consecutive comments: syn region vimFoldComment \ start="^\z(\s*\"\)" \ end="\(\z1\)\@!" \ transparent fold ...
0
votes
2answers
42 views

How do I use syntax-nextgroup in this custom syntax file?

Writing vim syntax files never ceases to make me feel like an idiot. I have a new custom language call jsond, and I wanted to get syntax highlighting working in vim. Using racket syntax works pretty ...
0
votes
1answer
36 views

Highlighting won't change when using hi def link

I'm trying to create a basic custom syntax file for the first time, but I noticed that after I set a highlight link it's basically set and I'm not really sure how to change it. Here is my syntax file: ...
0
votes
0answers
29 views

Why does my syntax highlighting disappear after so many splits?

I can successfully run :sp *filename* several times per vim session, but after a seemingly-random number of splits (5-10) all future splits will no longer have syntax highlighting until I fully quit ...
0
votes
1answer
35 views

Toggle specific highlight group

Is it possible to temporarily disable the text highlight under cursor? The current highlight group can be obtained by synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name'). How to clear it to ...
1
vote
2answers
55 views

How to syntax-highlight part of a file in a foreign language?

Using set syntax=lang we can override syntax highlighting of current buffer with lang. Suppose we're editing a Bash script and some string variables are actually HTML code. How to force vim to use ...
1
vote
0answers
75 views

Using Vim as a syntax highlighting tool - Python and TeX interface

I am trying to modify Vim's syntax highlighting rules for Python to suit specific needs : in particular, I need to capture all the line after some regexps (^Out [.*]: and ^\h\w*Error:). After some ...
0
votes
0answers
78 views

How do I make sure terminal vim has syntax highlighting with 'cursorline' and 'termguicolors'?

I searched this issue on the web to no avail and it's most likely not here too. The issue I'm facing goes like this I am trying to switch to vim since I find it cool. I was writing my vimrc and ...
0
votes
0answers
39 views

How to define keywords starting by '*' following by words in syntax file

I want to enable syntax highlighting for Calculix simulation software. The input text file is made of keywords starting by '*', such as *HEADING or NO ANALYSIS. The keyword starts the line and there ...
1
vote
0answers
33 views

Project local keyword highlighting

I want to enable syntax highlighting for custom types in C files. So, in order to highlight a type name MyCoolType, I add the following line to ~/.vim/after/syntax/c.vim: syn keyword Type MyCoolType ...
0
votes
1answer
36 views

Syntax highlighting for uppercase headings using === or --- syntax

In Vim, without using any markdown plugin, headings like # Uppercase heading # lowercase heading lowercase heading ================= lowercase heading ----------------- get highlighted, while ...
0
votes
0answers
29 views

How dose colorscheme file working when python.vim file not exist?

I deleted python.vim in ~./Vim/vim82/syntax directory, and define colorscheme.vim in ~./Vim/vim82/colors directory. The colorscheme.vim contain this code call <sid>hi('pythonNumber', s:...
0
votes
1answer
74 views

manually set syntax highlighting works from command-line mode but not from .vimrc/init.vim

The gruvbox colorscheme and syntax highlighting for C++ doesn't highlight some elements such as: string vector I have this: So I decided to change the colors manually using in init.vim syn keyword ...
0
votes
1answer
52 views

Cannot get rid of persisting highlighting

I switched from macos to linux and have spontaneous highlighting in my document. I tried to get rid of it by doing the following command without success: hi clear no syntax nohlsearch noh The ...
1
vote
1answer
20 views

How to highlight a keyword juxtaposed to an alphabetic region start marker?

I have a syntax whereby #J indicates embedded JSON. This can be followed by any JSON object such as #J[1,2,3]. The atom cases (Boolean, null, number, string) are handled as a json_atom region. This ...
0
votes
1answer
23 views

How to put sync region start=<this> into a variable?

I have the following code: com! -nargs=* ShFoldFunctions <args> fold ShFoldFunctions syn region shFunctionOne start="^\s*[A-Za-z_0-9:,][-a-zA-Z_0-9:]*\s*()\_s*{" end="}&...
4
votes
1answer
80 views

LaTeX dollar signs confuse syntax highlighting

I am editing LaTeX code such as: \documentclass{article} \usepackage{booktabs,tabularx} \begin{document} Blah blah Blah blah \begin{table}\centering \begin{tabular}{>{$}l<{$}p{4in}} %...
0
votes
0answers
24 views

Enable syntax highlighting for files opened by quickfix commands like cc

After populating quickfix window using commands like :vimgrep, when I jump to a quickfix entry using cc <number>, if the file corresponding to that quickfix entry wasn't already opened in a ...
0
votes
1answer
22 views

Syntax Match PLSQL Label

A PLSQL Label uses this syntax <<LABEL_NAME>> How can I highlight everything inside and including the opening and closing angle braces? I've tried the following: syn match PLS_label "...
0
votes
1answer
100 views

Why my markdown syntax is not working?

I'd like to edit text with markdown syntax. Searching for ways of using mixed syntax in the same file I've discovered this question with an answer saying that if I add the line let g:...
0
votes
0answers
87 views

Syntax highlighting not working in vim when containerized in docker

I am running an instance of Vim in a docker container, with configuration mostly taken from here (up untill " Build debug and release targets...) As you can see on the pic, clangd-completer works ...
0
votes
2answers
32 views

Highlight region between curly brackets but only when it occurs after a keyword in the same line

So I have a language that looks something like this: proc someprocess : (arg1: type1), (arg2: type2) ... |- (channel: type) = { send $ch msg ; pay $ch {n} ; } I want the {n} to be highlighted ...
0
votes
1answer
28 views

Vim shortcut for :tabprevious change opened file on start

I try to configure my .vimrc file adding new shortcuts for my daily routing. One of my basic operations in every single IDE is switching between "tabs". I suppose to put the same key binding ...
5
votes
1answer
88 views

Disable spell checking for URLs in BibTeX

I would like to disable spell checking for the URLs in my BibTeX (.bib) files. I was able to disable spell checking for the citation keys (author-year or author+year) as follows: autocmd FileType bib \...
0
votes
0answers
42 views

How to get syntax group name of a floating window

I would like to change the font from bold to normal in my floating windows in Vim 8.* I have this script here that gets the syntax group name of the item under cursor. However, this will not work for ...
1
vote
1answer
70 views

I use the glsl syntax highlighting file, it works the first time I load a shader, after that, no highlight, why?

I've a project where I work on OpenGL Shaders. I downloaded the glsl syntax file and installed it on my computer (a personal folder) and then added the following auto-load line to my .vimrc: au ...
2
votes
1answer
82 views

How to disable JSON error highlighting on the current line?

Problem I find the error highlighting really distracting, its not that I don't want it because it is really useful for spotting errors in JSON syntax, but, I really dislike that it highlights new ...
0
votes
1answer
185 views

What is the term of feature used by on-the-fly checkers?

Here are two screenshots, with vim and neovim, both with configured language server protocol and showing same file: Neovim: Vim: I want to configure neovim to have same style as vim -- I do not like ...
0
votes
0answers
140 views

Make vertical line colorcolumn thinner?

I set a vertical line with setlocal colorcolumn, is there a way to make it thinner? Or a workaround? I already have a function to color long lines but I prefer to have a thin vertical line. I changed ...
1
vote
0answers
35 views

How to know where a syntax was set?

I want to know what line and file syntax region foo start... was set. I have tried this: :verbose syntax foo :syntax foo? :verbose syntax foo?
3
votes
1answer
84 views

Syntax highlight groups of digits in large number

I often view logs in vim, and the log contains large numbers eg 3244522321. It's very difficult to tell if this is 324M, 32M, or 3.2M. Is there a way to set up something (syntax highlight?) that will ...
0
votes
1answer
46 views

Default syntax groups use colors >=16 [closed]

I have few quetion about color scheme and terminals... The web is plenty of posts about it but I still does not understand the following: After a fresh install of (g)vim on arch, I did a $ vim ...
0
votes
0answers
123 views

Adding a nasm syntax file to vim runtime directory doesn't work

I am trying to learn a bit about x86 assembly and Vim didn't have a syntax highlighter installed for it. I downloaded this One from github and placed it in the ~/.vim/after/syntax/ directory but this ...
0
votes
1answer
91 views

Language specific custom syntax highlighting

So I have to follow a name convention for my C data types : Typedefs must start with a t_ prefix such a t_mytype. Structs must start with a with an s_ prefix and so on for other data types. So I added ...
0
votes
1answer
27 views

Apply new 'bold' highlight rule to all format, preserve color

Since I usually use a blank line to denote start of a new codeblock (function, class, etc.) I defined the following syntax rule. The intent is to make the first line of a code block standout. While ...
0
votes
1answer
142 views

Is there a plugin for syntax highlight for assembly MIPS?

I haven't been able to find any syntax highlighting for MIPS assembly language. I have CoC installed, but I don't think it supports MIPS. Is there any other plugin that I could use for basic syntax ...
0
votes
1answer
30 views

Can vim highlight nestable regions?

Is vim's syntax highlighting limited by regexes or can you, for example, highlight [ words_and_maybe_keywords... [ words_and_maybe_keywords... ] words_and_maybe_keywords... ] all the same (e.g., green)...
1
vote
0answers
43 views

Syntax highlighting in parallel folders [closed]

My syntax highlighting does not work for my C-project, if I use folders in parallel. Consider this file tree: project ├── include │  ├── main.h │ ├── file1.h │ └── file2.h └── src ├── main.c ...
1
vote
2answers
75 views

Vim HTML syntax highlight doesn't correctly identify comment endings consisting of minuses

if I edit the following block in vim: <div> foo </div> <!-----------------------------------------------------------> <div> bar </div> <!-------------------------------...

1
2 3 4 5
12