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
1answer
78 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
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
0answers
16 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
25 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
31 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
65 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
252 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
18 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
58 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
55 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
51 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 ...
4
votes
2answers
161 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
135 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
28 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
51 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
27 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
49 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
156 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
35 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
67 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
66 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
votes
2answers
121 views

annoying red blocks in neovim

im using Neovim from my WSL terminal. I've been exploring the multiple plugins of this amazing open source project and this made me change my init.vim, a lot. Now i've messed it up and i don know how ...
0
votes
1answer
47 views

filetype plugin indent on is blowing up my vim

I have the following vimrc. I noticed that there is a single line that's blowing up my usage of the FZF :BTags command: filetype plugin indent on Ie when I run the command :BTags I get this error ...
2
votes
1answer
80 views

Yank the characters that replace concealed strings?

For example, in .tex files, the expression $\sum$ is replaced with ∑. I would like to yank ∑, but when I try I get one of the characters that compose $\sum$, even when I set concealcursor. What is the ...
1
vote
0answers
71 views

How to fix/customise coloring for the autocompletion popup menu?

I'm not really happy with the syntax coloring of the auto-completion menu. Probably the pink-ish background color is the least unpleasant thing, but the grey foreground text is really not as readable ...
0
votes
2answers
35 views

Change syntax of texStatement cause big change of stack of syntax items

I'm trying to add some syntax support for LaTeX3. There are huge commands containing _, so I change the match pattern of texStatement in ~/.vim/syntax/tex.vim syn match texStatement /\\[a-zA-Z@_:]\+/ ...
1
vote
1answer
39 views

Enhance Latex Syntax without Rewriting everything

I want to extend the latex syntax for the given file: \documentclass[a4paper,11pt]{book} \begin{document} \begin{figure}[t] \begin{tikzpicture} \node[alter] at (0,0) (v1) {typ0}; ...
1
vote
1answer
32 views

Syntax Highlight Problem for Latex/Tikz

I have a tikzpicture inside a latex file. My problem is that when I open the file and jump with GG to the end of the file, the math environment inside the tikz-nodes is not highlighted (e.g. $v_0^1$)....
0
votes
1answer
29 views

Display the same color for all characters in a math section

In a tex file, almost all the characters inside delimiters like $...$ or \[...\] have the same color, but there are some characters, like = (and possibly others) which have a different color. I would ...
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 ...
1
vote
0answers
61 views

How do you highlight text surrounded by double equals

I'm using vimwiki plugin with markdown. I'd like to highlight text using double equals, which isn't standard, but is quite useful. Ideally, this should replace background (for instance, yellow) and ...
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: ... ... ...
1
vote
0answers
313 views

Vimwiki/Markdown blockquote syntax highlight

AFAIK vimwiki's markdown syntax doesn't emphasize in any way blockquotes. I mean: > This is a quote is presented instead as simple text. For reading notes it can be confusing. So, how do you ...
1
vote
0answers
76 views

Vim ignores color 255, as if it doesn't support the 256 ones

Update: it works, if I set the main bg color (white) as ctermbg=231 (it was 015). So it seems that color values in Vim syntax highlight settings shouldn't be mixed: if one uses color codes from the 16 ...
1
vote
1answer
56 views

How to highlight text between two delimiters / tags?

How do I highlight the block of text between two delimiters / tags / "surroundings"? (e.g., between matching parentheses ()s, quotes "", html tags (div../div), etc.) (Or maybe how ...
1
vote
1answer
51 views

unexpected highlight of “man” pattern [duplicate]

I am wondering why vim highlights "man" pattern. When I do a word search with /, it disapears. Here is my vimrc file: " Disable default bottomline set noruler set noshowcmd set ...
1
vote
0answers
35 views

When re-sourcing vimrc, the highlight commands following the colorscheme choice are lost [duplicate]

Given this ~/.vimrc syntax on colo pablo set cul hi CursorLine cterm=bold ctermbg=NONE ctermfg=NONE gui=bold guibg=NONE guifg=NONE hi String ctermfg=red Do the following: open a file, possibly ...
0
votes
0answers
26 views

Using multiple syntax groups for the vim conceal functionallity [duplicate]

I’ve recently tried using vim conceal to "symbolify" my code. Although it looks very nice there is a heavy drawback: all the concealed syntax that is turned into pretty unicode is always ...
2
votes
2answers
262 views

Vim syntax partial match

I'm trying to match a new line character on a Vim syntax file, I can make it work when I use the patern within Vim but when I put it in my syntax file it doesn't highlight when I have a new line and ...

1
2
3 4 5
12