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
2
votes
2answers
44 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
1answer
26 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:...
25
votes
7answers
11k views

How do I prevent vim from hiding symbols in markdown and json?

This drives me crazy, I do :set ft=text To see something, otherwise all the links disappear in markdown and quotes in JSON. How do disable this once and for all?
0
votes
1answer
160 views

folding in matlab

I'm using vim for my matlab editor. And It works nicely, except I cannot get folding to work. I found my syntax file on github: matlab.vim And I wanted to add folding. I changed the line syn ...
0
votes
0answers
37 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
1answer
151 views

Fold: Different highlight style for fold of each filetype

Extend of this question of fold: Fold: foldtext() for each filetype We have fold for each filetype now but each fold need different highlight style of color, because highlight is global I tried to ...
5
votes
1answer
300 views

Interactive syntax-highligting: highlight the current region only

Often enough a text file is structured as a collection of blocks or cells of some kind. E.g., slides in a Tex Beamer presentation, bibtex items, function definitions, etc. I wonder if vim can ...
0
votes
2answers
31 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 ...
3
votes
1answer
70 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
1answer
22 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 ...
0
votes
0answers
34 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 ...
3
votes
1answer
93 views

Vim thinks Python @ operator is decorator

Python3 has the matrix multiplication operator (@) which is used to multiply numpy matrices. But when we write something like A = B @ C in vim, the @ C portion gets highlighted. Apparently Python has ...
0
votes
1answer
28 views

Highlighting item in fold for custom markup language

I am trying to write custom syntax highlighting for a domain specific markup language for a simulator I am working on. I can get everything but one part working. A simple example would look something ...
2
votes
1answer
365 views

ruby syntax highlighting lost on long files

With a "long" ruby file (896 lines in my case) the ruby syntax highlighting is lost when I G to the bottom of the file. Once that happens and I go back to the top with gg, the syntax highlighting ...
1
vote
1answer
30 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
28 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 ...
4
votes
2answers
117 views

Syntax highlighting for StackExchange markdown

I often "pre-compose" and save my longer questions for StackExchange usign Vim / GVim. Does a syntax highlighting file for the StackExchange markdown already exist? If yes, where can I obtain it? ...
25
votes
0answers
738 views

How does `\zs` interact with syntax matches?

Consider the text: foobarbaz First we highlight the regular expression /foobar/: :syntax match Special /foobar/ Next we highlight the regular expression /foobarbaz/: :syntax match Error /foobarbaz/ ...
2
votes
0answers
442 views

How to fix this `Omni completion (^O^N^P) Pattern not found` error?

I am trying to set up syntax keyword based omnicompletion in vim. I have defined a few syntax keyword Constants in ~/.config/nvim/syntax/spl.vim They are correctly detected and highlighted. They are ...
-1
votes
1answer
50 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 ...
1
vote
1answer
37 views

in-place replacement of code in HTML documents with TOhtml?

I'm working on some old HTML documentation, where are multiple code snippets (several lines long). I need to replace this old HTML-ized code with new one using modern styling. What I have now: ... ... ...
0
votes
1answer
19 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
47 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
34 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?
42
votes
4answers
14k views

Can Vim interpret terminal color escape codes?

Many CLI programs output nicely-highlighted text. While most of them check if the output is going to a file, some include the terminal escape codes. I like the output with the escape codes, but ...
3
votes
1answer
77 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
35 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
1answer
157 views

Vim syntax line matching mechanism

Can someone explain or link to valid explanation information on the syntax highlighting mechanism. In particular I am having having a hard time understanding how rules are applied. Imagine the ...
0
votes
0answers
26 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
26 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
25 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 ...
4
votes
1answer
838 views

Turn off markdown highlighting for underscores in inline code?

Markdown highlighting is great (when it works), but I've seen a problem on two different boxes with underscores in inline code and I'm wondering if there's an easy solution. When I put, for instance, ...
1
vote
1answer
39 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 ...
0
votes
1answer
65 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
27 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
1answer
87 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
2answers
63 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
vote
0answers
40 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 ...
0
votes
0answers
46 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
0answers
35 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
29 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 ...
0
votes
2answers
776 views

neovim syntax highlight with large files issue

I use neovim 0.4.3. When I open a large xml file (about 130-140k lines) syntax highlighting switches off with a message: 'redrawtime' exceeded, syntax highlighting disabled If add this line to my ...
2
votes
0answers
70 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
26 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
19 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
27 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 ...
4
votes
1answer
55 views

How to get syntactic coloration for dist files

There is a standard for providing files that may have an unversioned counterpart. That standard consists in suffixing the filename with .dist, so for example phpunit.xml becomes phpunit.xml.dist. How ...

1
2 3 4 5
12