The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1
vote
0answers
19 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
18 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
175 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
21 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
46 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
25 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
41 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
53 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 ...
1
vote
0answers
37 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
37 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. ...
2
votes
1answer
58 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 ...
2
votes
0answers
20 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
1answer
40 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
29 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
18 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
56 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
79 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
33 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 ...
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
1answer
64 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 ...
1
vote
2answers
30 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 ...
2
votes
2answers
58 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, ...
0
votes
1answer
46 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
32 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 ...
2
votes
1answer
94 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 ...
0
votes
0answers
23 views

Remove costum commands from vim-spell

I recently tryed following the answer to this question: vim-spell: exclude custom LaTeX commands. To remove spelling from the inside of certain commands, I ended up adding the following to after/...
1
vote
1answer
53 views

Python semantic linting [closed]

I'm currently using ALE (recently upgraded to this from syntastic) and YCM for code completion, highlighting syntax errors on-the-fly (rather than just at save time, like with syntastic), and it's ...
0
votes
1answer
26 views

How to edit the highlighting of the function names in c++ syntax

I want to change the highlighting of the function names inside a c++ file, here is an example As you can see in the previous picture functions names have their own color, parser(), parse(), ...
1
vote
1answer
168 views

vim python syntax not working (Partly)

Vim only seems to highlight comments, numbers, and imported modules. So function calls, attributes, etc are all non-highlighted. I have 'syntax on' and 'filetype plugin indent on' in my vimrc. syntax ...
0
votes
0answers
29 views

Use combining characters in concealment character

Are combining characters allowed in a concealment character? The following does not seem to work: syntax match underdot "a\." conceal cchar=ạ The underdot is U+0323. This syntax conceals a. simply ...
1
vote
1answer
40 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 ...
0
votes
1answer
32 views

How to use vim as an error checker?

I'm transitioning to vim and I love the feature other IDEs provided in which when I wrote something with a syntax error it accuses me through a red underlining. I don't know what this type of feature ...
0
votes
1answer
16 views

markdown html-element syntax highlighting fails when line has leading spaces

For some reason, my html elements stop being highlighted when they are preceded by 4 or more spaces. I use spaces to do indentation for nested elements, so this is quite unfortunate. This only ...
1
vote
1answer
107 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
128 views

How to highlight unused Python imports in VIM

I want to highlight unused Python imports as Python syntax errors. For example, I sometimes forget to remove some packages used for debugging such as time, ipdb. It would be great to see warnings or ...
0
votes
1answer
38 views

Command to list all customizable color highlights

A few days ago I found a command that allowed me to view all the syntax colors in a theme. I could then determine what highlight I needed to change in order to customize the theme. Can you help me ...
0
votes
1answer
48 views

How to selectively turn specific highlight group on and off from vim session?

I have in my .vimrc: hi SpellBad ctermfg=7 ctermbg=0* cterm=underline hi Nonascii ctermbg=Black ctermfg=Red cterm=none hi [...] Some config files I need to look at contains so many unknown words ...
0
votes
0answers
34 views

highlight link with condition file does not exist

For a wiki syntax plugin, i'd like to have two highlighting colors for links. Links already having a destination file should be green and links with no destination yet should be red. [[This file ...
1
vote
0answers
20 views

Enable syntax highlight between custom tags [duplicate]

When I work with ruby .erb files, vim correctly detect javascript blocks and highlights them accordingly: ... colored html ... <script> ... colored javascript ... </script> ... more ...
3
votes
1answer
27 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 ...
1
vote
1answer
50 views

Is there a conflict between `syntax enable` and custom keywords?

I have the following minimal .vimrc file: " syntax enable syntax case match syntax keyword MyTodo TODO PENDING syntax keyword MyTodoIP IN PROGRESS syntax keyword MyTodoClosed CLOSED COMPLETE DONE ...
2
votes
2answers
148 views

Highlighting another syntax in a shell heredoc

I edited my original question and title to broaden its scope to any syntax - with SQL used as just an example. You can adapt the examples and the answer to other languages. By adding suitable ...
2
votes
2answers
468 views

Add keywords to a highlight group

Todo highlight group currently highlights TODO and FIXME keywords. What do I do to add NOTE, and possibley more keywords, to this existing highlight group, for all file types?
1
vote
2answers
383 views

How to use different colorscheme and syntax highlighting in vim?

Suppose I want to use this colorscheme: https://github.com/NLKNguyen/papercolor-theme I copied the PaperColor.vim file into .vim/colors and made my .vimrc: syntax on colorscheme PaperColor ...
1
vote
0answers
47 views

Ignore acronyms as spelling errors in TeX files

My LaTeX files contain lots of acronyms and they are often highlighted as spelling errors. I tried to ignore acronyms by adding syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@...
0
votes
1answer
75 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
221 views

Syntax Highlighting a region inside the start match of another region

I have two syntax region defined as follows: syntax region xBCD start="b" end="d" hi def link xBCD Todo syntax region xBlock start="\z(abcde\)\zs::" end=";" hi def link xBlock Comment and a text ...
1
vote
0answers
29 views

custom syntax hilighting lost on single LaTeX file

I use vimtex plugin for writing tex documents in vim8. I added custom hilight for sections in my .vimrc like so: autocmd FileType tex :syntax match texSectioning "\\section.*" The texSectioning is ...
0
votes
1answer
191 views

Enable syntax highlighting in vim using colorschemes?

In my installation of vim 8.1 (compiled from source) syntax highlighting is not working. The runtime path ($VIMRUNTIME) is set to /XYZ/VIM8/installnew/share/vim/vim81 which contains (autoload, ...
3
votes
0answers
65 views

gVim - Use different fonts using :highlight

I want to set gVim font size for Comment highlight group. When I set it, it does not do anything (the font is still the same but color changes). My .gvimrc: se guifont=Fira\ Mono\ Regular\ 10 hi ...