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
5
votes
1answer
220 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 ...
0
votes
0answers
28 views

Vim showing a python2 error when writing in python3

Vim shows an error on line 4 of the picture below, which in python 2 is actually an error but not in python 3 which I have check by running it. How do I tell vim I am writing in python 3 to avoid it ...
1
vote
2answers
57 views

vim highlighting doesn't set the right type for a new filetype

This is what I have in my /usr/share/vim/vim80/filetype.vim (the only mention of messages in the file) : " Messages (logs mostly) au BufNewFile,BufRead */logs/couchdb/{,.log}{,.[0-9]*,-[0-9]*} setf ...
1
vote
2answers
86 views

How to set LaTeX syntax to “ConTeXt” in vimrc

TL;DR: How do I permanently and persistently :set syntax=context for *.tex files? I've been using vim for a LaTeX project, with monokai-tasty as the colour scheme. The default syntax highlighting ...
4
votes
1answer
82 views

Vim highlighting random indentations

As seen from the image, Vim decides to highlight those indentations for no reason. I've tried :noh and :set nolist (:set list seems to make it go away, but I don't want indentation marks) from a ...
1
vote
1answer
36 views

Highlight setext-style (asciidoctor/markdown) headers

Following naive snippet highlights such headers: syn match asciidoctorH1 "^\_s*\n\a.*\n====*" syn match asciidoctorH2 "^\_s*\n\a.*\n----*" hi link asciidoctorH1 Title hi link asciidoctorH2 Title ...
54
votes
4answers
14k views

List known filetypes

How can I get a list of the names of filetypes that vim currently knows about? I want to be able to do this so that when vim doesn't automatically detect a filetype I can try some of the filetypes ...
0
votes
0answers
10 views

In GVim, preven ALE from changing syntax color, but still underlines errors

I am using gVim and Asynchronous Lint Engine (ALE) for linting Python scripts. I was capable to fully customize my own Python syntax highlighting, with one exception. I can't find a way to prevent ...
0
votes
1answer
88 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
1answer
21 views

Highlighting comments to EOL (terminal EOL, not buffer EOL)

One of my filetypes has a special comment format that has a background color, and it would be useful if I could extend the highlighting to extend that background to the terminal width, rather than ...
1
vote
2answers
75 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

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:...
1
vote
2answers
156 views

Change background color of git conflict marker sections

If git is performing a 3-way merge and has a conflict it can't resolve, it marks up that area of the file like this: No unresolvable conflicts here <<<<<<< HEAD xyz ||||||| ...
2
votes
1answer
110 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 ...
2
votes
0answers
29 views

How to fix this `Omni completion (^O^N^P) Pattern not found` error?

I am trying to set up syntax keyword based omnicompletion in vim. I have defined a few syntax keyword Constants in ~/.config/nvim/syntax/spl.vim They are correctly detected and highlighted. They are ...
1
vote
0answers
28 views

vim doesn't load syntax for a single file

I was toying around with my .vimrc editing it, and then checking in another file whether my changes worked or not. But now I ended up in a state where opening one file with vim file1.tex (this was ...
5
votes
2answers
760 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 ...
1
vote
0answers
32 views

How to make code-folding more efficient

I have a ruby file while is about 5K+ lines long. My current setup uses the vim-ruby plugin. With this, I enable code folding with let ruby_fold = 1 This opens my ruby files pre-folded. I can open ...
0
votes
0answers
22 views

Getting conflict when setting ft=txtfmt

I installed The Vim Highlighter plugin by Brett Stahlman. The plugin requires setting filetype=txtfmt. I set the option using :set ft=txtfmt but got conflicts like Level 1 map ambiguity:[bf already ...
2
votes
1answer
203 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[/]...
0
votes
0answers
29 views

Neovim highlight syntax region inside typescript tagged template literal

I am having trouble fixing a syntax plugin for Vim. I've found a bug in a plugin that has not been touched in a fair amount of time. I want to address it myself but I believe I am lacking in a lot of ...
2
votes
1answer
432 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 ...
2
votes
1answer
78 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
0answers
27 views

How to set syntax keywords dynamically

I'm trying to highlight the keywords for my c++ project. So what I've done is to create a file here: ~/.vim/after/syntax/cpp.vim and put some custom configuration into it. For example, putting the ...
1
vote
2answers
151 views

How to highlight class name of c++

I'm trying to configure the highlight to highlight keywords of my C++ project. Here is the content of ~/.vim/syntax/cpp.vim: syn match cCustomParen "?=(" contains=cParen,cCppParen syn match ...
1
vote
2answers
56 views

Toggle between two most recent syntax highlighting settings

I often nest one programming language within another (e.g. HTML inside python). This can be done per-language, and written items in ~/.vim/after/syntax/ for that purpose, but I don't have the patience ...
2
votes
2answers
551 views

How to set a colorscheme that still shows spelling errors?

How to set a colorscheme that still shows spelling errors? I am looking for two combined effects that I can acquire separately but not yet together. Set Colorscheme alone: OK. If I want highlights ...
2
votes
2answers
62 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, ...
1
vote
0answers
39 views

vim syntax highlight [closed]

Syntax highlighting just stopped working on my mac (v 10.14.6). I've been trying to get it back over the past 2 days with no success. I have neovim (v 0.3.8) and when I use :syntax, the command line ...
1
vote
0answers
41 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. ...
0
votes
1answer
74 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
247 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 ...
3
votes
1answer
82 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 ...
0
votes
1answer
75 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
130 views

Syntax folder under plugin/foo/syntax/foo.vim not automatically applied when filetype change?

I have a plugin under nvim/plugin/foo, but the syntax file nvim/plugin/foo/syntax/foo.vim is not automatically applied when the filetype change, but if I put it under nvim/syntax/foo.vim it works I'...
19
votes
6answers
4k views

Set cursor colour different when on a highlighted word

With the current colourscheme I have been using, it is hard to find where the cursor is positioned when navigating through search results. The highlighting colour and the cursor colour are blending in ...
2
votes
1answer
299 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 ...
17
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
45 views

How to make vim syntax files look nice? [duplicate]

I often get really long lines, such as: syntax region SomeName start=/some_pattern/ end=/some other pattern/ contained contains=SomeOtherName,YetAnotherName,EvenMoreNames,More,MoreAgain,KeepsGoing,...
2
votes
1answer
33 views

Vim syntax match changes based on function type name keyword

I've written a C code syntax rule to highlight function names in function definitions as such: This is the syntax rule written in ~/.vim/syntax/c.vim: syntax match cCustomFunc /\w\+\s\+\zs\w\+(/he=e-...
1
vote
1answer
20 views

Mapping between Vim syntax highlighting and Emacs font-lock [duplicate]

I try to harmonize the colors of my Vim and Emacs. But I am not sure how to map some Emacs faces to Vim. Emacs distinguishes between keyword and builtin. In shell mode if and case are of the type ...
3
votes
1answer
112 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 ...
1
vote
2answers
92 views

Linking a filetype to a syntax file of a different name

I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want ...
2
votes
1answer
64 views

How to prevent vim from highlighting random words and types

I've been trying to disable vim from highlighting random words and types for a few hours now. I've noticed vim will highlight specific types when I write python and golang programmes. Even my .vimrc ...
30
votes
2answers
7k 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
0answers
34 views

head isn't included in syntax/sh.vim

head is a common Unix/Linux executable, but it's not listed in the shell syntax highlighting configuration. In contrast, many common executables are. Specifically, its counterpart, tail, is listed. ...
1
vote
2answers
34 views

Can I use syntax highlighting on an unwritten buffer?

I pasted some code into a new, unwritten buffer in Vim. I'd like to do some quick edits on the code without saving it to a file, but it hurts my eyes to look at code without syntax highlighting. Can ...
0
votes
1answer
54 views

How to disable margin (+/!)?

Currently I installed vim addons for python. http://fisadev.github.io/fisa-vim-config/ However, I don't like the +/-/! on the margin. Does anyone know how to disable all of them? Thanks,
0
votes
2answers
36 views

Fade Rows Far From Center

I am currently using a vertical monitor for my vim setup. I absolutely love being able to view 100+ lines of code at once. My eyes can scan longer and more complicated blocks of code. However, I have ...
16
votes
3answers
7k views

No syntax highlighting in tmux

I installed tmux in iTerm 2.(Build 3.0.13) When I execute vim in tmux, syntax highlighting looks like this. But outside tmux, syntax highlighting looks fine. My $TERM inside and outside tmux is ...