Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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

Ignore acronyms as spelling errors in TeX files

My LaTeX files contain lots of acronyms and they are often highlighted as spelling errors. I tried to ignore acronyms by adding syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@...
0
votes
1answer
84 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
2answers
243 views

Syntax Highlighting a region inside the start match of another region

I have two syntax region defined as follows: syntax region xBCD start="b" end="d" hi def link xBCD Todo syntax region xBlock start="\z(abcde\)\zs::" end=";" hi def link xBlock Comment and a text ...
1
vote
0answers
31 views

custom syntax hilighting lost on single LaTeX file

I use vimtex plugin for writing tex documents in vim8. I added custom hilight for sections in my .vimrc like so: autocmd FileType tex :syntax match texSectioning "\\section.*" The texSectioning is ...
0
votes
1answer
252 views

Enable syntax highlighting in vim using colorschemes?

In my installation of vim 8.1 (compiled from source) syntax highlighting is not working. The runtime path ($VIMRUNTIME) is set to /XYZ/VIM8/installnew/share/vim/vim81 which contains (autoload, ...
3
votes
0answers
71 views

gVim - Use different fonts using :highlight

I want to set gVim font size for Comment highlight group. When I set it, it does not do anything (the font is still the same but color changes). My .gvimrc: se guifont=Fira\ Mono\ Regular\ 10 hi ...
2
votes
1answer
29 views

Pattern to match the label of a JavaScript object field when the colon is not followed by another colon or an equal sign

I wrote a syntax highlighting .vim file. One of the expressions is used to color the label in a JavaScript object declaration: name: 'value' ^^^^ I want to see the name in a different color. My ...
1
vote
0answers
20 views

My C like Comments include markdown, can I have vim highlight those in my JavaScript (Node.js) code? [duplicate]

I write a lot of C/C++ and get highlighting for my Doxygen docs in my comments. It's not perfect, but it sure helps avoiding many very simple mistakes on the spot. To handle that, I simply have the ...
0
votes
1answer
30 views

Is it possible to make a specific section have a different syntax? [duplicate]

I am working with markdown and writing snippets like: ```c int main() { return 0; } ``` It is highlighted as a code in vim. However would it possible for the c ...
0
votes
0answers
15 views

Why does second const VARNAME not have syntax highlighting?

I copied and pasted a .php file and edited it. It went from: <?php class Foo { const RESET = 'reset'; to <?php class Foo { const RESET = 'reset'; const ...
1
vote
1answer
371 views

Make Vim stop highlighting certain underscores in my Markdown as errors

I'm using Kramdown-flavored Markdown in several of my Jekyll websites. Vim highlights all the underscores in those documents as errors, coloring them (in my color scheme) with bright red backgrounds. ...
2
votes
1answer
81 views

How to know which highlighting group is used for the background of a word?

Vim highlights the background of certain words (e.g. when doing spellchecking) in a way that I would like to change (because the background and the word itself are almost of the same color, which ...
2
votes
1answer
58 views

Analog of mmm mode

Is there an analog of mmm mode for vim? This would allow me to have syntax highlighting of several modes in the same file.
1
vote
1answer
50 views

How do I make ftdetect rule recognize syntax statement at the end of a file?

I'm using a syntax highlight plugin for Nginx files. Its ftdetect looks like this: au BufRead,BufNewFile *.nginx set ft=nginx au BufRead,BufNewFile nginx*.conf set ft=nginx au BufRead,BufNewFile *...
0
votes
1answer
67 views

Vim: Is it possible to modify syntax rule of the Folded group?

Thank Vim's folding, I can hide irrelevant parts of code/document and work on a small spot of the file. More and more I organize the folded first lines as an outline of the whole file, in each level. ...
0
votes
1answer
316 views

Why doesn't undercurl use underline in my terminal?

:help undercurl states: "undercurl" is a curly underline. When "undercurl" is not possible then "underline" is used. In general "undercurl" and "strikethrough" is only available in the GUI. But if ...
2
votes
2answers
493 views

How to set a colorscheme that still shows spelling errors?

How to set a colorscheme that still shows spelling errors? I am looking for two combined effects that I can acquire separately but not yet together. Set Colorscheme alone: OK. If I want highlights ...
2
votes
1answer
81 views

How to change one syntax behaviour in vim

The shebang line has an annoying background color, how to change it to have the same color of comments. This is a Haskell file.
0
votes
1answer
98 views

Syntax highlighting (contains, contained) of only the first match

I think it is possible but can not figure how one can highlight only the first match of contained syntax? syn clear syntax cluster TitleParts contains=TitleNum,TitleType,TitleRest syntax match ...
0
votes
1answer
75 views

Installing a Vim package. syntax highlighting does not turn on

I want to use the nuweb.vim extension for syntax highlighting nuweb files. Long story short, nuweb files are basically a super-set of latex files. There is added syntax and markers to embed code-...
1
vote
2answers
67 views

Multiline regular expression excluding characters

I am designing a syntax rule (for R code) that highlights if I do not start a function with a curly all by itself. For example, A <- function(x, y){ would be match but I do ...
1
vote
1answer
178 views

Why do windows not have syntax after split?

I am trying to create my own C++ environment inside of VIM. So far, this is my setup when I run $ vim ~/shape.cpp: for example: As you can see, only NERDTree has full syntax highlighting (which isn'...
0
votes
1answer
257 views

Fixing pug syntax highlighting

Update I've managed to get the top part of the file fixed with syn region pugJavascriptLine start=/^\s*-/ end=/$/ contains=@htmlJavascript from this programmer: https://github.com/digitaltoad/vim-pug/...
3
votes
1answer
114 views

define two syntax regions with same pattern

I try to extend the cmake syntax highlighting by our in-house cmake functions. For this I drafted a file to be saved in ~/.vim/after/syntax/cmake.vim, such that one extends the default cmake syntax ...
0
votes
1answer
73 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 ...
3
votes
1answer
197 views

Syntax highlighting of key = value pairs

I "inherited" a custom syntax script and I want to update it since it's a little out of date. The text file for which the syntax highlighting is written contains several blocks like this: {Group1 ...
1
vote
1answer
121 views

Visual Select highlighting not working anymore

The issue My custom highlighting styles for Visual mode selection of text is not as it was. It use to be yellow background with black text. Now it is just underlined. Environment vim 8.0 term, not ...
0
votes
1answer
49 views

Disable highlighting for tex files with texvim

I want to use vimtex and enable highlighting for all filetypes, except tex files. For tex files I explicitly want to disable highlighting. How could I do that? Important: The solution should allow ...
1
vote
1answer
386 views

Does `hi link XXX Normal` provide any benefits?

Does hi link XXX Normal provide any benefits? For example the syntax file included by default syntax/vim.vim includes the line: hi def link vimUserFunc Normal This often conflicts with CursorLine ...
1
vote
2answers
499 views

Syntax highlight works for gvim but not for terminal vim

I am new to vim and I want to code in vim. I have installed the necessary plugins for syntax highlighting JSX in TypeScript and everything works fine for GUI version of Vim but not for terminal-based ...
0
votes
2answers
247 views

Priority highlighting

In my code, something like #include <whatever> is highlighted: #include (which belongs to the group 'cInclude') in pink; and <whatever> (belonging to the group 'cIncluded') in red. (Edit:...
1
vote
2answers
205 views

How can I turn off syntax highlighting for one specific element?

I'm editing pandoc markdown text with inline math. Since that uses underscores, vim will helpfully highlight everything after the first underscore, but there will be no matching one. How can I turn ...
1
vote
0answers
37 views

Syntax highlighting in consecutive single-line comments

I'd like to have rich syntax highlighting (using, say, markdown syntax) inside (single-line) comments (as is done in Rust). For now, I'm using the following code, which is not satisfactory. syn ...
2
votes
1answer
121 views

Re-sync _folds_ from start

Vim has a handy feature in :syntax sync fromstart which allows me to fix syntax highlighting when it gets confused during an extended editing session. I map it to <leader>ss (reSync from Start) ...
1
vote
2answers
80 views

Installed and set colorscheme but method puts and print not working on ruby

Yesterday, I Installed vim and some colorscheme like gruvbox, monokai, molokai. I set it in ~/.vimrc and turned on the syntax highlight, everything work well on HTML but in ruby files (.rb) it still ...
0
votes
1answer
128 views

Syntax folder under plugin/foo/syntax/foo.vim not automatically applied when filetype change?

I have a plugin under nvim/plugin/foo, but the syntax file nvim/plugin/foo/syntax/foo.vim is not automatically applied when the filetype change, but if I put it under nvim/syntax/foo.vim it works I'...
3
votes
1answer
145 views

How to conceal Markdown syntax per-word, rather than per-paragraph?

I want to use Vim to write markdown in a sort-of-WYSIWYG manner (for use with an audience). For example, typing **Bold** should display Bold in bold font, with the asterisks automatically hidden as ...
0
votes
1answer
54 views

How to apply a custom highlight file?

I'm playing with Vim highlight, so I made the following (syntax.vim): hi Comment ctermfg=DarkGray hi LineNR ctermfg=DarkGray hi CursorLineNR ctermfg=Red hi String ctermfg=Gray hi PreProc ctermfg=...
1
vote
1answer
419 views

How to change Operator highlight color in Vim?

I just switched to iTerm2 on macOS and found some of its options go to Vim as well. That's the case for fonts, I was able to select a Vim font that I like from iTerm options. It seems iTerm color ...
2
votes
1answer
98 views

Avoid highlighting defined by 'matchadd' in comments

I want the piece of text std::string to be highlighted in vim according to the style defined in 'Type'. I can do that with :call matchadd('Type','std::string') It works. However, std::string is also ...
1
vote
1answer
163 views

vim word boundaries in syntax files

I have a syntax file with the following definitions: syn keyword pythonBuiltinFunc __import__ abs all any \ bin bool bytearray ...
1
vote
1answer
140 views

How to get 50 char long warning color highlight in vim gitcommit message without fugitive

I'm using vim-fugitive. However, I'm using a black and white colorscheme. So, I don't see any warning for the 50 char long subject line of git commit message. I want to know how I can add a highlight ...
6
votes
4answers
1k views

How to copy text with syntax highlighting?

Want a simple way, like notepad++ plugin: NppExport - Export to RTF, to copy selected text with syntax highlighting. Notepad++, NppExport, Export to RTF example: Select text Copy RTF Paste ...
1
vote
0answers
24 views

Syntax - Match word based on a previous match

I want to highlight all words that have been matched in another syntax region. Using something similar to regex capture groups, for example given a file: {highlightme} asda asasd asd asd as ...
6
votes
1answer
582 views

Setting syntax in ftplugin

I’m trying to set the syntax of Processing files (*.pde) to java with a ftplugin. .vim/ after/ ftdetect/ pde.vim ftplugin/ processing.vim In after/ftdetect/pde.vim I ...
2
votes
1answer
31 views

Highlight `SquishedCommas`, except at end of line

Following up on this question on how to highlight commas not followed by a space; the accepted answer provides a nice solution for problems like: func(a, b,c,d) But it also highlights commas at the ...
0
votes
1answer
406 views

Syntax highlight Markdown formulas using LaTeX highlighting

I often write non-trivial mathematical formulas inside Markdown documents, and having them syntax-highlighted would really help. In Markdown, LaTeX math formulae are denoted: $x^2$ and $$x^2$$, and ...
2
votes
1answer
55 views

Can't get syntax highlighting rule to work

I'm trying to add this rule: syn match Keyword /{+.*+}/ If I open a plain text file and run the above as a command, it works: stuff like {+ asdf +} gets highlighted as a keyword. However, if I add ...
1
vote
1answer
45 views

Color Stuff Inside Braces in a Desired Way With a Trigger

Suppose I have \frac{stuff}{matter} somewhere in a file I am editing. And I want to change stuff and matter. So at the trigger of a command, I'd like to see the following take place: stuff gets ...
0
votes
0answers
44 views

Highlight block of injected code [duplicate]

windows 10/ gvim 1-1802. I use Javascript and there are sometimes blocks of HTML code that need to be inside a particular region that can be indicated by """, for example . I have a similar ...