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.
481
questions
5
votes
1answer
2k views
How can I highlight all function names in Python files?
I try to make python.vim color similar to material theme (sublime text 3), see pictures: https://imgur.com/a/wOgH7
expected is material theme and current is mine.
You may noticed that all method, ...
1
vote
0answers
35 views
How to access syntax elements
I try to inline one syntax in another syntax (to be explicit: CSS in JS template strings). I'd like to build on top of the existing CSS definitions and not create new ones.
Question: Is it possible ...
2
votes
0answers
344 views
vim in tmux lose highlighting
I'm using vim 8.0 and tmux 2.5 on ubuntu.
And I have set the TERM environment export TERM=screen-256color and run as tmux -2.
Normally, nothing goes wrong. It's like the following picture:
But ...
2
votes
0answers
41 views
Define region in region with same end match
Let's see an example:
block
property Property1
key: value
end
property Property2
key: value
end
end
I would like to let property/end pair highlight only in block/end ...
3
votes
0answers
86 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 ...
0
votes
1answer
169 views
Vim with syntax highlighting has slow searching in XML
My experience is that Vim is slow when searching in large XML files with syntax highlighting turned on. I find it to be very dissatisfactory. I have read about the issue elsewhere but I have not been ...
1
vote
1answer
435 views
How to highlight region over region
Let's think we are going to render html file. We highlight <a> and <img> tags, so a and img will be highlighted as Keywords. We assume <a> accepts attribute href but not src, while &...
3
votes
2answers
567 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 ...
2
votes
1answer
1k 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?
3
votes
1answer
569 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 ...
5
votes
1answer
602 views
What are the global settings for syntax highlighting?
I'm troubleshooting syntax highlighting in my .vimrc settings.
My setup is a little complex because I have some filetype settings for plain text and other settings for programming files (using ...
3
votes
1answer
659 views
How to identify the highlight groups in use on a particular character? [duplicate]
I'm new to vim and bumped into a problem.
Short question -- will vim tell me why it chose to highlight certain text in a certain way?
Long question --
I'm using vimdiff to compare two files, and ...
0
votes
2answers
406 views
Vi/Vim 8 on debian stretch : filetype “bindzone” not loaded automatically
When opening a bind zone file, I have to type by hand :set ft=bindzone to get syntax highlighting. It's not set automatically on load.
On another hand others filetypes (such as php, perl or kind) are ...
8
votes
2answers
1k views
Exclude start and end match from region
I'm trying to establish syntax coloring for a certain lexical syntax: a "buffer literal". A buffer literal begins with #b' and ends with '. Between the single quotes, there can be undivided pairs of ...
3
votes
0answers
628 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
1answer
526 views
How can I remove a syntax keyword?
In Python3, file is no longer a builtin. It's just a plain ol' name that isn't even associated with anything until you do. But all the syntax files that I've used have it as a builtin.
Is there a ...
3
votes
2answers
729 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 ...
2
votes
1answer
385 views
Vim highlights valid shell parameter expansion syntax as an error
#!/bin/bash
echo ${2:-"-l -p"}
Having some bash parameter-substitution fun and (Neo) Vim complains about it, while the code is perfectly fine.
I know I can suppress errors totally by doing sort of ...
3
votes
2answers
1k views
Syntax highlight fail for Prolog files
I'm having trouble configuring Vim on Manjaro:
After setting syntax on at .vimrc file, I make a Prolog program (bug.pl) which shows no syntax highlight:
But after I append /**/ to top of file (then ...
3
votes
1answer
959 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 ...
7
votes
2answers
2k views
Can I make Vim's spell check not syntax-aware, and check everything?
The Vim spell checker is code-aware; it uses the syntax file to disable spell checking for the parts where it usually doesn't make any sense.
However, on occasion I do want to spell-check this. ...
2
votes
0answers
51 views
Syntax highlighting depending on whether whole line is commented
Is it possible to have vim highlight folds differently depending on whether every line in a fold is only comments or whitespace? In that case, how?
25
votes
2answers
2k views
Vim's syntax highlighting considers a lambda (->) in Java an error
I am using Vim to program in Java 8, and am having a problem with syntax highlighting.
A new feature in Java 8 is lambda support, which resulted in the creation of the arrow operator: ->. Vim does ...
2
votes
0answers
52 views
LaTeX tabu package breaks Vim spell and syntax highlighting
The first line of this section of LaTeX code breaks syntax highlighting and spell check whenever I scroll to the area of the document that contains it:
\begin{tabu} {*3{X[l$]}}
col1 & col2 ...
5
votes
2answers
1k views
Read values from a highlight group
I can read a value from an option like:
let b = &background
Is there a way to read a value from a highlight group? Something like this pseudo-code:
let b = &StatusLine['ctermbg']
...
3
votes
1answer
521 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 ...
2
votes
1answer
1k views
How to highlight keywords in a syntax region?
I'm trying to improve the cmake-syntax-highlighting for vim.
I'm unable to have vim highlight a keyword which is inside a text which is already matching a region. I'm talking about variables:
For ...
9
votes
2answers
11k views
How to completely turn off colorscheme?
Original post
I've got a colorscheme configured in my .vimrc but sometimes I'd like to turn it off completely which means that I would like Vim to use the default background and foreground colors of ...
1
vote
0answers
248 views
Improperly highlighted when used with cursorcolumn
With this minimal .vimrc I get a highlight conflict in several situations.
set nocompatible
set runtimepath +=~/.vim/bundle/Vundle.vim
filetype off
call vundle#begin()
Plugin 'itchyny/vim-...
2
votes
1answer
330 views
How do I highlight pc-lint comments in C/C++
How do I mimic the behavior of Doxygen comment highlighting for PC-lint comments? Comments are in the following formats:
/*lint ... */
//lint ...
/* LINTLIBRARY */
/* ARGUSED */
/* VARARGS[N] */ <--...
3
votes
1answer
438 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 ...
2
votes
0answers
293 views
syntax highlight function arguments
Trying to create a simple syntax highlighting for a special file type we use.
within this file there are simple functions defined which I match using keywords:
syn keyword Funcs foo bar baz
hi def ...
4
votes
1answer
795 views
Can I show a color from its hex value in *any* file?
We have vim-css-color to display colors in .css files. Currently I'm editing my i3wm config to match colors to a new terminal theme and it would be quite handy to be able to actually see colors I'm ...
1
vote
1answer
866 views
Adding multiple syntax group to a syntax region
I’m writing a syntax file for Bats. I started my syntax file by loading the bash syntax:
let g:is_bash=1
runtime! syntax/sh.vim
unlet b:current_syntax
I then defined the Bats custom keywords:
...
1
vote
1answer
612 views
Highlight all imported modules in python
For example
import numpy as np
import matplotlib.pyplot as plt
x = np.array([-1, 0, 1])
y = np.abs(x)
plt.plot(x, y)
plt.show()
Is there a way to highlight all the occurrences of np and plt?
2
votes
1answer
161 views
How to share syntax highlights files for a “new” language?
In past I asked the question about how to create syntax specifications for ChatScript, a new programming language unforeseen in standard programming languages vim set (see: Vim syntax highlighting for ...
2
votes
1answer
70 views
Where is `javaParen` defined?
I want to write my own java syntax file for more customization, But can't find the definition of javaParen, it certainly isn't defined in default java.vim file.
I actually want to highlight all the ...
3
votes
1answer
840 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 ...
2
votes
2answers
7k 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 ...
0
votes
0answers
11 views
“set background=dark” masking highlight command [duplicate]
If my .vimrc file has this:
set background=dark
highlight Comment term=bold ctermfg=white
...comments are white as expected.
But if I reverse the order of the statements:
highlight Comment term=...
0
votes
1answer
581 views
Folding doesn't work for C/C++
I've been having a ridiculously hard time getting C/C++ code folding to work with set foldmethod=syntax. To debug my issue I've stripped down my vimrc to only this:
set foldmethod=syntax
syntax on ...
5
votes
1answer
792 views
What does the command `:syntax reset` do?
from the help: :h syntax-reset
If you have changed the colors and messed them up, use this command to
get the defaults back: >
:syntax reset
It is a bit of a wrong name, since it does ...
15
votes
1answer
1k views
Can vim syntax regions be made to touch/overlap?
So a while ago I had decided to learn more about how vim's syntax files work, by creating my own. My goal was to create a simple syntax file that would split the file into 3 parts based on delimiters,...
0
votes
1answer
104 views
Finding a match immediately after another match [duplicate]
I'm writing a syntax highlighter for my test script output. I'm having problems figuring out how to find a match immediately after another match. In the screenshot, notice the $VAR1... is not ...
0
votes
0answers
42 views
Turning on syntax highlighting for test script output to new buffer
I'm using a plugin, bexec, to execute a test script. The plugin opens up a new buffer to the right of my code and it displays the output of the test script:
I would like to have syntax highlighting ...
0
votes
1answer
388 views
How do I add syntax keywords globally for any filetype?
I have some keywords other than TODO used in comments that are common to all languages, things like 'NOTE'.
I want to label these words under Todo syntax class, so that they have the same colour with ...
2
votes
1answer
385 views
Syntax Highlight line above matched pattern
I am looking for a way to highlight text on the line above a matched pattern. For example, my text may appear like this:
Some text
---------
What I want is to match on the underline dashes and then ...
1
vote
2answers
2k views
Why isn't vim applying syntax highlighting to this code?
If I open a random file (in this case, say .zshrc) in a blank vim with no rc file , but with vi compatibility forcing off
vim -N -u NORC ~/.zshrc
As expected vim will launch and display .zshrc ...
3
votes
1answer
146 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 ...
1
vote
0answers
68 views
vim-latexsuite syntax highlight in macro parameter
I'm using vim with vim-latex to edit my LaTeX-files. I noticed that the \begin{env} and \end{env} are not colorized when they are in a macro parameter (the \vary command and question environment are ...