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.
478
questions
2
votes
2answers
561 views
CMake syntax highlighting not working as expected
For most files, Vim (terminal) is syntax highlighting properly without any issues. However, I am unable to get it to work for CMakeLists.txt:
Neovim has no trouble with syntax highlighting, neither ...
1
vote
1answer
37 views
Is it possible to detect a highlighted search match with synIDattr() or similar?
When I have hlsearch on and my cursor is somewhere in a highlighted search match, is it possible to detect the search highlight hl-Search with synIDattr() or a similar function?
As far as I can tell ...
1
vote
1answer
17 views
How to ensure nvim uses my custom syntax files rather than the ones bundled with it?
I've been editing my syntax files, placing my versions in ~/.vim/syntax/.
For ~/.vim/syntax/php.vim that's worked, but for ~/.vim/syntax/html.vim for some reason it's being overridden by /usr/share/...
-1
votes
1answer
34 views
Adding Additional Syntax Highlight to nvim; cannot get .config/nvim/after/syntax to load .vim file
I'm trying to add additional syntax highlighting to a plugin I'm using for syntax highlighting. I've tried adding the additional syntax file fstrings.vim to the ~/.config/nvim/after/syntax folder but ...
2
votes
2answers
334 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 ...
0
votes
1answer
14 views
Wrong syntax coloring for multiline comment in Haskell file
As shown in the following screencast, when I open this Haskell file (extension hs), a long multi-line comment is not recognized appropriately.
Based a previous question of mine I've verified that :...
0
votes
1answer
57 views
highlighting is for no obvious reason
I have a large script and I have extracted a few lines into two files, why1.ksh and why2.ksh, to show highlighting issue I am seeing that I can't explain.
Here are the two lines of why1.ksh:
...
2
votes
2answers
900 views
Interactively check given string highlight group
We can get highlight group information by the following command
:hi[ghlight] {group-name}
But is it possible to get this information by given keyword? Something like this :
syn match Integer '\d\+'...
0
votes
1answer
140 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
292 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 ...
0
votes
0answers
17 views
How to configure SpaceVim to highlight .jenkinsfile
For vanilla this will work, however, SpaceVim seems is harder for me to configure and tweak. Can .vimrc and ~/.SpaceVim.d/init.toml live in harmony?
0
votes
1answer
42 views
Shell syntax, how to patch bad highlight groups
The neovim syntax for shell scripts doesn't check if keywords like echo, done, exit etc.. are surrounded by blank spaces or if they're part of a bigger Word.
This results in the following bad ...
3
votes
2answers
122 views
What exactly do patch 8.2.1693 and patch 8.2.1703 do to syntax highlighting?
It is fairly well known that syntax highlighting in vim breaks when one changes colorschemes frequently. This is due to peculiarities of hi def/hi clear.
Recently, the following changes were made:
...
8
votes
2answers
2k views
Setting syntax in ftplugin
I’m trying to set the syntax of Processing files (*.pde) to java with a ftplugin.
.vim/
after/
ftdetect/
pde.vim
ftplugin/
processing.vim
In after/ftdetect/pde.vim I ...
0
votes
1answer
25 views
Highlighting item in fold for custom markup language
I am trying to write custom syntax highlighting for a domain specific markup language for a simulator I am working on. I can get everything but one part working. A simple example would look something ...
2
votes
1answer
355 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 ...
9
votes
4answers
3k views
How to copy text with syntax highlighting?
Want a simple way, like notepad++ plugin: NppExport - Export to RTF, to copy selected text with syntax highlighting.
Notepad++, NppExport, Export to RTF example:
Select text
Copy RTF
Paste ...
2
votes
1answer
38 views
Syntax highlighting rule doesn't work when a another highlight (# comment) exists
I'm trying to create a highlight that changes the text color of a strikethrough syntax, like ~~hello~~ should turn the whole thing gray.
Here's what I've put in my vimrc:
au BufRead,BufNewFile *.n ...
0
votes
0answers
22 views
autocompletion - set iskeyword disabling highlights
I have set up some syntax highlights for some patterns, for example: sc.nextInt() nextInt will be highlighted as a Function... Then I have included :set iskeyword+=(,.,) in order for autocompletion ...
1
vote
1answer
587 views
concealing the start and end pattern in syntax region
I'm trying to learn multi line highlighting and have managed to get the following working
syntax region myMinusStart start=/^\s\+zzzz / end=/^\s\+qqqq / concealends
But the concealends is not hiding ...
1
vote
1answer
25 views
in-place replacement of code in HTML documents with TOhtml?
I'm working on some old HTML documentation, where are multiple code snippets (several lines long). I need to replace this old HTML-ized code with new one using modern styling.
What I have now:
... ...
...
0
votes
1answer
29 views
How to make a filetype behave exactly like C++?
I want the filetype .my_cpp and .my_cc to behave exactly like C++ files in Vim. I have the following set:
autocmd BufNewFile,BufRead *.my_cc set syntax=cpp
autocmd BufNewFile,BufRead *.my_cpp set ...
1
vote
0answers
30 views
Adding a syntax group to support fold markers with foldmethod=syntax
With foldmethod=syntax, is it possible to create a syntax group that matches my fold markers, so that i can use both language-specific syntax folding and whatever markers might already be in my code?
...
0
votes
1answer
25 views
java-syntax only runs on first Java buffer
I'm using neovim v0.4.4, vim-plug, and uiiaoo/java-syntax.vim.
For some unknown reason(s), syntax highlighting from java-syntax only works on the 1st java buffer. For example:
$ nvim file1.java
:e ...
2
votes
1answer
31 views
Position Dependent Custom Syntax Error Checking
I am trying to design a custom syntax file that performs some basic error checking for an ascii input file. The input is broken up into sections, and there are input cards specific to each section. ...
-1
votes
2answers
32 views
annoying red blocks in neovim
im using Neovim from my WSL terminal. I've been exploring the multiple plugins of this amazing open source project and this made me change my init.vim, a lot. Now i've messed it up and i don know how ...
0
votes
1answer
37 views
filetype plugin indent on is blowing up my vim
I have the following vimrc.
I noticed that there is a single line that's blowing up my usage of the FZF :BTags command:
filetype plugin indent on
Ie when I run the command :BTags I get this error
...
2
votes
1answer
77 views
Yank the characters that replace concealed strings?
For example, in .tex files, the expression $\sum$ is replaced with ∑. I would like to yank ∑, but when I try I get one of the characters that compose $\sum$, even when I set concealcursor. What is the ...
1
vote
0answers
20 views
How to fix/customise coloring for the autocompletion popup menu?
I'm not really happy with the syntax coloring of the auto-completion menu.
Probably the pink-ish background color is the least unpleasant thing, but the grey foreground text is really not as readable ...
0
votes
1answer
146 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
32 views
Enhance Latex Syntax without Rewriting everything
I want to extend the latex syntax for the given file:
\documentclass[a4paper,11pt]{book}
\begin{document}
\begin{figure}[t]
\begin{tikzpicture}
\node[alter] at (0,0) (v1) {typ0};
...
1
vote
1answer
23 views
Syntax Highlight Problem for Latex/Tikz
I have a tikzpicture inside a latex file. My problem is that when I open the file and jump with GG to the end of the file, the math environment inside the tikz-nodes is not highlighted (e.g. $v_0^1$)....
0
votes
1answer
27 views
Display the same color for all characters in a math section
In a tex file, almost all the characters inside delimiters like $...$ or \[...\] have the same color, but there are some characters, like = (and possibly others) which have a different color. I would ...
1
vote
0answers
39 views
How do you highlight text surrounded by double equals
I'm using vimwiki plugin with markdown. I'd like to highlight text using double equals, which isn't standard, but is quite useful. Ideally, this should replace background (for instance, yellow) and ...
1
vote
0answers
103 views
Vimwiki/Markdown blockquote syntax highlight
AFAIK vimwiki's markdown syntax doesn't emphasize in any way blockquotes. I mean:
> This is a quote
is presented instead as simple text. For reading notes it can be confusing. So, how do you ...
-1
votes
1answer
92 views
How to overwrite the conceal background color with line color?
I've started using coc for NeoVim and I've setup a highlight for a line with error using the following:
hi CocErrorLine guibg=#ce2c28
However, when the error line has a concealed character, it has a ...
1
vote
0answers
31 views
Vim ignores color 255, as if it doesn't support the 256 ones
Update: it works, if I set the main bg color (white) as ctermbg=231 (it was 015). So it seems that color values in Vim syntax highlight settings shouldn't be mixed: if one uses color codes from the 16 ...
0
votes
1answer
933 views
How to lint HTML file using the vim ale plugin?
Install ale with pathogen.
cd ~/.vim/bundle
git clone https://github.com/w0rp/ale.git
My setting for ale in .vimrc.
let g:ale_sign_column_always = 1
let g:ale_set_highlights = 0
The target html ...
1
vote
1answer
28 views
How to highlight text between two delimiters / tags?
How do I highlight the block of text between two delimiters / tags / "surroundings"?
(e.g., between matching parentheses ()s, quotes "", html tags (div../div), etc.)
(Or maybe how ...
1
vote
1answer
39 views
unexpected highlight of “man” pattern [duplicate]
I am wondering why vim highlights "man" pattern.
When I do a word search with /, it disapears.
Here is my vimrc file:
" Disable default bottomline
set noruler
set noshowcmd
set ...
3
votes
1answer
174 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 ...
1
vote
0answers
33 views
When re-sourcing vimrc, the highlight commands following the colorscheme choice are lost [duplicate]
Given this ~/.vimrc
syntax on
colo pablo
set cul
hi CursorLine cterm=bold ctermbg=NONE ctermfg=NONE gui=bold guibg=NONE guifg=NONE
hi String ctermfg=red
Do the following:
open a file, possibly ...
2
votes
2answers
126 views
Vim syntax partial match
I'm trying to match a new line character on a Vim syntax file, I can make it work when I use the patern within Vim but when I put it in my syntax file it doesn't highlight when I have a new line and ...
4
votes
1answer
41 views
Syntax coloring is inaccurate for HTML files with CSS code in it
As you can see in the following screencast, when I open an HTML file with some CSS in it, there's some part of the file which does not show syntax coloring. Do you have experience of this? Is it ...
1
vote
1answer
87 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 \...
2
votes
0answers
36 views
How to make certain conceal symbols get highlighted differently than others?
I’ve recently tried to make my python more readable using the conceal functionality. So now I went from this
to this .
Now what really bugs me here is that ƒ, ¶,the ¥ sign, the ℤ and 𝕊 symbols and ...
0
votes
2answers
106 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-...
1
vote
1answer
26 views
syn-keyword with control characters?
(I know the goals are dumb, and I know I could set ffs=unix,dos to not see ^M; I'm just trying to understand more about vim).
I was playing around with vim keywords, because I want to conceal certain ...
23
votes
5answers
10k 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
30 views
How can I have jinja2 indentation and syntax when keeping HTML filetype?
I have emmet installed and some more plugins that are usable on html filetypes, I would like to have syntax highlighting and have indentation for jinja2 while keeping the filetype HTML so my HTML ...