Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
11 views

Preview syntax highlighting from Telescope more accurate than in nvim buffer

Syntax highlighting within Telescope preview shows up better than inside neovim itself. From what I understand, the Telescope preview is based on what it would look like in an nvim buffer, so what am ...
user avatar
  • 1
1 vote
1 answer
49 views

What is the significance of duplicating syntax-group name references?

According to :syn-define, several syntax ITEMs can be put into one syntax GROUP. Am I correct to infer that, regardless of the number of ITEM instances, e.g., syn keyword alphaBeta alpha beta syn ...
user avatar
1 vote
2 answers
33 views

Upgraded my mac OS and now the vim colors are different. Is there an easy way for me to change the default syntax?

I upgraded my mac to Catalina and now the vim syntax looks all off to me. I am sure that strings used to be red, and I think that def used to be turquoise and import was pink. Is there a simple way ...
user avatar
0 votes
0 answers
22 views

Overriding syntax highlighting for LaTeX defaults in vim

I am currently using default syntax highlighting for LaTeX in vim on a Windows machine. Here are the contents of my _vimrc file: set number set belloff=all syntax on set backspace=indent,eol,start set ...
user avatar
  • 111
0 votes
0 answers
39 views

syntax highlighting breaks on escaped newlines / characters

for example, here I am editing the i3 config file. It shows syntax error just because a line is broken into multiple lines, with newline's being escaped. I have noticed that syntax highlighting ...
user avatar
  • 101
2 votes
2 answers
33 views

minlines in gvimrc

I notice when I work with larger Mardown files, the syntax highlighting is broken if I skip around the page. This seems to fix the issue: syntax sync minlines=999 but if I put it into my _gvimrc, it ...
user avatar
  • 746
1 vote
1 answer
34 views

How to select a regexp group in vim?

I want to select/visualize a regexp GROUP in a vim regexp expression in vim. By example I would like to highlight (search) a span of characters inside square brackets, having this line: bla bla bla [...
user avatar
0 votes
1 answer
45 views

How to enable a json filetype plugin in Vim

I am opening a JSON file with comments like this in vim: { "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ /* Projects */ etc. It ...
user avatar
  • 1
1 vote
0 answers
41 views

Why doesn't the syntax foldmethod not work even though syntax highlighting works?

Started editing a JavaScript file, did :set filetype=javascript (correct syntax highlighting kicked in), then set foldmethod=syntax, and naively expected that folding should automatically work, but ...
user avatar
  • 308
0 votes
1 answer
34 views

How do I correct undesirable syntax highlighting?

My current Vim installation on Windows appears to have default syntax highlighting for Markdown, which is nice. However, there is one particular highlight which I don't really like, and that is the ...
user avatar
  • 111
0 votes
0 answers
13 views

.dist trick does not work for .neon files

One year has passed since How to get syntactic coloration for dist files, and recently, I have decided to installed the archived/abandoned https://github.com/fpob/nette.vim to get some syntactic ...
user avatar
  • 143
2 votes
2 answers
169 views

Highlight Markdown indented code

When writing Markdown, fenced code written between triple backticks is highlighted, but not code in indented blocks (I don't care about language specific highlighting). How can I get vim to recognize ...
user avatar
  • 151
2 votes
1 answer
54 views

Create highlight group that modifies an existing one

I would like to create a new highlighting group that is exactly like an existing one except for one (or more) properties. For example, the new group could be an underlined version of the existing one. ...
user avatar
  • 121
0 votes
0 answers
23 views

Is there a way to tell vim (maybe with plugin?) to treat a set of lines as a specific filetype?

This would be great to have support for any language, but the thing I want now is just bash. I have a shell script which has all of its code inside a multiline heredoc string which is sent to gnome-...
user avatar
  • 2,081
0 votes
0 answers
48 views

Easiest way to highlight/underline specific words (by location) in a file based on the output of an external program?

I have a program that I run on a file and the output of the program is a line number. If I save this line number in a temporary file, can I get vim to automatically highlight or underline this word/...
user avatar
  • 101
1 vote
1 answer
20 views

highlighting: match dot in group

I have several syntax match patterns, that logically belong together. Currently I match them like this: syntax match FOO /\v<(foo1|foo2|foo3)>/ What I actually want to match is .foo1, .foo2 and ....
user avatar
  • 133
2 votes
1 answer
30 views

Manage syntax groups in Vim Latex (how to create new ones, or add to existing ones)?

I'm trying to optimize for my needs the syntax highlighting offered automatically by Vim for Latex. For example by changing colors to my liking or link colors to new commands/environemnts. After a ...
user avatar
  • 143
1 vote
1 answer
77 views

How do I get vim to read syntax files from `/usr/share/vim/addons/syntax`?

According to the Debian documentation about vim, a Debian package (Ubuntu, really, in my case) is expected to place <name>.vim files under: /usr/share/vim/addons/... Syntax files go under a sub-...
user avatar
0 votes
0 answers
34 views

Remove highlighting of a csv file in nvim 0.4.4

I have nvim 0.4.4. I tried to install a csv plugin from there, but now, when I open a csv file there is some (unwanted) highlighting as follows: I can I remove the highlighting? Here is my vimrc file:...
user avatar
  • 139
0 votes
1 answer
52 views

How do I highlight #-comments in UPF files?

I have a file with the extension *.upf in which the # is not highlighted. I use # for comments. :syntax on also doesn't seem to work. The issue here is I have a file (*.upf) which is generated by ...
user avatar
1 vote
1 answer
483 views

JSX highlighting with Neovim and nvim-treesitter

I'm using Neovim 0.6.0 with nvim-treesitter installed and I mostly work with JavaScript, Flow, TypeScript based React projects. This means, I also need syntax highlighting for JSX and TSX. Syntax ...
user avatar
2 votes
0 answers
29 views

Color filenames according to $LS_COLORS in vim

I'm writing a simple vim syntax file for random note takings for work. I would like to color filenames according to $LS_COLORS. I can prefix a filename in the notes file with something random, like '·'...
user avatar
  • 21
1 vote
1 answer
28 views

How can I change the way filetype is set from the "#lang" directive in Racket

I have some Racket programms that begin with the specification of a dialect #lang plai-typed #| racket code goes here ... |# When I open these files with Vim, filetype is set to plai-typed. That is ...
user avatar
0 votes
1 answer
23 views

Unable to conceal text in a region

I have this: syntax match Text /Completed/ conceal It conceals any text matching Completed. However, if Completed is in a region, I am unable to conceal the match. For example, if I place a # sign in ...
user avatar
  • 1,237
0 votes
1 answer
19 views

Syntax regions ignoring "contains" requirement

I've got this in my vim buffer: * [ ] set up adding asterisk or changing color automatically when a task is annotated ==ANN== #9f359cd0 * [ ] write documentation in ## Notes section #7226ec9c I ...
user avatar
  • 1,237
0 votes
0 answers
64 views

Spell check highlighting in gruvbox disappears on scroll

When I open vim initially misspelled words are highlighted but as soon as I scroll they become unhighlighted. I have gruvbox color scheme. My vimrc looks like this """"""...
user avatar
0 votes
0 answers
53 views

How do I modify a region's color in a fold?

I'm using the vimwiki plugin. I can successfully change the header colors with something like this: hi VimwikiHeader1 ctermfg=black hi VimwikiHeader2 ctermfg=darkblue hi VimwikiHeader3 ctermfg=cyan hi ...
user avatar
  • 1,237
1 vote
1 answer
24 views

Adjust syntax highlighting of git/mercurial patch within a popup

I have added the following line to my vimrc which allows me to press <leader>p to show the mercurial log with patch for the current line in a popup window. nmap <silent><Leader>p :...
user avatar
1 vote
0 answers
21 views

Indicate break in code highlighting

I am creating a markdown file. My particular markdown compiler has a MathJax plugin, so I can $$ at will in my .md file. However, LaTeX syntax is decidedly un-markdown-y, and this practice wreaks ...
user avatar
  • 123
2 votes
1 answer
87 views

Stop vim from highlighting "note" in yellow inside SQL comments

I am using vim under Ubuntu under the windows WLS. When I edit SQL files, only inside comments - the word "note" is always highlighted with a background yellow color. This includes, for ...
user avatar
  • 123
0 votes
1 answer
163 views

Vim editor entities tagging/annotation tool

I'm looking for a word/sentence annotation tool/plugin to be used INSIDE vim editor. Specifically I'm looking for a cli tool NER (named entity) tagging. Any idea/suggestion/tip? By example, I would ...
user avatar
1 vote
0 answers
85 views

vim doesnt recognize html in string in filetype php. same thing with php code in filetype html

Ive had no luck solving these issues for quite a while now. Problem1 When writing HTML inside a string in a file with filetype=php, the HTML is not recognized (i.e., it has no highlighting or indent). ...
user avatar
0 votes
0 answers
36 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:...
user avatar
  • 113
4 votes
1 answer
994 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 / ...
user avatar
0 votes
3 answers
50 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 ...
user avatar
2 votes
1 answer
100 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"
user avatar
0 votes
1 answer
44 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 ...
user avatar
  • 1
1 vote
1 answer
773 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 ...
user avatar
  • 283
2 votes
1 answer
53 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 ...
user avatar
1 vote
1 answer
45 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 ...
user avatar
  • 137
2 votes
2 answers
80 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 ...
user avatar
0 votes
2 answers
112 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 ...
user avatar
2 votes
1 answer
64 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 ...
user avatar
0 votes
2 answers
46 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 ...
user avatar
0 votes
2 answers
70 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 ...
user avatar
  • 20.6k
0 votes
1 answer
90 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: ...
user avatar
0 votes
0 answers
39 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 ...
user avatar
1 vote
1 answer
95 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 ...
user avatar
  • 371
1 vote
2 answers
138 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 ...
user avatar
1 vote
0 answers
80 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 ...
user avatar
  • 111

1
2 3 4 5
13