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
0
votes
1answer
40 views

How do I stop vim from higlighting uncessary words in PHP

I have this issue with my vim setup, where some words get highlighted unnecessarily. The image below shows an example. The words not and to where highlighted but there's no reason for them to be. How ...
4
votes
1answer
2k 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:...
4
votes
0answers
57 views

How can I make syntax highlighting files more readable and maintainable?

Vim uses regular expressions for syntax highlighting. Often maintaining these can become rather unwieldy. For example: syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&...
3
votes
1answer
801 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. ...
0
votes
1answer
43 views

Isolate a matched virtual column ruler to the cursorline only?

I'd like to add ruler marks/virtual columns along the lines of matchadd('ColorColumn', '\%81v', 100) while restricting their display to the cursorline. Any ideas ?
7
votes
1answer
2k views

Highlight whole todo comment line

I'm still learning Vim and making small customizing on it. I'm struggling a bit to create a custom style/syntax highlight which would highlight the whole todo line. So in the picture instead of having ...
0
votes
1answer
487 views

concealing the start and end pattern in syntax region

I'm trying to learn multi line highlighting and have managed to get the following working syntax region myMinusStart start=/^\s\+zzzz / end=/^\s\+qqqq / concealends But the concealends is not hiding ...
6
votes
1answer
2k views

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 ...
0
votes
1answer
175 views

Is there a way to use cpp.doxygen syntax file and my own cpp.vim syntax file?

At the bottom of my file, I'd to have something like this: // vim: syntax=cpp.doxygen Only, when I do that, it breaks my auto-load of my own cpp.vim. au BufNewFile,BufReadPost *.cpp so $...
2
votes
1answer
185 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
82 views

Use blank line as end for one region and as start of another

I want to syntax highlight a header region in custom style and a body region with the existing markdown style: Title: Test Note Id: 147648d8-8680-4847-8f50-dd4a67f870b5 Created-At: 2018-02-26 22:44:...
2
votes
1answer
93 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 ...
1
vote
2answers
72 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 ...
0
votes
1answer
85 views

How to affect the syntax highliting filetype from local vimrc?

I am editing a source code in language1. It doesn't have a built-in syntax highliting configuration into my vim. However, its syntax is very similar to language2, which has. I think, syntax ...
0
votes
1answer
436 views

Cursorline/Columnline slowdown

I have recently recompiled vim, and ever since, when I have a big file, the scrolling gets slow. cursorline seems to be the problem; it doesn't matter if I use any of my plugins, if I have cursorline ...
1
vote
1answer
531 views

Strange Highlighting during Git Commit

What can I do to have proper highlighting on a .git file? I chose Vim as my default editor when I commit files, the color scheme(Gruvbox) is applied, but I get strange colors as I start typing. I ...
0
votes
1answer
557 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 ...
0
votes
1answer
332 views

How to only load a certain syntax file

Okay, so I have a syntax file asciidoc.vim in ~/.vim/syntax and this file is actually loaded, as I checked with scriptnames. But for some reason, it only works, if the builtin syntax files haven't ...
2
votes
1answer
232 views

Inverted syntax highlighting of multiline strings in Python

I'm editing a ~1000 line Python file containing long docstrings. Occasionally, when I'm in editing the middle of a file, the syntax highlighting will 'invert' so that everything outside the docstrings ...
0
votes
1answer
100 views

Vim highlights word “mktemp” in Bash script

I'm programming Bash scripts using Vim in Ubuntu 16.04 (on Windows Subsystem for Linux). The filename ends in .sh and the first line of the file is #!/bin/bash When I wrote this command rm -rf /...
1
vote
1answer
37 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
341 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 -- ...
1
vote
1answer
708 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
1answer
380 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 ...
1
vote
0answers
31 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 ...
3
votes
1answer
496 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 ...
1
vote
1answer
209 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, ...
4
votes
2answers
963 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 ...
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
7
votes
0answers
100 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, ...
16
votes
1answer
401 views

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 ...
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
726 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 ...
1
vote
2answers
450 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,...
3
votes
2answers
2k views

Reloading syntax file without restarting vim

I've tried every tip I can find on this and none of them work. I've cleared my .vimrc file. I have a syntax script in ./vim/syntax/test.vim. It consists of nothing but this: highlight clear syn ...
0
votes
1answer
595 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), ...
0
votes
1answer
36 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
36 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 ...
21
votes
0answers
545 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
173 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
73 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
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/...
12
votes
1answer
712 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 ...
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
122 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 ...
20
votes
1answer
533 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 ...
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
35 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
330 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 ...

1
3 4
5
6 7
9