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.

For a general overview of how syntax highlighting works in Vim see this answer.

679 questions
102
votes
4 answers

List known filetypes

How can I get a list of the names of filetypes that vim currently knows about? I want to be able to do this so that when vim doesn't automatically detect a filetype I can try some of the filetypes vim knows about that may be similar and see if they…
Praxeolitic
  • 2,468
  • 2
  • 15
  • 28
41
votes
9 answers

How do I prevent vim from hiding symbols in markdown and json?

This drives me crazy, I do :set ft=text To see something, otherwise all the links disappear in markdown and quotes in JSON. How do disable this once and for all?
firedev
  • 2,392
  • 2
  • 19
  • 31
16
votes
1 answer

Treat string literals as a different language

I have a number of JavaScript files where the strings are snippets of HTML to be inserted into the webpage. Vim performs syntax highlighting on the JavaScript, and highlights the quoted strings as such. It seems to go beyond highlighting, in fact:…
KRyan
  • 264
  • 1
  • 7
15
votes
1 answer

Can vim syntax regions be made to touch/overlap?

So a while ago I had decided to learn more about how vim's syntax files work, by creating my own. My goal was to create a simple syntax file that would split the file into 3 parts based on delimiters, and include pre-existing syntax files for two…
Izkata
  • 323
  • 1
  • 9
12
votes
1 answer

Mixed color syntax in vim

I am often writing documents in knitr using vim, which means that I have markdown code mixed with R code. I would like to have R syntax coloring on R chunks, but markdown or no coloring on all the other fragments. Is this doable? How?
January
  • 263
  • 1
  • 6
10
votes
2 answers

How can I add syntax highlighting to vim as I can do in gedit?

When I write a script in gedit, the commands, comments, variables etc... are given different colors. How do I setup vim to do the same?
One Face
  • 243
  • 1
  • 6
10
votes
2 answers

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 hex digits, with optional whitespace in between,…
Kaz
  • 481
  • 2
  • 12
9
votes
2 answers

Why my vim doesn't support hex color code?

When I use the following command to set the color of my vim, :highlight Error ctermfg=#00afff it prompts E421: Color name or number not recognized: ctermfg=#00afff
haolee
  • 275
  • 2
  • 6
8
votes
1 answer

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 file to have only tabs, but these options show some spaces as >…
xtian
  • 315
  • 3
  • 7
7
votes
1 answer

Syntax highlight region / keyword overlap

I'm trying to write a syntax file for Linux logrotate scripts. Often they contain inline definitions of scripts to be run before or after the rotate action. An example (the cups-daemon logrotate script as provided by Ubuntu 14.04): prerotate …
Łukasz Górski
  • 173
  • 1
  • 5
6
votes
1 answer

Highlight heredoc as perl code

I would like to highlight all the HereDocs in a particular perl file as perl code. For example, I'd like to apply the normal perl highlighting to the subroutine in this HereDoc: my $code = <<'CODE'; sub test { say "this is a test"; …
Mark Grimes
  • 201
  • 1
  • 6
6
votes
1 answer

Change default syntax highlighting scheme

I'm unhappy with the default syntax highlighting in vim and would like to change it. I tried to follow the accepted answer on this page, but I think my vim version (7.4) is different. Inside /usr/share/vim/vim74/syntax I have tons of files, so I…
ankush981
  • 201
  • 1
  • 8
6
votes
1 answer

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 facilitate highlighting of the current "cell" only,…
vbond
  • 61
  • 1
6
votes
0 answers

Syntax highlighting randomly turns off

I use syntastic and split windows heavily in my vim workflow. Lately, syntax highlighting will vanish, seemingly at random, in one of my windows, usually after opening a new split. This happens with the highlighting of js files, ruby files, even…
Jonah
  • 743
  • 6
  • 15
5
votes
1 answer

Personal syntax highlighting

I tried to change the syntax highlighting, by copying /usr/share/vim/vim74/syntax/html.vim to ~/.vim/after/syntax/html.vim. Then I changed the syntax highlighting file, but I don't see any changes. filetype is set properly, and when I change…
pfnuesel
  • 724
  • 7
  • 16
1
2 3
11 12