We’re rewarding the question askers & reputations are being recalculated! Read more.

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
5
votes
1answer
2k views

How can I highlight all function names in Python files?

I try to make python.vim color similar to material theme (sublime text 3), see pictures: https://imgur.com/a/wOgH7 expected is material theme and current is mine. You may noticed that all method, ...
1
vote
0answers
34 views

How to access syntax elements

I try to inline one syntax in another syntax (to be explicit: CSS in JS template strings). I'd like to build on top of the existing CSS definitions and not create new ones. Question: Is it possible ...
2
votes
0answers
300 views

vim in tmux lose highlighting

I'm using vim 8.0 and tmux 2.5 on ubuntu. And I have set the TERM environment export TERM=screen-256color and run as tmux -2. Normally, nothing goes wrong. It's like the following picture: But ...
2
votes
0answers
39 views

Define region in region with same end match

Let's see an example: block property Property1 key: value end property Property2 key: value end end I would like to let property/end pair highlight only in block/end ...
3
votes
0answers
75 views

Can I change the highlight of specific conceals?

I'm using :syn-cchar to replace certain syntactic elements with Unicode characters (à la vim-haskellConcealPlus). Since I'm replacing several different elements, I'd like to be able to highlight some ...
1
vote
1answer
271 views

How to highlight region over region

Let's think we are going to render html file. We highlight <a> and <img> tags, so a and img will be highlighted as Keywords. We assume <a> accepts attribute href but not src, while &...
2
votes
1answer
977 views

How do I make vim highlight unused variables

I want vim to tell me (only when I ask it to) if there are variables not used in the current file. Is this possible given that for now I need it in my javascript/php projects?
5
votes
1answer
352 views

What are the global settings for syntax highlighting?

I'm troubleshooting syntax highlighting in my .vimrc settings. My setup is a little complex because I have some filetype settings for plain text and other settings for programming files (using ...
3
votes
1answer
470 views

How to identify the highlight groups in use on a particular character? [duplicate]

I'm new to vim and bumped into a problem. Short question -- will vim tell me why it chose to highlight certain text in a certain way? Long question -- I'm using vimdiff to compare two files, and ...
0
votes
2answers
344 views

Vi/Vim 8 on debian stretch : filetype “bindzone” not loaded automatically

When opening a bind zone file, I have to type by hand :set ft=bindzone to get syntax highlighting. It's not set automatically on load. On another hand others filetypes (such as php, perl or kind) are ...
5
votes
2answers
1k views

Exclude start and end match from region

I'm trying to establish syntax coloring for a certain lexical syntax: a "buffer literal". A buffer literal begins with #b' and ends with '. Between the single quotes, there can be undivided pairs of ...
2
votes
1answer
291 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 ...
2
votes
0answers
529 views

Prevent fold background color to override gutter

Here's what my colorscheme looks like: But when there are folds, it looks ugly like this: The fold background overrides the "gutter" color, but I would like the gutter to remain gray. Is there any ...
2
votes
1answer
672 views

vim 8.0 not honoring custom colors

I updated from 7.4 to 8.0 last night and vim stopped honoring the highlight commands in my .vimrc file. Minimal complete example: with a .vimrc that contains only the following " a comment sy enable ...
2
votes
1answer
396 views

How can I remove a syntax keyword?

In Python3, file is no longer a builtin. It's just a plain ol' name that isn't even associated with anything until you do. But all the syntax files that I've used have it as a builtin. Is there a ...
3
votes
2answers
403 views

How can I override a syntax keyword match?

I would like the html tag attribute id to be highlighted differently from the rest of the tag attributes. Like the Atom editor: Given this line from the html5.vim plugin syn keyword htmlArg ...
3
votes
1answer
688 views

Is it possible to make text blink inside vim?

There are ANSI escape codes (namely 5 and 6) that make subsequent text blink and my terminal (rxvt-unicode-256color) does support this. Is there a way to allow this to happen using hi? EDIT: From ...
2
votes
0answers
50 views

Syntax highlighting depending on whether whole line is commented

Is it possible to have vim highlight folds differently depending on whether every line in a fold is only comments or whitespace? In that case, how?
3
votes
2answers
376 views

How to tell vim to behave the same for file extension .in and .mako

I noticed Vim will choose the correct syntax when I open a file that ends with .c.in or .pl.in. I would like to tell Vim to behave the same with extensions like .c.mako or .pl.mako. How is it ...
3
votes
1answer
414 views

How can I highlight only the identifier of a function in Java?

I found this question on SO but it is not adequately answered there. I thought that re-posting it here would bring it to the attention of people with more specialized knowledge who can answer it ...
2
votes
0answers
50 views

LaTeX tabu package breaks Vim spell and syntax highlighting

The first line of this section of LaTeX code breaks syntax highlighting and spell check whenever I scroll to the area of the document that contains it: \begin{tabu} {*3{X[l$]}} col1 & col2 ...
3
votes
2answers
817 views

Syntax highlight fail for Prolog files

I'm having trouble configuring Vim on Manjaro: After setting syntax on at .vimrc file, I make a Prolog program (bug.pl) which shows no syntax highlight: But after I append /**/ to top of file (then ...
2
votes
2answers
768 views

Read values from a highlight group

I can read a value from an option like: let b = &background Is there a way to read a value from a highlight group? Something like this pseudo-code: let b = &StatusLine['ctermbg'] ...
3
votes
1answer
493 views

What options make Vim aware that the file editing is for vim settings?

I am editing a non-standard file of Vim settings and the file has no syntax highlighting because Vim is not aware that the file contains settngs for itself. eg - These lines are not highlighted by ...
2
votes
1answer
802 views

How to highlight keywords in a syntax region?

I'm trying to improve the cmake-syntax-highlighting for vim. I'm unable to have vim highlight a keyword which is inside a text which is already matching a region. I'm talking about variables: For ...
1
vote
0answers
220 views

Improperly highlighted when used with cursorcolumn

With this minimal .vimrc I get a highlight conflict in several situations. set nocompatible set runtimepath +=~/.vim/bundle/Vundle.vim filetype off call vundle#begin() Plugin 'itchyny/vim-...
3
votes
1answer
278 views

neovim takes a long time to open files

On profiling, I found that <SNR>101_parse_screen() is taking above 6 seconds. This problem goes away when I comment out the plugin vim-polyglot. This is most evident for vue files. Not sure if ...
2
votes
1answer
245 views

How do I highlight pc-lint comments in C/C++

How do I mimic the behavior of Doxygen comment highlighting for PC-lint comments? Comments are in the following formats: /*lint ... */ //lint ... /* LINTLIBRARY */ /* ARGUSED */ /* VARARGS[N] */ <-...
2
votes
0answers
255 views

syntax highlight function arguments

Trying to create a simple syntax highlighting for a special file type we use. within this file there are simple functions defined which I match using keywords: syn keyword Funcs foo bar baz hi def ...
2
votes
1answer
535 views

How to reload the current file to change syntax highlighting (ex: adding a shebang)?

I always prefer shebangs over extensions. A lot of times I make a new file without an extension in vim, which gets opened as plain text, since no extension is provided, which is completely normal. ...
1
vote
1answer
466 views

Highlight all imported modules in python

For example import numpy as np import matplotlib.pyplot as plt x = np.array([-1, 0, 1]) y = np.abs(x) plt.plot(x, y) plt.show() Is there a way to highlight all the occurrences of np and plt?
4
votes
1answer
404 views

Can I show a color from its hex value in *any* file?

We have vim-css-color to display colors in .css files. Currently I'm editing my i3wm config to match colors to a new terminal theme and it would be quite handy to be able to actually see colors I'm ...
2
votes
1answer
120 views

How to share syntax highlights files for a “new” language?

In past I asked the question about how to create syntax specifications for ChatScript, a new programming language unforeseen in standard programming languages vim set (see: Vim syntax highlighting for ...
2
votes
1answer
55 views

Where is `javaParen` defined?

I want to write my own java syntax file for more customization, But can't find the definition of javaParen, it certainly isn't defined in default java.vim file. I actually want to highlight all the ...
1
vote
1answer
612 views

Adding multiple syntax group to a syntax region

I’m writing a syntax file for Bats. I started my syntax file by loading the bash syntax: let g:is_bash=1 runtime! syntax/sh.vim unlet b:current_syntax I then defined the Bats custom keywords: ...
0
votes
1answer
127 views

Vim with syntax highlighting has slow searching in XML

My experience is that Vim is slow when searching in large XML files with syntax highlighting turned on. I find it to be very dissatisfactory. I have read about the issue elsewhere but I have not been ...
5
votes
1answer
247 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
0answers
9 views

“set background=dark” masking highlight command [duplicate]

If my .vimrc file has this: set background=dark highlight Comment term=bold ctermfg=white ...comments are white as expected. But if I reverse the order of the statements: highlight Comment term=...
0
votes
1answer
420 views

Folding doesn't work for C/C++

I've been having a ridiculously hard time getting C/C++ code folding to work with set foldmethod=syntax. To debug my issue I've stripped down my vimrc to only this: set foldmethod=syntax syntax on ...
5
votes
1answer
558 views

What does the command `:syntax reset` do?

from the help: :h syntax-reset If you have changed the colors and messed them up, use this command to get the defaults back: > :syntax reset It is a bit of a wrong name, since it does ...
3
votes
1answer
512 views

Why does modifying the `Normal` highlight group affect syntax not belonging to the highlight group?

Im running terminal vim, and when a syntax highlighted file is loaded and I have a colorscheme active and I run this command :hi Normal ctermbg=2 ctermfg=0 ALL text in the window changes, not just ...
0
votes
1answer
81 views

Finding a match immediately after another match [duplicate]

I'm writing a syntax highlighter for my test script output. I'm having problems figuring out how to find a match immediately after another match. In the screenshot, notice the $VAR1... is not ...
3
votes
2answers
1k views

Reloading syntax file without restarting vim

I've tried every tip I can find on this and none of them work. I've cleared my .vimrc file. I have a syntax script in ./vim/syntax/test.vim. It consists of nothing but this: highlight clear syn ...
0
votes
0answers
38 views

Turning on syntax highlighting for test script output to new buffer

I'm using a plugin, bexec, to execute a test script. The plugin opens up a new buffer to the right of my code and it displays the output of the test script: I would like to have syntax highlighting ...
0
votes
1answer
322 views

How do I add syntax keywords globally for any filetype?

I have some keywords other than TODO used in comments that are common to all languages, things like 'NOTE'. I want to label these words under Todo syntax class, so that they have the same colour with ...
2
votes
1answer
325 views

Syntax Highlight line above matched pattern

I am looking for a way to highlight text on the line above a matched pattern. For example, my text may appear like this: Some text --------- What I want is to match on the underline dashes and then ...
3
votes
1answer
108 views

Shortcut to remove orphaned parenthesis

While writing code it often happens that adding one parenthesis leaves another one orphaned somewhere. Many syntax color scheme color the parenthesis differently to signal it. For example, while ...
1
vote
2answers
1k views

Why isn't vim applying syntax highlighting to this code?

If I open a random file (in this case, say .zshrc) in a blank vim with no rc file , but with vi compatibility forcing off vim -N -u NORC ~/.zshrc As expected vim will launch and display .zshrc ...
1
vote
0answers
63 views

vim-latexsuite syntax highlight in macro parameter

I'm using vim with vim-latex to edit my LaTeX-files. I noticed that the \begin{env} and \end{env} are not colorized when they are in a macro parameter (the \vary command and question environment are ...
2
votes
0answers
444 views

Syntax highlighting: what is the difference between :syntax match and :match?

Simple question -- what is the difference between the two? When I try, for example, to highlight characters on every line after the 80th with highlight link OverLength Error (OverLength being an ...