Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
117 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
367 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
146 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
131 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
33 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
74 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
67 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
97 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
126 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
40 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=...
0
votes
1answer
297 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
82 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 ...
0
votes
0answers
144 views

Change color of character covered by cursor

I'm using xfce4-terminal and the cursor is green, which means that green text behind the cursor is not visible or is hard to see. Is there a way to force the etext behind the cursor to be some ...
1
vote
1answer
119 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
91 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 ...
0
votes
0answers
23 views

Fold on second line of a region possible?

I have the following snippet of lines output from a test program: [FATAL] No member name supplied Org::Members: 144 Org::Members::...
5
votes
4answers
729 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
22 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
349 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
266 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
53 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
39 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
35 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 ...
2
votes
0answers
42 views

Highlight arbitrary rectangular regions

Is it possible to highlight specific and arbitrary rectangles in a buffer? I want to implement a code scope highlight that groups code into a hierarchy of boxes. here is my mockup that I made: ...
1
vote
0answers
1k views

E518: Unknown option: termguicolors

This thing is driving me nuts I'm trying to setup vim on my co-workers computer, and this is my .vimrc file everytime I run vim I get this error Error detected while processing /Users/toters/.vimrc:...
-1
votes
1answer
372 views

Check a simple html file with ale

Install ale with pathogen. cd ~/.vim/bundle git clone https://github.com/w0rp/ale.git My setting for ale in .vimrc. let g:ale_sign_column_always = 1 let g:ale_set_highlights = 0 The target html ...
0
votes
1answer
86 views

Interactively check given string highlight group

We can get highlight group information by the following command :hi[ghlight] {group-name} But is it possible to get this information by given keyword? Something like this : syn match Integer '\d\+'...
-1
votes
1answer
43 views

hidden highlight selection when search with * or # is active [duplicate]

Using the * key searches for the word under the cursor. Use # to do the same, backwards. When search is active, all instances of word appears highlighted. I want to know if is possible to remove the ...
1
vote
0answers
92 views

Disable vimdiff syntax highlighting

I have syntax off at the end of my nvim.init file, but no matter how hard I try there is always diffsplit coloring. I would like to disable it because I guess (Neo)vim is very slow with syntax ...
0
votes
1answer
37 views

How do I stop vim from higlighting uncessary words in PHP

I have this issue with my vim setup, where some words get highlighted unnecessarily. The image below shows an example. The words not and to where highlighted but there's no reason for them to be. How ...
3
votes
0answers
51 views

How can I make syntax highlighting files more readable and maintainable?

Vim uses regular expressions for syntax highlighting. Often maintaining these can become rather unwieldy. For example: syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&...
2
votes
1answer
210 views

How to add a new colorscheme syntax keyword

I'm trying to create a new custom colorscheme and syntax highlighting. I have copied some examples into ~/.vim/colors/ and ~/.vim/syntax with new names inside for the scheme. All the basics work ...
0
votes
1answer
38 views

Isolate a matched virtual column ruler to the cursorline only?

I'd like to add ruler marks/virtual columns along the lines of matchadd('ColorColumn', '\%81v', 100) while restricting their display to the cursorline. Any ideas ?
2
votes
1answer
1k views

Highlight whole todo comment line

I'm still learning Vim and making small customizing on it. I'm struggling a bit to create a custom style/syntax highlight which would highlight the whole todo line. So in the picture instead of having ...
3
votes
1answer
801 views

Using set listchars, what are 'extends' and 'precedes'?

Searching for a solution to show hidden characters, I found the example, :set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< :set list What are extends and precedes? I expected a ...
0
votes
1answer
238 views

concealing the start and end pattern in syntax region

I'm trying to learn multi line highlighting and have managed to get the following working syntax region myMinusStart start=/^\s\+zzzz / end=/^\s\+qqqq / concealends But the concealends is not hiding ...
0
votes
1answer
99 views

Is there a way to use cpp.doxygen syntax file and my own cpp.vim syntax file?

At the bottom of my file, I'd to have something like this: // vim: syntax=cpp.doxygen Only, when I do that, it breaks my auto-load of my own cpp.vim. au BufNewFile,BufReadPost *.cpp so $...
1
vote
1answer
98 views

Backreference for syntax region

I am trying to improve Vim's syntax highlighting for YAML files. YAML supports long string literals that begin with either a ">" or "|", like this: keyA: > A string literal that spans ...
2
votes
1answer
69 views

Use blank line as end for one region and as start of another

I want to syntax highlight a header region in custom style and a body region with the existing markdown style: Title: Test Note Id: 147648d8-8680-4847-8f50-dd4a67f870b5 Created-At: 2018-02-26 22:44:...
2
votes
1answer
67 views

How do I change the regex for a single syntax highlighting match?

When I'm writing Latex files in vim, the syntax highlighting recognizes \newcommand as the start of a new command environment, but not \newcommand*. Digging into the syntax file, it seems that to fix ...
1
vote
1answer
141 views

Enabling Syntax in Vim Creates Lag

I was trying to learn javascript the other day and was using emacs as I have been trying to learn emacs as well. But after sometimes my left wrist started to hurt(as one's does) so I switched to ...
2
votes
1answer
437 views

How do I make vim highlight math properly in the align environment?

Sorry if this is the wrong place to ask this, I'm new to the site :/ I asked the same question in TeX StackExchange, and I was pointed here. My issue is this: when editing in vim, my syntax file ...
0
votes
1answer
43 views

How to affect the syntax highliting filetype from local vimrc?

I am editing a source code in language1. It doesn't have a built-in syntax highliting configuration into my vim. However, its syntax is very similar to language2, which has. I think, syntax ...
2
votes
0answers
74 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 ...
0
votes
1answer
290 views

Cursorline/Columnline slowdown

I have recently recompiled vim, and ever since, when I have a big file, the scrolling gets slow. cursorline seems to be the problem; it doesn't matter if I use any of my plugins, if I have cursorline ...
0
votes
1answer
254 views

Strange Highlighting during Git Commit

What can I do to have proper highlighting on a .git file? I chose Vim as my default editor when I commit files, the color scheme(Gruvbox) is applied, but I get strange colors as I start typing. I ...
1
vote
2answers
441 views

Syntax highlighting of underscores in LaTeX, even though they only appear in filenames

I'm using nvim and LaTeX together, and for the most part it's been great. However, nvim appears to be incorrectly highlighting underscores that appear in filenames I include as part of the subfiles ...
0
votes
1answer
288 views

How to only load a certain syntax file

Okay, so I have a syntax file asciidoc.vim in ~/.vim/syntax and this file is actually loaded, as I checked with scriptnames. But for some reason, it only works, if the builtin syntax files haven't ...
2
votes
1answer
148 views

Inverted syntax highlighting of multiline strings in Python

I'm editing a ~1000 line Python file containing long docstrings. Occasionally, when I'm in editing the middle of a file, the syntax highlighting will 'invert' so that everything outside the docstrings ...