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
22 views

Simplest way to add in a syntax rule

I would like to add in the following rule to my syntax to help with python files: :syn match pythonBoolean "\<self\ze\." :hi pythonBoolean cterm=bold It works when I type it in directly to the ...
0
votes
0answers
14 views

Stylizing a string that contains a regular expression

In textmate (and I assume every other editor), it has a nice feature where it colorizes a regular expression inside a string (r-string in python). For example here is how it looks in Texmate: Is ...
0
votes
1answer
24 views

Set color of Comment only using .vimrc

I am using some preset colorthemes, but it seems that the types Identifier and Comment always use the same color -- which makes my .asm files basically just one color. I tried to change the color of ...
2
votes
0answers
22 views

Concealing \begin and \end lines in latex with MathZone

I'm trying to get the lines that have \begin{equation} and \end{equation} to be concealed. I've tried using call matchadd('Conceal','\\begin{equation\*}', 10,13,{'conceal':' '}) and it works, but it ...
2
votes
1answer
79 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
0answers
22 views

Is there a way to get improved MySQL syntax highlighting over what vim offers out of the box?

Having spent a bit of time sorting out my colorscheme for my php files, I'd now like to "prettify" my sql. (I blame lockdown). My sql is spread liberally through my php files, but I've noticed the ...
5
votes
3answers
847 views

Improve performance of syntax highlighting in Vim

I have some C++ sources files which are in a few mega-bytes (a few tens thousands lines) to view and edit. The performance looks really bad in Vim. Refersh (<C-l>) or input single char in insert ...
2
votes
0answers
37 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
49 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 ...
1
vote
2answers
118 views

How to avoid “Avoid E173 (n more file(s) to edit)?”

So, when I open multiple files, but don't visit the all of them (or the last one), and I try to :quit neovim yells at me that I have to edit those files. No I don't! Stop giving me this error : ) It ...
3
votes
0answers
37 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 ...
1
vote
1answer
20 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 ...
2
votes
1answer
41 views

How can I change the syntax highlighting for currently highlighted search item?

When I search for something with / I get a series of finds, and as I press n for next, it highlights the next one. I always think I'm on the wrong one. Maybe my eyes see green and red, and they think ...
1
vote
1answer
43 views

Concealing the code for `braket` package for LaTeX with vimtex + `tex-conceal`

I am using vimtex with latexmk and using conceal setting provided by vim and extending it with an additional plug-in : KeitaNakamura/tex-conceal.vim. Additionally, I use a package braket to encode \...
0
votes
0answers
33 views

Only default syntax highlighting works

I'm using nVim v0.4.3 I can't seem to get anything but the default syntax highlighting working. (I'm especially trying to get yats typescript syntax highlighting working) I've tried disabling every ...
0
votes
1answer
112 views

Fold: Different highlight style for fold of each filetype

Extend of this question of fold: Fold: foldtext() for each filetype We have fold for each filetype now but each fold need different highlight style of color, because highlight is global I tried to ...
5
votes
1answer
270 views

Interactive syntax-highligting: highlight the current region only

Often enough a text file is structured as a collection of blocks or cells of some kind. E.g., slides in a Tex Beamer presentation, bibtex items, function definitions, etc. I wonder if vim can ...
1
vote
1answer
22 views

Syntax highlighting for fish script not working

I have both Vim version 8.1.1550 and NVIM v0.4.3 on MacOS 10.14.6 I wrote the following lines in my .vimrc file as recommended enter link description here set nocompatible filetype off set rtp+=~/....
17
votes
4answers
7k 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
31 views

Any reason why one should avoid to force the linking of highlight groups in syntax files?

tl;dr Are there any undesirable side-effects connected to the use of :highlight! default link {from-group} {to-group} as compared to :highlight default … that I should be aware of when editing/...
0
votes
1answer
87 views

Installing a Vim package. syntax highlighting does not turn on

I want to use the nuweb.vim extension for syntax highlighting nuweb files. Long story short, nuweb files are basically a super-set of latex files. There is added syntax and markers to embed code-...
0
votes
1answer
36 views

List of Vimscript comment keyword highlights

While editing my vimrc I noticed that some keywords get highlighted at the beginning of lines, like Note: and Reminder:. I tried to find this syntax group in the vim.vim syntax file, but to no avail. ...
2
votes
0answers
23 views
1
vote
1answer
27 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 ...
1
vote
1answer
35 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
328 views

ruby syntax highlighting lost on long files

With a "long" ruby file (896 lines in my case) the ruby syntax highlighting is lost when I G to the bottom of the file. Once that happens and I go back to the top with gg, the syntax highlighting ...
5
votes
1answer
317 views

How to make a syntax region stop on empty lines?

I would like to adapt this syntax file so that the formatting in VIM matches more closely what this online Markdown editor (GitLab-flavor) displays (the output on the right is relevant, this is how I ...
1
vote
1answer
22 views

Highlight region with keyword in it

I have this file Another comment program start end This is a comment Anything after end or before program must be highlighted as a Comment. I've battled with vim for hours, what am I doing wrong? ...
7
votes
2answers
1k views

Syntax highlighting is gone after :bufdo :e

I'm using console vim within a tmux window, therefore occasionally vim doesn't recognize that files have been modified (gvim does it on a focus change AFAIK) and in order to avoid getting inconsistent ...
0
votes
1answer
34 views

syntax match: redundant end of line marker “$”

I am looking to create a new syntax. This is what I have so far: syntax match jl_comment "^# .*" but I have noticed other examples using pattern like this: "^# .*$" Example: https://github.com/...
0
votes
0answers
71 views

ALE for golang-syntax checking is not working

I'm trying to build an environment for my vim to code golang. I've installed the Golang with the version 1.14 in the path of /usr/local/go. Also, I installed the vim-plugin ALE and vim-go. Here is ...
0
votes
0answers
60 views

vim 8: C++ syntax highlighting has some minor fault

I'm using vim 8 to code C++11. I've installed the vim plugins: YCM, ALE, vim-code-dark and vim-cpp-enhanced-highlight, however, it seems that there is some error on syntax highlighting. As you see, ...
1
vote
2answers
52 views

Match and highlight urls

I'm trying to make it so urls are highlighted and a shortcut can be used when the cursor is on top of one to open it in browser. Added this to a syntax file: syn match matchURL '/http[s]\?:\/\/[[:...
0
votes
0answers
103 views

Trouble sourcing YAML syntax highlighting

I'm doing some Ansible work (on RHEL 8), so I want the YAML configs for vim. I have a yaml.vim file containing the syntax/etc, and a ~/.vimrc file: autocmd BufNewFile,BufRead *.yaml,*.yml so ~/.vim/...
18
votes
5answers
5k 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) ...
1
vote
1answer
145 views

How to use code highlighting and checking in markdown?

In writing markdown files, I may use code blocks with ``` and `. Is there a way I can use code highlighting and checking on just the code blocks inside markdown files?
0
votes
1answer
123 views

Vim syntax line matching mechanism

Can someone explain or link to valid explanation information on the syntax highlighting mechanism. In particular I am having having a hard time understanding how rules are applied. Imagine the ...
1
vote
2answers
69 views

Regex missing matching words

I am trying to add some custom highlighting to my Vim. But my regex matching is not working correctly. let ignoreHiInComments = '^\s*\(\/\/.*\)\@<!' "Ignore highlighting in C++ comments call ...
1
vote
1answer
30 views

How to get syntax highlighting for the embeded python within vimscript?

As title, how to get syntax highlighting for the embeded python within vimscript? Is there a plugin that does syntax highlighting for embeded script?
1
vote
2answers
84 views

why wont vi recognize html?

I recently launched a RHEL instance on an EC2 container. I got the apache web server to launch, now I'm trying to write some html in /var/www/html to get my website going. I open index.html in vi , ...
3
votes
0answers
45 views

How can I test and debug my syntax files?

I'm trying to make a syntax file for Raku. The major challenge I'm running into is that I have no automated means to test that my highlighting works as expected. I have to keep another tab open, ...
2
votes
0answers
63 views

Can't use special characters in listchars even if setting scriptencoding to utf-8

Here is my .vimrc file: set encoding=utf-8 scriptencoding utf-8 set list set listchars=tab:→· When I open vim, it will show an error message E474: Invalid argument: listchars=tab:→· My vim is Vi ...
4
votes
0answers
27 views

Is it possible to use syn match dynamically

I know that syn match can work with the regular expression to do some custom highlight settings. I'm thinking if it can work dynamically. For example, I'm doing a c++ project and I want to highlight ...
1
vote
1answer
54 views

Comment highlight group does not work without reloading .vimrc

The following line in my ~/.vimrc: hi Comment ctermfg=gray does not take effect unless I start Vim and then use :source to reload .vimrc. As far as I can tell, all of the other hi commands work ...
3
votes
2answers
556 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
133 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 ...
2
votes
1answer
73 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 ...
3
votes
1answer
73 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. ...
32
votes
3answers
9k views

Can Vim interpret terminal color escape codes?

Many CLI programs output nicely-highlighted text. While most of them check if the output is going to a file, some include the terminal escape codes. I like the output with the escape codes, but ...
2
votes
1answer
121 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] . . . --...

1
2 3 4 5
9