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
16 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
22 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
24 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
37 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
60 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> <!-------------------------------...
0
votes
0answers
22 views

Markdown syntax color theme

I am giving advice to different research groups at our university. Open Research is promoted highly and many groups use R for statistical analysis. Many are also interested in using Markdown, Pandoc ...
0
votes
1answer
12 views

How do I view a regex and containedin of a group?

I'm wanting to see how groups were created and what they are contained in. What I'm doing now is this and then I search for the group. :Verbose syntax What I would like to do is this. :verbose syntax ...
0
votes
0answers
33 views

How to highlight if defined with #define in Vim?

I want to highlight if defined with #define in Vim. For example, if I type #define ZERO 0, highlight ZERO with a different color.
0
votes
0answers
26 views

syntax highlight regex not matching

I am writing a plugin where a certain filetype must possess their own syntax highlight. Therefore I have created . ├── ... ├── plugin └── syntax and syntax/newfiletype.vim containing syntax clear ...
1
vote
0answers
18 views

Syntax highlighting for vimscript in fenced code in StackExchange [migrated]

(Apologies if this question is duplicated. I searched for similar questions but all results that came up were about syntax highlighting within Vim, which is unrelated to my question.) Is there a way ...
1
vote
0answers
46 views

How to make VIM json syntax highlight more readable

Using VIM 8.1 in Ubuntu 20.04.02. ~/.vimrc has syntax on. The file /usr/share/vim/vim81/syntax/json.vim exists. While the syntax highlight for YAML file is comparable between VIM and Visual Studio ...
1
vote
1answer
22 views

Can you call highlight more than once? Need different colors for different matches

I am working with text files and Goyo. I'd like to highlight two different kinds of notes delimited by brackets (one called "NOTE:" and the other "TODO:") in different colors. I ...
1
vote
0answers
18 views

Fixing syntax highlighting in Latex documents using cleveref

I use Vim and Latex together. I have recently been fiddling with the cleveref package and it kind of messed up syntax highlighting. For example, before using this package, when I wanted to ...
0
votes
1answer
24 views

Conceal subscripts in Coq syntax

Some context and setup I've been using Coq lately and the excellent coqtail plugin for syntax and proof development. I've seen some folks using Proof General in Emacs for a similar environment, and it ...
-1
votes
1answer
28 views

What's the name of the highlight group for the number column?

The one with the numbers that looks grey ? I already got the fold with this. hi FoldColumn guibg=#000000 guifg=#ffffff I just don't know what the name if that numbers column is.
0
votes
1answer
50 views

Non-regex complex color; is that possible in vim?

Is it possible to do more complex coloring than using regexes in Vim? I'm interested in implementing a feature in vim-flog where a commit and all its ancestors would be colored. That means the exact ...
0
votes
1answer
25 views

Matlab syntax highlight: Avoid “reverse video” for “%%” at start of line

I am using gVim 8.2 from Cygwin. The synax highlighting recognizes code lines starting with "%%" at columns 1 and 2 show the text black characters on orange background. It is not ...
2
votes
2answers
35 views

How to re-indent nginx configuration based only on `{` and `}`?

I want to reindent an nginx configuration file with the following simple rudimentary rules: a { increases indentation a } decreases indentation The idea is cindent is just enough to do it. I have ...
1
vote
1answer
41 views

Vim to highlight functions and user-defined types

I have two scenarios where I want vim to highlight those items. Currently my fix for these are to add the return types directly into the after/syntax/c.vim file, but this gets incredibly tedious. Here ...
1
vote
1answer
35 views

How to use different rules for highlighting trailing whitespace inside a gitcommit diff

In my ~/.vimrc, I have: highlight TrailingWhitespace ctermbg=blue autocmd BufReadPost * syn match TrailingWhitespace /\s\+\%#\@<!$/ This highlights trailing spaces, except when I am still typing ...
1
vote
0answers
18 views

vim fo=aq and crontab footgun: Why are my crontab commands treated as comments?

After a large amount of trial-and-error narrowing, the problem is a conflict between the default crontab syntax file and formatoptions flags containing anything that includes aq, i.e. both a (...
1
vote
1answer
35 views

How does vim “syntax cluster” highlighting work (or why does this “syntax cluster” not work)?

This is a repost from stackoverflow at the suggestion of a user to this vim-specific forum. I am trying to use a vim syntax file for highlighting a PyMOL script file and got into trouble with the &...
2
votes
0answers
19 views

Syntax region doesn't stop at the correct end marker

I'm trying to set up folding for #pragma region in C/C++, and it kinda works, but I need to edit out #pragma from the cPreProc syntax region, which is definitely not ideal. If I don't edit it out, the ...
0
votes
0answers
15 views

How to figure out what highlighting rule is targeting a word?

I have the following potential "c boolean" values that I want to consistently highlight: https://gyazo.com/e03e05a401e72f456ec2b8171dde5a63 (note it seems the StackOverflow image-attachment ...
0
votes
0answers
22 views

Syntax highlighting for two components of C syntax

What are the following two components that I need to target with syntax highlighting/rules? The first one is the int (or more generall, any storage class) that I want to colorize. If currently have ...
0
votes
0answers
27 views

Setting up C code highlighting

I've used vim for mostly python or web-related projects. Now I'm trying to see if I can use it to write some C code. The first thing that I've noticed is whatever setup I have, doesn't have any C code ...
2
votes
1answer
59 views

Is it possible to detect a highlighted search match with synIDattr() or similar?

When I have hlsearch on and my cursor is somewhere in a highlighted search match, is it possible to detect the search highlight hl-Search with synIDattr() or a similar function? As far as I can tell ...
1
vote
1answer
25 views

How to ensure nvim uses my custom syntax files rather than the ones bundled with it?

I've been editing my syntax files, placing my versions in ~/.vim/syntax/. For ~/.vim/syntax/php.vim that's worked, but for ~/.vim/syntax/html.vim for some reason it's being overridden by /usr/share/...
-1
votes
1answer
43 views

Adding Additional Syntax Highlight to nvim; cannot get .config/nvim/after/syntax to load .vim file

I'm trying to add additional syntax highlighting to a plugin I'm using for syntax highlighting. I've tried adding the additional syntax file fstrings.vim to the ~/.config/nvim/after/syntax folder but ...
0
votes
1answer
17 views

Wrong syntax coloring for multiline comment in Haskell file

As shown in the following screencast, when I open this Haskell file (extension hs), a long multi-line comment is not recognized appropriately. Based a previous question of mine I've verified that :...
0
votes
1answer
57 views

highlighting is for no obvious reason

I have a large script and I have extracted a few lines into two files, why1.ksh and why2.ksh, to show highlighting issue I am seeing that I can't explain. Here are the two lines of why1.ksh: ...
0
votes
0answers
24 views

How to configure SpaceVim to highlight .jenkinsfile

For vanilla this will work, however, SpaceVim seems is harder for me to configure and tweak. Can .vimrc and ~/.SpaceVim.d/init.toml live in harmony?
0
votes
1answer
44 views

Shell syntax, how to patch bad highlight groups

The neovim syntax for shell scripts doesn't check if keywords like echo, done, exit etc.. are surrounded by blank spaces or if they're part of a bigger Word. This results in the following bad ...
3
votes
2answers
71 views

Is it possible to override the filetype of a text file based on the first line?

I have some specifically formatted text files that I'd like to detect when I start vim. When I load these files now, the filetype is automatically set to text. I only want to override that if the ...
1
vote
1answer
30 views

Help writing simple syntax file for line specific matches

I would appreciate some help writing a simple syntax file. I have files with the following header: Job Number: 20030003 Date: October 28, 2020 Time: 01:36:00 Vessel: Enterprise Client: Shell ...
3
votes
2answers
126 views

What exactly do patch 8.2.1693 and patch 8.2.1703 do to syntax highlighting?

It is fairly well known that syntax highlighting in vim breaks when one changes colorschemes frequently. This is due to peculiarities of hi def/hi clear. Recently, the following changes were made: ...
1
vote
1answer
22 views

sass folding syntax

i have foldmethod=indent on a .sass file. it auto-folds most blocks fine, except for #id selectors, which it folds into the block above it. for example: :root // folds 3 lines below --base-bg: #...
2
votes
1answer
45 views

Syntax highlighting rule doesn't work when a another highlight (# comment) exists

I'm trying to create a highlight that changes the text color of a strikethrough syntax, like ~~hello~~ should turn the whole thing gray. Here's what I've put in my vimrc: au BufRead,BufNewFile *.n ...
0
votes
0answers
24 views

autocompletion - set iskeyword disabling highlights

I have set up some syntax highlights for some patterns, for example: sc.nextInt() nextInt will be highlighted as a Function... Then I have included :set iskeyword+=(,.,) in order for autocompletion ...
2
votes
1answer
25 views

Is there a filetype in Vim when opening the a file containing output/errors from g++ so that I can see those files with the original coloring?

Sometimes, when faulty outputs from compilations of C++ files/projects are to long, I like to redirect that output to a file, so that I can inspect it side-by-side with each of the offending files in ...
1
vote
1answer
84 views

Turn syntax off only for current buffer/window?

Is there a way to turn off syntax for only the current buffer/split windows? like for example, you can set map <buffer> or setlocal. Is there something similar for the syntax option ? I use the :...
0
votes
1answer
29 views

How to make a filetype behave exactly like C++?

I want the filetype .my_cpp and .my_cc to behave exactly like C++ files in Vim. I have the following set: autocmd BufNewFile,BufRead *.my_cc set syntax=cpp autocmd BufNewFile,BufRead *.my_cpp set ...
1
vote
0answers
51 views

Turn syntax highlighting off in diff mode when started within vim?

I would like syntax to be turned off when I am in diff mode to focus only on the differences. I have the following code in my vimrc which works only when I start vim in diff mode from the command line ...
1
vote
0answers
31 views

Adding a syntax group to support fold markers with foldmethod=syntax

With foldmethod=syntax, is it possible to create a syntax group that matches my fold markers, so that i can use both language-specific syntax folding and whatever markers might already be in my code? ...
0
votes
1answer
31 views

java-syntax only runs on first Java buffer

I'm using neovim v0.4.4, vim-plug, and uiiaoo/java-syntax.vim. For some unknown reason(s), syntax highlighting from java-syntax only works on the 1st java buffer. For example: $ nvim file1.java :e ...
2
votes
1answer
32 views

Position Dependent Custom Syntax Error Checking

I am trying to design a custom syntax file that performs some basic error checking for an ascii input file. The input is broken up into sections, and there are input cards specific to each section. ...

1
2 3 4 5
11