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
1answer
326 views

How to edit all vim highlight groups?

I am going through the unfortunate process of making keybinds to change colorschemes, but different plugins have their own highlight groups which is making this difficult. Is there a way to set the ...
2
votes
1answer
408 views

CMake syntax highlighting not working as expected

For most files, Vim (terminal) is syntax highlighting properly without any issues. However, I am unable to get it to work for CMakeLists.txt: Neovim has no trouble with syntax highlighting, neither ...
1
vote
0answers
27 views

Determining syntax group type from output of 'syn list' (doesn't appear to work for regions)

Why does the output of syn list not include region in the syntax group definition line, like it does for 'match' type groups? What is the meaning of the xxx in that line? I've got a vim 8.0 function ...
1
vote
1answer
181 views

why I am losing syntax highlighting when vim is invoked within a script?

If I initiate vim from command line prompt, everything works as expected, but when it is initiated from a script, then syntax color highlighting is lost. The script can be as simple as the following, ...
3
votes
1answer
415 views

Get back regular vim colors

I just installed Linux Mint 18.3 and to my surprise colors in vim changed! Vim in the terminal on the left has the color scheme I've always seen and got used to. Vim in the terminal on the right has ...
3
votes
1answer
2k views

How to set value of cterm to both bold and underline?

Currently, my vimrc has set cursorline hi CursorLine cterm=underline ctermbg=none ctermfg=none I want to be set cterm to both underline and bold
0
votes
1answer
34 views

Do syntax patterns let you use very magic or not?

Quoting syn-pattern: See |pattern| for the explanation of what a pattern is. Syntax patterns are always interpreted like the 'magic' option is set, no matter what the actual value of 'magic' ...
3
votes
1answer
34 views

How to syntax highlight line with three parts?

I am trying to highlight lines like these: -> Some text without a domain -> Some other text with a domain (example.com) I would like: a) the leading "->" not to be highlighted; b) the text to ...
1
vote
1answer
422 views

Ignore pattern inside of a region

:h region bring me very little help. I need to exclude a pattern inside a region that should be ignored for example: don't apply match/highlight begin from # to the end of line $ I try to ignore #.*$ ...
19
votes
0answers
464 views

How does `\zs` interact with syntax matches?

Consider the text: foobarbaz First we highlight the regular expression /foobar/: :syntax match Special /foobar/ Next we highlight the regular expression /foobarbaz/: :syntax match Error /...
1
vote
2answers
408 views

Highlight exported Go functions

Golang uses naming convention to separate functions visibility: exported (public) starts with a capital letter, non-exported (private) with a lower letter. I would like to highlight exported functions,...
0
votes
1answer
491 views

Highlight function's keyword and parameters

Follow here @muru point out how to highlight keyword in a function and function name but I want also highlight parameters, for example: abc = myFunc(Green, Orange=Green, Green, abcd(Orange=Green), ...
1
vote
2answers
155 views

How to write a syntax file

This is an example of my file format basically it follows this layout: <word> <wordWithNumbers> <wraped text> Examples: sadfa 23eafa asdfasdf asdfdsf sflsdkjf ;lkja flksad ks ...
2
votes
0answers
72 views

vim cpp syntax contained region

I define four key words and two regions in vim scripts syn keyword KeywordA A nextgroup=rangeA skipwhite skipnl skipempty syn keyword KeywordB B contained containedin=rangeA nextgroup=rangeB ...
1
vote
0answers
50 views

Match through nested function

I have this sample: I expect arg3 to be colored green as arg1, arg2 and FunCall with my current setting: syn match pyFun "xxxx" contains=xxx syn region pyFunCall start="(" end=")" contained contains=...
1
vote
1answer
2k views

Vim in terminal is black-&-white but vim launched from dash shows colors

I am using Vim 7 on Ubuntu 16.04 (gnome) and the terminal emulator I am using is terminator. I really like the aristocrat/brogrammer colorscheme for Python and so I copy-pasted it in ~/.vim/colors/...
1
vote
1answer
115 views

Weird highlight behavior: Can't match pythonBuiltin

python builtin function like print, len, sum... i can match and highlight other function and its argument. but with builtin function i can't change color. my setup: syn keyword pythonStatement def ...
0
votes
1answer
492 views

how to get the color theme right with vi on java

I'm currently using zenburn on android studio (java) and it looks very colorful (note: I'm using iTerm2.. not sure if that changes anything) but if I add zenburn color to my vimrc, the same file ...
2
votes
1answer
1k views

How can I highlight variable/arguments inside method/function in Python files?

An expansion of this question: How can I highlight all function names in Python files? i have a sample: src_file = replacement_file.replace(header_dir, source_dir) here i need to match variable/...
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
317 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
40 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
81 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
317 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
1k 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
455 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
535 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
357 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 ...
6
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
311 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 ...
3
votes
0answers
560 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
701 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
439 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
512 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
754 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
428 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
457 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
51 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
945 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
867 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
504 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
918 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
230 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
303 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
269 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
272 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 ...
3
votes
1answer
634 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
512 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?

1 2 3 4 5 8