Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
8 views

Syntax hightligh broken in html file after ^F

Expected behaviour Syntax highlight should work even after CTRL-F Actual behaviour Syntax hightlighting stops working after scrolling to next page Steps to reproduce using nvim -u NORC: nvim -u ...
3
votes
1answer
23 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
37 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
32 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 ...
0
votes
1answer
21 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
1answer
185 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
46 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:...
0
votes
0answers
64 views

Vim syntax highlighting not working for all keywords in python file

I have been using vim/neovim for python for quite some time now and for some reason the syntax coloring doesn't really highlight all the different variables/methods/function calls etc in the python ...
1
vote
2answers
28 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
22 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
27 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
39 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
51 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
69 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
34 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
64 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 ...
0
votes
0answers
21 views

tex.vim and syntax highlighting problem

I am having some trouble with the default syntax highlighting for .tex files. I am using the elflord color scheme, and whenever I use a \textit{} environment, the text between the braces is ...
1
vote
1answer
32 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
31 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 ...
0
votes
0answers
37 views

Why doesn't the `syntax match` command work when called from my .vimrc?

Suppose I want to show all instances of "epsilon" with "ε". So I make a .vimrc file with the following code set conceallevel=2 syntax match Entity "epsilon" conceal cchar=ε Unfortunately, this doesn'...
0
votes
0answers
24 views

Some words from ctags file are recognized but not highligted

How can I make vim highlight them? I have found that if i remove the white space between \^ and $/;" they do get highlighted. So words from lines on this form /^ void someFunction(int integer){$/;" ...
1
vote
1answer
47 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
35 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
2answers
168 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
18 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 ...
1
vote
1answer
100 views

clear all of the highlight groups manually

I know I can do :syn clear and clear all highlighting. But I want some of the highlights to stay. I have these lines in my vimrc hi clear Constant hi clear Function hi clear Identifier hi clear ...
6
votes
1answer
82 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
26 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
0answers
41 views

How to highlight function like (req, res, next) -> in javascript/coffee

gvim 1-26/windows10 I'm trying some .coffee files and meet a lot with this kind of syntax (req, res, next) ->. As I know it's a call back function and I can't get it highlighted. The reason is ...
0
votes
1answer
76 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 ...
0
votes
0answers
51 views

Syntax highlighting for keyword followed by dot

I'm writing my own syntax file and I'm wondering if it possible to make it so that myKeyword.anything() (where anything is anything) is highlighted up until the parenthesis. Also, is it possible to ...
2
votes
1answer
37 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
32 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
33 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
36 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
1answer
403 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
70 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
53 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
35 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 ...
0
votes
0answers
39 views

ALE apply suggested syntax corrections

Is it possible to automatically correct, on command, the syntax errors/warnings suggested by the Asynchronous Lint Engine? Say, it suggests that at certain places semicolons are missing. Can I have ...
0
votes
0answers
85 views

vim: specify path to load color scheme from

I have multiple servers, and a network share. Every server should share the same vim config. So i put my .vimrc file on the share and load it via the -u option. However vim cannot find the color ...
1
vote
0answers
54 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
34 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
47 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
99 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
31 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
447 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 ...
1
vote
1answer
179 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
98 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 ...