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

Change spellcheck language via syntax

I have book length prose content in Markdown files that is mostly in Turkish. I've done a lot of work to get Turkish spell checking working decently in vim, so :set spelllang=tr spell works well ...
2
votes
1answer
105 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 ...
2
votes
1answer
80 views

Yank the characters that replace concealed strings?

For example, in .tex files, the expression $\sum$ is replaced with ∑. I would like to yank ∑, but when I try I get one of the characters that compose $\sum$, even when I set concealcursor. What is the ...
2
votes
2answers
333 views

Is it possible to make “???” a keyword that can be highlighted?

Is it possible to make ??? (3 question marks) a keyword, and highlight it? I have tried the following in a syntax file. Other strings on the line are highlighted, but not ???. \?\?\? does not work ...
2
votes
1answer
146 views

Highlight search phrase within quickfix window listing

One can change the search color of search terms with the Search highlight scheme. Similarly one can change the color of a line in the quickfix window with QuickFixLine. However, how does one change ...
2
votes
1answer
735 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
425 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 ...
2
votes
2answers
166 views

How do I make regexes mutually contain each other?

I've written regexes for markdown for emphasis and bold as follows: syntax match PandocEmphasisMarker "\v(^|\s+)\zs_[^\n\t_ ]+([^_\n]|(\S_\S)|(\s_\S)|(\s+_\s+))+[^\n\t_ ]+_\ze($|\s+)" contains=...
2
votes
3answers
887 views

Color change in the middle of #define [duplicate]

Every time I have a '0' character in a #define preprocessor directive in C, I get a change of color. Neither the font nor color scheme have influence on it. It is starting to annoy me. Does anyone ...
2
votes
1answer
323 views

How to match this syntax group?

I'm trying to improve on the MySQL syntax highlighting, for my particular code base. I have a lot of this sort of thing FROM TBL_ENTITIES E JOIN TBL_RELATED_ENTITIES RE ON RE.entityFK = E....
2
votes
1answer
157 views

How to setup vim-clojure-highlight to work?

I've been trying to setup my Clojure dev environment with Vim, note that I'm still very new to vim but I've managed to know the basics. I've installed pathogen which has helped me get a bunch of ...
2
votes
2answers
75 views

Is there a simple way to remove a single keyword from a syntax group (or otherwise override it in a match)?

I occasionally like to tinker with syntax files (especially conceals; I use λ for anonymous functions (lambda:, fn) in several languages). However, one complaint with conceal is that I can only use a ...
2
votes
2answers
618 views

How to force overwriting ALL syntax highlighting in Vim?

Recently, I have tried to create my own colorscheme in only one color and no text decoration. That means Normal, Comment, ToolbarLine, Tooltip... are the same; Visual, Cursor... are reversed, of ...
2
votes
1answer
37 views

Pattern to match the label of a JavaScript object field when the colon is not followed by another colon or an equal sign

I wrote a syntax highlighting .vim file. One of the expressions is used to color the label in a JavaScript object declaration: name: 'value' ^^^^ I want to see the name in a different color. My ...
2
votes
1answer
450 views

How to know which highlighting group is used for the background of a word?

Vim highlights the background of certain words (e.g. when doing spellchecking) in a way that I would like to change (because the background and the word itself are almost of the same color, which ...
2
votes
1answer
154 views

How to change one syntax behaviour in vim

The shebang line has an annoying background color, how to change it to have the same color of comments. This is a Haskell file.
2
votes
1answer
382 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
1answer
208 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
73 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 ...
2
votes
1answer
402 views

Vim highlights valid shell parameter expansion syntax as an error

#!/bin/bash echo ${2:-"-l -p"} Having some bash parameter-substitution fun and (Neo) Vim complains about it, while the code is perfectly fine. I know I can suppress errors totally by doing sort of ...
2
votes
1answer
103 views

Modify sh.vim to accept (@)_ as part of a variable name for Bash highlighting

I have Bash file in which I have constructs that include (@)_ as part of the variable name. For example: (@)_VariableName ${(@)_VariableName[@]} ${#(@)_VariableName[@]} ${!(@)_VariableName[@]} The ...
2
votes
1answer
76 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: ...
2
votes
1answer
514 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
1answer
59 views

Can't seem to get syntax information when in insert mode

This is for an indent function that should maintain the indentation should the cursor happen to be in a string region. It maintains the indentation when I hit == in normal mode but changes when I open ...
2
votes
1answer
66 views

Highlight word, depending on its prior use in the file

I try to color a word depending on its prior use. For example I have the following text file a : Type1 b : Type2 And now I will take about a and b So Ideally I would like to define Type1 within the ...
2
votes
1answer
48 views

How to disable JSON error highlighting on the current line?

Problem I find the error highlighting really distracting, its not that I don't want it because it is really useful for spotting errors in JSON syntax, but, I really dislike that it highlights new ...
2
votes
1answer
78 views

How does vim “syntax cluster” highlighting work (or why does this “syntax cluster” not work)?

This is a repost from stackoverflow at the suggestion of a user to this vim-specific forum. I am trying to use a vim syntax file for highlighting a PyMOL script file and got into trouble with the &...
2
votes
1answer
51 views

Syntax highlighting rule doesn't work when a another highlight (# comment) exists

I'm trying to create a highlight that changes the text color of a strikethrough syntax, like ~~hello~~ should turn the whole thing gray. Here's what I've put in my vimrc: au BufRead,BufNewFile *.n ...
2
votes
2answers
262 views

Vim syntax partial match

I'm trying to match a new line character on a Vim syntax file, I can make it work when I use the patern within Vim but when I put it in my syntax file it doesn't highlight when I have a new line and ...
2
votes
1answer
72 views

Rules for 2-tier recursive syntaxes

I have matched parentheses, but highlighting failed as it transcends up the recursion stack. I just need to know if there is a solution to tracking pairs of delimiters during Vim highlight syntax of ...
2
votes
1answer
95 views

Why does a custom 'contained' highlight match interfere with the C syntax highlighting?

I am having an issue, which I was able to reduce to the following sequence of commands: setf c syntax region templatyExpression matchgroup=Special start='{{' end='}}' syntax region templatyStatement ...
2
votes
1answer
510 views

Syntax highlighting for objdump output

Currently I am working a lot with objdump output (arm / thumb instructions): The command (arm-none-eabi-objdump -h -S main.elf > main.lst) creates a mixture of assembly (with addresses and hex ...
2
votes
1answer
383 views

I can't escape square brackets for syntax matching

I have the following code in my ini.vim: augroup HiParens autocmd! autocmd Syntax c :syn match Parens /[(){}]/ autocmd Syntax c :syn match Bracks /[\[\]]/ augroup End And highlighting is ...
2
votes
2answers
2k views

How to use different colorscheme and syntax highlighting in vim?

Suppose I want to use this colorscheme: https://github.com/NLKNguyen/papercolor-theme I copied the PaperColor.vim file into .vim/colors and made my .vimrc: syntax on colorscheme PaperColor ...
2
votes
1answer
78 views

Analog of mmm mode

Is there an analog of mmm mode for vim? This would allow me to have syntax highlighting of several modes in the same file.
2
votes
1answer
228 views

Backreference for syntax region

I am trying to improve Vim's syntax highlighting for YAML files. YAML supports long string literals that begin with either a ">" or "|", like this: keyA: > A string literal that spans ...
2
votes
1answer
129 views

How do I change the regex for a single syntax highlighting match?

When I'm writing Latex files in vim, the syntax highlighting recognizes \newcommand as the start of a new command environment, but not \newcommand*. Digging into the syntax file, it seems that to fix ...
2
votes
1answer
639 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 #.*$ ...
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/...
2
votes
1answer
777 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
1k 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 ...
2
votes
2answers
1k 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 ...
2
votes
1answer
773 views

Syntax highlight multiple matches in the same line

I would like to know how to highlight multiple tokens in the same line. For example, if I want to highlight the value of 'a', I can write something like this: syn match num 'a=\zs\d\+\ze,b=\d\+.*' ...
2
votes
1answer
1k views

How to generate a syntax highlighting file for vim from a syntax file for notepad++?

I have to use a very specific software with its own syntax and file format: .htc. I have been supplied a .xml and .lang that can be used for Notepad++ and gedit to support syntax highlighting but no ...
2
votes
2answers
561 views

is there a way to define the syntax highlighting keyword programatically?

I followed the link creating-a-simple-vim-syntax-highlighting, for doing the syntax highlighting for my purpose. This is really nice., but it's static. So, keywords are to be predefined. In a ...
2
votes
1answer
946 views

Syntax highlightning with custom runtime path

A server only has old versions of vim available in the repo, so I compile and run vim from my ~. Starting vim it complains line 2: E484: Can't open file /usr/local/share/vim/syntax/syntax.vim ...
2
votes
2answers
64 views

How to re-indent nginx configuration based only on `{` and `}`?

I want to reindent an nginx configuration file with the following simple rudimentary rules: a { increases indentation a } decreases indentation The idea is cindent is just enough to do it. I have ...
2
votes
2answers
59 views

Syntax region doesn't stop at the correct end marker

I'm trying to set up folding for #pragma region in C/C++, and it kinda works, but I need to edit out #pragma from the cPreProc syntax region, which is definitely not ideal. If I don't edit it out, the ...

1
3 4
5
6 7
12