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.
718
questions
4
votes
1
answer
121
views
Custom syntax file for FIX data doesn't work
I tried to create a custom syntax file to read FIX messages. Note: I am certain my custom files are being loaded by Vim.
The file format is sequences of NUMBER=VALUE pairs separated by the ...
4
votes
1
answer
371
views
How to get highlighting group set by spell check
How do I get the highlighting group of a text when the group is defined by the command :spell?
For example when a word is misspelled I want to get the highlighting group SpellBad.
We have a question ...
4
votes
1
answer
770
views
Different syntax highlighting in the same file for different languages
Is there a way to use more than one syntax highlighting schemes in one file?
Specifically, I'm interested in having part of a LaTeX code highlighted according to my python syntax highlighting rules:...
4
votes
1
answer
2k
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, ...
4
votes
1
answer
2k
views
Syntax highlighting for markdown can't be set manually
If the file is named *.markdown then the highlighting works correctly. If it is named *.md then it doesn't work.
Even if I type :set syntax=markdown, the highlighting doesn't turn on.
With other ...
4
votes
1
answer
1k
views
How to disable semantic highlighting for certain filetypes only?
Using Neovim's native LSP interface, I noticed that semantic highlighting provided by LSP makes things worse for certain languages, so I want to disable it based on filetype.
I know about possibility ...
4
votes
0
answers
41
views
No comment highlighting for long comment at end of file
I made a syntax file with among others a comment region.
It should work like the "c" syntax. Starting with /* and ending with */.
Syntax:
if exists("dbquery_fold")
syn region ...
4
votes
0
answers
44
views
Color filenames according to $LS_COLORS in vim
I'm writing a simple vim syntax file for random note takings for work.
I would like to color filenames according to $LS_COLORS. I can prefix a filename in the notes file with something random, like '·'...
4
votes
0
answers
164
views
How to make certain conceal symbols get highlighted differently than others?
I’ve recently tried to make my python more readable using the conceal functionality. So now I went from this
to this .
Now what really bugs me here is that ƒ, ¶,the ¥ sign, the ℤ and 𝕊 symbols and ...
4
votes
0
answers
33
views
`local foo=\'` script syntax highlighting error? (slash tick)
Opening vi on a script file containing local varname=\' or local varname=$' seems to mess up the highlighting colors following the tick. Is there a way to avoid this?
Here is a simplified example ...
4
votes
1
answer
262
views
Retrieve the match id under the cursor, in all cases
How can I retrieve the syntax id under the cursor, in all cases?
Indeed, the synID() function doesn't take into account highlightings due to the :match* commands or the matchadd() function.
Example, ...
4
votes
0
answers
434
views
Nested syntax folding
Assume I have a syntax as exemplified below and that I want to create a syntax folding definition for the nested begin..end pairs.
begin : label
a = 0;
begin
b = 1;
end
c = 2;
begin
...
4
votes
0
answers
1k
views
Syntax highlight single - quote parameter
Makefiles can have commands such as:
BAR = $(subst ', '\'', $(FOO))
Here the first argument to subst is a single single quote resulting in for example:
FOO = some ' single ' quotes
BAR = $(subst ', ...
4
votes
0
answers
659
views
Highlight python raw strings as regular expression
I heard someone had set up their editor to highlight python raw strings as regular expressions, e.g. for Django:
urls(r'^site1/(\d)*/new$'', ...)
Unfortunately my googleing doesn't get me anything. ...
3
votes
3
answers
1k
views
Is there a way to dump syntax highlighting to a .vim file?
If I set syntax highlighting rules manually (not in a file), is there a way to save them out to a file? Specifically, the goal is to source this file to restore the syntax highlighting rules later on.
3
votes
2
answers
11k
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 ...
3
votes
3
answers
6k
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 ...
3
votes
1
answer
2k
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.
...
3
votes
1
answer
571
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 ...
3
votes
2
answers
1k
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.
3
votes
2
answers
1k
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
1
answer
102
views
Do not red underline unicode control points as misspelled words
Vim highlights Unicode control points as misspelled words. So correctly spelled words with Unicode strikethrough (overline, ...) always appear misspelled. Ideally this would be corrected as a setting ...
3
votes
2
answers
163
views
Load syntax highlighting when neovim starts
I got:
set shada=!,'100,<50,s10,h,f1,s100,%
Which make Vim reload last buffers when I exit (or :wshada was called ) .
However, the buffers are loaded without syntax and highlighting. I need to ...
3
votes
1
answer
138
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 ...
3
votes
1
answer
370
views
Efficient Syntax Highlighting
I am using VIM as a note taking application and have created syntax highlighting to assist with readability.
See below or the repo for all the files.
syntax match Timestamp /^\d\d:\d\d \d\d[/]\d\d[/]...
3
votes
2
answers
1k
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 ...
3
votes
1
answer
1k
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 ...
3
votes
1
answer
879
views
Aditional SQLite syntax highlighting in Vim
Currently I'm editing some SQLite scripts with my filetype set to ft=sql and some types aren't being highlighted and :
REAL
TEXT
There is some configuration that I'm missing ? I've searched for a ...
3
votes
2
answers
1k
views
Highlight Markdown indented code
When writing Markdown, fenced code written between triple backticks is highlighted, but not code in indented blocks (I don't care about language specific highlighting). How can I get vim to recognize ...
3
votes
1
answer
386
views
Stop vim from highlighting "note" in yellow inside SQL comments
I am using vim under Ubuntu under the windows WLS. When I edit SQL files, only inside comments - the word "note" is always highlighted with a background yellow color. This includes, for ...
3
votes
1
answer
381
views
Syntax highlight groups of digits in large number
I often view logs in vim, and the log contains large numbers eg 3244522321. It's very difficult to tell if this is 324M, 32M, or 3.2M.
Is there a way to set up something (syntax highlight?) that will ...
3
votes
2
answers
175
views
What exactly do patch 8.2.1693 and patch 8.2.1703 do to syntax highlighting?
It is fairly well known that syntax highlighting in vim breaks when one changes colorschemes frequently. This is due to peculiarities of hi def/hi clear.
Recently, the following changes were made:
...
3
votes
1
answer
305
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 ...
3
votes
1
answer
199
views
Syntax region only if at top of file
I have a syntax I'm trying do make. It's yaml embedded in markdown for use with Hugo. The yaml region is enclosed by --- and this must be at the top of the file.
---
[yaml front matter stuff]
.
.
.
--...
3
votes
1
answer
1k
views
Syntax-highlighting is getting screwed when loading long markdown files on Windows
Note: this may be a Windows-only problem. The symptom has been reproduced on multiple Windows 10 machines.
I find my syntax-highlighting for Markdown files (ending in .md) will fail to rander when ...
3
votes
1
answer
257
views
Avoid highlighting defined by 'matchadd' in comments
I want the piece of text std::string to be highlighted in vim according to the style defined in 'Type'. I can do that with
:call matchadd('Type','std::string')
It works. However, std::string is also ...
3
votes
2
answers
1k
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
1
answer
738
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 ...
3
votes
1
answer
328
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 mostly ...
3
votes
1
answer
1k
views
Create highlight group that modifies an existing one
I would like to create a new highlighting group that is exactly like an existing one except for one (or more) properties. For example, the new group could be an underlined version of the existing one.
...
3
votes
1
answer
207
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 ...
3
votes
1
answer
881
views
Syntax highlighting region messed up by matching parentheses
For a new filetype, I was trying to make block comments in the syntax highlighting but they kept disappearing while I was moving around. I have managed to reduce it to the following. First, in the ...
3
votes
1
answer
75
views
Invalid syntax for a bash file called catalog
I have a file written in bash (with the she-bang) and called "catalog", and the syntax highlighting is incorrect. If I rename the file, the colors become correct.
I have not configured anything in ...
3
votes
1
answer
3k
views
Why doesn't undercurl use underline in my terminal?
:help undercurl states:
"undercurl" is a curly underline. When "undercurl" is not possible then "underline" is used. In general "undercurl" and "strikethrough" is only available in the GUI.
But if ...
3
votes
1
answer
201
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 ...
3
votes
1
answer
778
views
neovim takes a long time to open files
On profiling, I found that <SNR>101_parse_screen() is taking above 6 seconds. This problem goes away when I comment out the plugin vim-polyglot.
This is most evident for vue files. Not sure if ...
3
votes
1
answer
722
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:...
3
votes
1
answer
163
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 |...
3
votes
1
answer
452
views
Highlight multiple matches without removing previous context
Suppose I want to make a syntax highlighting script to work with files with the following hypothetical format:
blah # blahA1B2 bla
asdf A11B453 # qwert
aaa A0B0 bbb @
That is, lines with arbitrary ...