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

Use .vim syntax file in language REPL

Lets say I have a REPL ./repl, which reads a line from the user, evaluates it, prints it and then repeats. I have a .vim file that does syntax highlighting for this language in my .vim/syntax ...
6
votes
0answers
84 views

Count only words for which Spell is enabled?

I want to count the words in my buffers, but for TeX files, for instance, a lot of words (e.g., commands) shouldn't be counted. I'm aware that there are scripts that do this specifically for LaTeX, ...
1
vote
1answer
50 views

batch create html colored versions of a list of files reflecting syntax highlighting

I would like to be able to easily create html-colored versions of a list of files (ex: "all the files in this directory", or "this list of files") I know that I can do this manually, one by one, by: ...
3
votes
1answer
324 views

Syntax highlighting for custom LaTeX commands

I have a few custom LaTeX commands like this one, for instance: \newcommand{\oeuvre}[1]{\textit{#1}} I use this for titles of books and other works. Sometimes I want them to be italicized, sometimes ...
0
votes
1answer
52 views

Allow comment highlighting inside biblatex entries

The default syntax highlighting for bib files doesn't highlight comments inside entries, like this: @book{test, % title = {This isn't highlighted as a comment}, } That's because bibtex doesn't ...
4
votes
1answer
438 views

Syntax highlighting with nested braces and forbidden keywords

I would like to write a syntax highlighter for a language like this one: block1 { keyword1 value; keyword2 value; sub_block1 { keyword3 value; } } block2 { keyword1 value; } A ...
1
vote
1answer
82 views

Git submodules for syntax files

I keep my VIM folder under git version control. I use git submodules and Pathogen to keep my VIM plugins updated. The folder structure is .vim/bundle/$PLUGIN Is it possible to use git submodules for ...
19
votes
1answer
416 views

How do I enable language-specific syntax inside a heredoc?

When I edit a PHP file and I define a string in a heredoc, syntax highlighting will be enabled inside the heredoc if it is JavaScript syntax or HTML syntax or SQL syntax. However it will not work for ...
1
vote
2answers
4k views

How do I restore visual mode selection highlighting?

Somehow, over the last few days, the visual mode in Vim no longer flips the background highlight, as it used to. Now, if the file is recognized by something it can syntax highlight, it seems to ...
1
vote
0answers
95 views

syntax highlighting for indentation sensitive multiline comment

I want to create syntax highlighting for indentation sensitive language that I'm designing, my question is how to highlight multiline comment that begins with #! something like this #! xxxxxxxxxxx ...
2
votes
1answer
62 views

How to do restrict keyword inside special lines?

I am trying to write a VIM highlight file for Gaussian 09 inputs. One example of "control" line is shown below: # P TPSSTPSS 6-31G* DENSITYFIT OPT(VERYTIGHT) INT(ULTRAFINE) FREQ(NORAMAN) TITLE ...
4
votes
2answers
331 views

Vim syntax highlighting for ChatScript language?

I'm looking for a ChatScript language Syntax highlighting, of course for the Vim editor. ChatScript is a great (underrated) open-source language to build chatbots dialog flows scripts, made by Bruce ...
5
votes
1answer
2k views

Vim syntax highlighting for custom C types

I want to use syntax highlighting for custom C types. Based on my coding convention, types can occur in the following places: typedef type1 type2; (static | extern | register | volatile)? type ...; ...
11
votes
1answer
6k views

How can I fix “missing” syntax highlighting for Python keywords such as “self”?

I'm trying to fix syntax highlighting for python; my colors are different from those in screenshots of what it "should" look like in different vim color schemes. And you can see the difference in ...
6
votes
2answers
7k views

How to completely turn off colorscheme?

Original post I've got a colorscheme configured in my .vimrc but sometimes I'd like to turn it off completely which means that I would like Vim to use the default background and foreground colors of ...
1
vote
1answer
42 views

How to avoid repeating pattern strings in syntax files?

In my syntax description file I'm trying to define something like the following syn match arbSAMPLEop "\<\(TEX\|TEX_SAT\|TXP\|TXP_SAT\|TXB\|TXB_SAT\)\>" syn match arbTexTarget "\<\(1D\|...
3
votes
1answer
1k views

Vim black text on black background in command line in Windows 10 while editing git commit message

I am using git 2.7.0.windows.1 in Windows 10, with core.editor set to vim. Vim was downloaded from vim.org latest version binary: VIM - Vi IMproved 7.4.1023 (2013 Aug 10, compiled Jan 2 2016 14:24:...
10
votes
1answer
1k views

How can I highlight matching “%” names (e.g. if/end, for/end) defined by matchit.vim on selection?

Currently my Vim highlights matching parentheses, brackets, quotes, etc. with Cyan background and white foreground -- the cursor can be moved between these with %. Thanks to my matchit.vim, I can also ...
2
votes
1answer
61 views

syntax: match all lines with a given pattern that follow a line with a different pattern

I'm writing a Syntax file for Robot Framework. I want to create a color scheme for the [Documentation] tag, such that the text following the tag, and all subsequent lines beginning with ... until the ...
4
votes
1answer
180 views

New lines are not continuing block comments, only in php

Say I type /** and hit return. In a .cpp file, or a .js file, the cursor would continue adding *s for me. /** * But in a .php file, the cursor just moves to the next line. It's very annoying ...
0
votes
2answers
472 views

Customize syntax highlighting in netrw

Right now I am working on a latex project. When I open a netrw/vinegar window, I get following coloring: Apparently, certain filetypes are grayed out and other are not. I like the idea to emphasize ...
2
votes
0answers
131 views

Order of matches in syn-cluster

For regular match groups, the last defined group will be the first to match. When using match groups added to a cluster, I can't determine what the match order is. For example: syn match allgroupcol3 ...
2
votes
0answers
304 views

Changing background color of cursor during selection

Coming from Sublime, I find the following behaviour frustrating. When I select some text, the first (or last depending upon which way you select) character flashes between the text color and your ...
7
votes
2answers
138 views

Is there a way to restrict search results to differences in a diff?

I want to be able to search only within the DiffText regions of a file that I'm editing. Related question: https://stackoverflow.com/questions/2683521/vim-search-in-c-c-code-lines The accepted ...
3
votes
0answers
432 views

How to change the color used to highlight function calls?

I would like to know if it was possible to change the color used to display function name. Let's take the following example (using Python): def function1(arg): function2(arg) # ... ...
2
votes
1answer
905 views

How can I fix the default bash syntax highlighter?

I'm having some issue with the default "Dr. Chip" sh.vim highlighter. Specifically, it's failing to recognise the comment character # after a touch command. e.g. touch foo # it's here It doesn't see ...
2
votes
1answer
348 views

Overriding highlighting style for one syntax

My colour scheme (morning) doesn't play nice with the quickfix window: I cannot read the selected item's location, because the foreground and background colours are the same. Because of this I want to ...
7
votes
4answers
1k views

SpecialKey foreground color w/ cursorline set

In this Q&A, it's observed that there is a highlight group for CursorLineNr, which applies to the line number for the cursor line when set cursorline is on. I notice that using cursorline also ...
4
votes
1answer
340 views

How to check whether the cursor is at the boundary of a syntax item for indentexpr?

I'm writing my own indentexpr to indent my code, the indentexpr is run in a sandbox, so one important point is that I cannot change the text content. I have set up the syntax highlighting for quoted ...
4
votes
2answers
807 views

How to check the syntax of a file on the fly?

For those who might not know, Flycheck is a plugin which checks the syntax of the code you're writing on the fly, without forcing you to save the file. It does that by periodically saving the buffer ...
2
votes
0answers
136 views

Search within syntax group?

Is there a way to take advantage of syntax highlighting for searches? For example, can a search be limited to comments or non-comments, if they are correctly marked by syntax highlighting?
4
votes
1answer
2k views

Custom syntax highlighting: highlight word following keyword

I am currently trying to set a custom syntax highlighting using a mysyntax.vim file. I have several keywords (int, real, real2D, real1D, etc) currently highlighted using syn keyword VariableType real ...
2
votes
2answers
895 views

How do I get Vim to correctly highlight Math mode in LaTeX command options?

I adopted the bracket notation, e.g., x[i], for the discrete signal x where i is the time index. The problem occurs in a pgfplots figure but I figured, the syntax highlighting behavior is due to being ...
0
votes
1answer
375 views

Is syntax keyword case sensitive?

I'm trying to modify the plugin https://github.com/jaxbot/semantic-highlight.vim to highlight variables of differing case with different colours. Some example configuration the plugin generates: ...
3
votes
1answer
326 views

Nested highlighting

In html eruby files, I would like to highlight the <% ... %> text in dark green only when it is inside double quotes. I.e. in in this example: I want it dark green instead of white. I know ...
2
votes
1answer
371 views

Highlighting with :match does not appear in all buffers

I wanted to highlight all occurence of TODO and NOTE in my code. Looking on the internet, I inserted the following code in my .vimrc :match GruvboxGreenBold /NOTE/ :2match ErrorMsg /TODO/ This ...
10
votes
2answers
4k views

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?
2
votes
1answer
334 views

Adjust syntax highlighting for region included with syn-include?

I have a terminal color scheme that makes the default highlighting settings for diffs relatively hard to read. To address this, I’ve added my own custom settings inside of ~/.vim/after/syntax/diff.vim:...
2
votes
3answers
3k views

How do I turn Vi colors off in Ubuntu Linux 14.04

How do I turn vi colors off? I was using vim-tiny on on Ubuntu 14.04. Installed vim-nox. Version is version 7.4.52. Once I installed that, I got all these syntax colors by default. I have my Terminal ...
4
votes
1answer
2k views

Tmux messing with Vim highlighting [duplicate]

When I load up vim inside tmux there is a background color behind all text as so: If I load it up not in tmux I get the following: I want it to be like image 2, I can not understand why tmux is ...
2
votes
1answer
164 views

match special types in C

vim has some great highlighting for built-in keywords, functions and types, but when working on some non-built-in projects, this seems not enough. For instance, the keyword before a variable is ...
7
votes
1answer
1k views

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 ...
3
votes
1answer
112 views

How can I select a syntax highlighting at the (shell-) command line?

Usually, vim will get the highlighting right from the file extension, but this obviously doesn't work when I'm displaying content read from standard input. cat File.hs | some | processing | pipeline |...
2
votes
0answers
522 views

Turn off markdown highlighting for underscores in inline code?

Markdown highlighting is great (when it works), but I've seen a problem on two different boxes with underscores in inline code and I'm wondering if there's an easy solution. When I put, for instance, ...
1
vote
1answer
888 views

How to change Vim's :hardcopy printfont?

I would like to be able to print in other than Courier font using the :ha command. Investigating more closely, I found that it is documented that the Courier font is always used: - 'printfont' - The ...
9
votes
1answer
691 views

Vim syntax highlighting of numeric literals with single-quote digit separators

C++14 provided us with the option of using single quotes to separate the digits of large numeric literals. This breaks Vim's syntax highlighting. For example, consider the following C++14 program: #...
6
votes
1answer
364 views

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 = <<'...
12
votes
1answer
600 views

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 ...
3
votes
2answers
347 views

Poor syntax highlighting in vimwiki (command prompt)

Is there any way to change the syntax highlighting in vimwiki in windows. I could not properly see the line enclosed between [[some word]]. The same works well in Linux.
16
votes
4answers
4k views

Vim syntax pattern to highlight python keyword argument

I'm struggling with learning vim regexps (I don't know any other regexp very well either), so the main problem is to define regexp that would match some_function_call(simple_value, keyword=value) ...