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

Why does modifying the `Normal` highlight group affect syntax not belonging to the highlight group?

Im running terminal vim, and when a syntax highlighted file is loaded and I have a colorscheme active and I run this command :hi Normal ctermbg=2 ctermfg=0 ALL text in the window changes, not just ...
3
votes
1answer
143 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
1answer
398 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 ...
3
votes
1answer
157 views

First new line in multi-line vim commands has broken highlighting

In my init.vim I have the following command: nnoremap <Leader>s :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") \ . "> fg<&...
3
votes
1answer
176 views

Are opening and closing double quotes expected to be of different color in a bash script?

I've just noticed, after years using Vim, that the two double quote characters opening and closing a string in a bash script have different colors, which I can verify by simply writing var="var&...
3
votes
2answers
950 views

vim hangs when I open a typescript file

I have a vim 8.2 on a Gentoo Linux running on a more or less 8 years old PC. I almost never have a performance issue with vim, unless you open a one-line huge xml oder json file, but those are vary ...
3
votes
1answer
243 views

Can't get textwidth for syntax highlighting working

I have a bunch of (spagetti) fortran code that is in fixed form, but without the line length restrictions. As such, it gets some odd highlighting: I've tried 3 different ways to get it to highlight ...
3
votes
1answer
500 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
1answer
366 views

How to stylize text between backticks ( ` ) to match text style between single/double quotes ( ' | " )?

In my vim, I'm using gruvbox. Syntax colorization is great for everything except text written between `backticks`. You'll note once backticks are used, all subsequent lines of text are green. I would ...
3
votes
1answer
1k views

Make Vim stop highlighting certain underscores in my Markdown as errors

I'm using Kramdown-flavored Markdown in several of my Jekyll websites. Vim highlights all the underscores in those documents as errors, coloring them (in my color scheme) with bright red backgrounds. ...
3
votes
1answer
250 views

define two syntax regions with same pattern

I try to extend the cmake syntax highlighting by our in-house cmake functions. For this I drafted a file to be saved in ~/.vim/after/syntax/cmake.vim, such that one extends the default cmake syntax ...
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 ...
3
votes
1answer
2k 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 ...
3
votes
1answer
550 views

Syntax concealends not applied

I am developing a syntax file and I am struggling with a concealends property : syntax region Reference start="{reference}" end="{/reference}" conceal syntax region Name start="{name}" end="{/name}" ...
3
votes
1answer
59 views

Match by syntax highlighting instead of expressions

I want to delete all the comments from a program. Vim already knows (in some sense) where all the comments are because it is correctly formatting them based on the syntax file the particular language ...
3
votes
1answer
1k views

How can I get syntax highlighting to support multiline JavaScript strings?

Currently I have JavaScript (.js) files that contain multiline strings. Vim's syntax highlighting does not seem to support these, as seen in the image below: Anything below the first line is not ...
3
votes
1answer
225 views

Unwanted highlights on page scroll

I have a pretty similar problem as in this issue with some exceptions. Basically, after I scroll page down or up Ctrl+d / Ctrl+u all non-empty lines get highlight from the end of the line to the ...
3
votes
1answer
104 views

Vim thinks Python @ operator is decorator

Python3 has the matrix multiplication operator (@) which is used to multiply numpy matrices. But when we write something like A = B @ C in vim, the @ C portion gets highlighted. Apparently Python has ...
3
votes
1answer
623 views

How to match paragraphs of text ending with a character?

This problem that seems trivial is beating me real hard. I'm trying to create a couple of syntax highlighting directives for a custom language that is structured in paragraphs separated by at least ...
3
votes
1answer
270 views

Syntax highlight rule for a block comment using indentation

I have the following code and I want to define a syntax highlight rule that will show all lines as commented out starting at the line with ## till the indentation ends just before the last print line. ...
3
votes
1answer
358 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:...
3
votes
1answer
153 views

How would one change the spell-checking style while preserving highlight color?

Currently when working with vim's spellcheck a word is highlighted a certain color based on the type of error it is. Instead of highlighting the erroneous word I'd like it to be underlined with the ...
3
votes
1answer
613 views

How can I highlight only the identifier of a function in Java?

I found this question on SO but it is not adequately answered there. I thought that re-posting it here would bring it to the attention of people with more specialized knowledge who can answer it ...
3
votes
1answer
157 views

Shortcut to remove orphaned parenthesis

While writing code it often happens that adding one parenthesis leaves another one orphaned somewhere. Many syntax color scheme color the parenthesis differently to signal it. For example, while ...
3
votes
2answers
719 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 ...
3
votes
1answer
885 views

How to highlight windows end of line characters aka ^M, \r\n?

I would like to set a different highlighting for windows EOL characters. I have tried several approaches and some of them worked when I did : so $MYVIMRC, which is pretty strange, because after I ...
3
votes
1answer
96 views

How to re-enable syntax highlighting in Vim?

Vim language highlighting has quit working only for one specific file. I've been using Vim in WSL (Ubuntu) for several months now without problems. My PC is Windows 10 Professional. Strangely, Vim is ...
3
votes
0answers
26 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 ...
3
votes
0answers
84 views

Syntax highlighting shows a yellow bar on Windows 10

Good afternoon, I just started using the Ubuntu shell from Windows 10, and I copied my Mac .vimrc file. Everything seemed normal until these yellow bars started showing up at the end of some lines. ...
3
votes
1answer
218 views

How can I change Javascript syntax to higlight objects?

I am trying to emulate the Atom JavaScript syntax highlighting in vim, but there are a few things missing. Namely, I'd like to highlight objects and their chains in red. It'd be dandy if I could ...
3
votes
0answers
88 views

Can I change the highlight of specific conceals?

I'm using :syn-cchar to replace certain syntactic elements with Unicode characters (à la vim-haskellConcealPlus). Since I'm replacing several different elements, I'd like to be able to highlight some ...
3
votes
0answers
648 views

Prevent fold background color to override gutter

Here's what my colorscheme looks like: But when there are folds, it looks ugly like this: The fold background overrides the "gutter" color, but I would like the gutter to remain gray. Is there any ...
3
votes
0answers
520 views

Syntax highlighting: what is the difference between :syntax match and :match?

Simple question -- what is the difference between the two? When I try, for example, to highlight characters on every line after the 80th with highlight link OverLength Error (OverLength being an ...
3
votes
0answers
161 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 ...
3
votes
0answers
657 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) # ... ...
3
votes
0answers
857 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 ', ...
3
votes
0answers
579 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
0answers
108 views

Can't seem to syntax-highlight a pattern beginning with a tab [closed]

I have a file with two columns, separated by a tab, and would like to match any part of the second column that begins with an asterisk. For example: RAFP rasp ET *ratchet then *...
3
votes
2answers
472 views

Highlight longest common subsequence between two files? line by line

I'm asking about some sort of specialized diff highlighting mode. I need to diff, line by line, files A and B, which look similar to this in vimdiff: A B repo/manipulate_1....
2
votes
3answers
5k 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 ...
2
votes
2answers
8k 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 ...
2
votes
2answers
651 views

I have a something in my vimrc to match text over 80 characters as an error. It only works in the right most split. Any ideas?

From my .vimrc: match ErrorMsg '\%>80v.\+' And a screenshot: I have tried a minimal vimrc and it still doesn't work in the left splits.
2
votes
2answers
5k views

Syntax highlighting for “C like” files [duplicate]

I have a number of files with a syntax almost identical to C, though the files have suffixes such as .t, .sc I would like to have the same syntax highlighting that I have for standard C files ending ...
2
votes
2answers
851 views

Toggle bold highlighting for comments in term/GUI

Currently, I use this: map <F7> <Esc>:if has("gui_running")<Bar>hi comment gui=bold<Bar>else<Bar>hi comment cterm=bold<Bar>endif<LF> It turns comments bold ...
2
votes
2answers
356 views

Shell syntax highlighting

I've noticed in bash/shell it highlights $(...) in red, for example: However, if I change the syntax from ft=sh to ft=bash, it does not do this: What's the reason for this? Am I doing something ...
2
votes
2answers
123 views

`.vimrc` unsuccessful in setting highlight style

1) To underline misspelled words, I can execute the following in an open buffer: :hi clear SpellBad :hi SpellBad cterm=underline :set spell 2) However, if I write in my .vimrc the first two lines, ...
2
votes
1answer
285 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 ...
2
votes
1answer
2k views

How do I make vim highlight unused variables

I want vim to tell me (only when I ask it to) if there are variables not used in the current file. Is this possible given that for now I need it in my javascript/php projects?

1 2 3
4
5
12