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

Contents are all selected by default

First, I don't know what happed, which means the cause may not as the title suggests. I was editing with vim. one or two mis-key strokes, now whenever I open file with vim. All the Contents are all ...
0
votes
1answer
213 views

How to highlight todo in a comment line?

I'll leave ? at the beginning of a commented line to mark a todo item. -- ? TODO ... This line will be marked as comment. How to highlight the ? and the remaining text by Todo color while keep the -- ...
2
votes
1answer
390 views

Why local syntax file is not working?

I've created a local syntax file def.vim and saved in ~/.vim/syntax. First it's working, but just after I closed gvim and several other windows, it stops working. First I checked :scriptnames. Local ...
1
vote
1answer
295 views

Syntax highlighting gone when using buffer

At work I usually keep only a few files in buffer, typically a Yang file, a Java file, and possibly something like a readme file. In such an environment, the Yang syntax highlighting does not work. ...
1
vote
2answers
58 views

Does exist BSD's make syntax file?

There are many make-variant, maybe the most popular is the GNU make. The vim package contains syntax/make.vim which related to GNU make. Many people use different make, for example FreeBSD's make ...
1
vote
1answer
253 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
277 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
18 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 ...
0
votes
1answer
121 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
277 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 ...
2
votes
1answer
972 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
33 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
33 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
325 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 #.*$ ...
13
votes
0answers
291 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
296 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
298 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
108 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
60 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
49 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
1k 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
72 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
351 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
815 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
273 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
66 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
220 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
805 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
277 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
375 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
317 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 ...
4
votes
2answers
883 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
250 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
451 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
607 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
318 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 ...
2
votes
2answers
308 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
584 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?
2
votes
2answers
291 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
350 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
45 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 ...
4
votes
2answers
673 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 ...
1
vote
2answers
596 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
467 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
624 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
197 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-...