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
0answers
13 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
1answer
42 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
24 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
55 views

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

(Edited to explain the workflow, according to Christian Brabandt's first comment, and to focus on the Vim syntax core question in the first part as D. Ben Knoble asked) I am trying to do something ...
0
votes
0answers
33 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 ...
-1
votes
0answers
36 views

How to get a better syntax highlighting on vim? [closed]

Hello Vimmers! I'm new to Vim. How do I get bat's syntax highlighting (or anything similar) on Vim?
0
votes
0answers
38 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 ...
0
votes
1answer
169 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 ...
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 ...
1
vote
1answer
50 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
votes
0answers
24 views

Please help debug syntax

I want to add syntax and highlighting to markdown filetypes. I have plugin 'vim-markdown-master'. I read that if I want to add syntax and highlighting to syntax files I need to put it in after/syntax/...
1
vote
1answer
174 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
0answers
20 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
32 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
26 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
28 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
50 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 ...
3
votes
1answer
217 views

How can I change Javascript syntax to higlight objects?

I am trying to emulate the Atom JavaScript syntax highlighting in vim, but there are a few things missing. Namely, I'd like to highlight objects and their chains in red. It'd be dandy if I could ...
19
votes
3answers
12k views

No syntax highlighting in tmux

I installed tmux in iTerm 2.(Build 3.0.13) When I execute vim in tmux, syntax highlighting looks like this. But outside tmux, syntax highlighting looks fine. My $TERM inside and outside tmux is ...
2
votes
1answer
144 views

Concealing the code for `braket` package for LaTeX with vimtex + `tex-conceal`

I am using vimtex with latexmk and using conceal setting provided by vim and extending it with an additional plug-in : KeitaNakamura/tex-conceal.vim. Additionally, I use a package braket to encode \...
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
76 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}} %...
42
votes
5answers
15k 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 ...
10
votes
3answers
621 views

How to output highlighted source code into a file to use outside vim

At my workplace, I want to do a presentation of a custom language I've developed for solving some problems we had. For easier development, I created my own vim syntax file for this particular language....
0
votes
0answers
20 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
21 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 "...
2
votes
2answers
59 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
44 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:...
27
votes
7answers
12k 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
174 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
59 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
156 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
301 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
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 ...
5
votes
1answer
79 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
26 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
38 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
104 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
368 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
52 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
45 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
120 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
778 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
518 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
118 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
85 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
2 3 4 5
12