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
2
votes
1answer
66 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
255 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'...
6
votes
1answer
465 views

Highlight heredoc as perl code

I would like to highlight all the HereDocs in a particular perl file as perl code. For example, I'd like to apply the normal perl highlighting to the subroutine in this HereDoc: my $code = <<'...
5
votes
1answer
2k views

Change default syntax highlighting scheme

I'm unhappy with the default syntax highlighting in vim and would like to change it. I tried to follow the accepted answer on this page, but I think my vim version (7.4) is different. Inside /usr/...
5
votes
0answers
1k views

Syntax highlighting randomly turns off

I use syntastic and split windows heavily in my vim workflow. Lately, syntax highlighting will vanish, seemingly at random, in one of my windows, usually after opening a new split. This happens with ...
5
votes
1answer
79 views

Disable spell checking for URLs in BibTeX

I would like to disable spell checking for the URLs in my BibTeX (.bib) files. I was able to disable spell checking for the citation keys (author-year or author+year) as follows: autocmd FileType bib \...
4
votes
1answer
47 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 ...
4
votes
1answer
4k views

Custom syntax highlighting: highlight word following keyword

I am currently trying to set a custom syntax highlighting using a mysyntax.vim file. I have several keywords (int, real, real2D, real1D, etc) currently highlighted using syn keyword VariableType real ...
4
votes
1answer
1k views

syntax highlight for whole line

I want to color the background of a keyword but also for the whole line where it is found. The file has entries like this: \begin{frame} \frametitle{title} \framesubtitle{subtile} \end{frame} Lines ...
3
votes
2answers
1k views

Syntax highlighting of underscores in LaTeX, even though they only appear in filenames

I'm using nvim and LaTeX together, and for the most part it's been great. However, nvim appears to be incorrectly highlighting underscores that appear in filenames I include as part of the subfiles ...
3
votes
1answer
390 views

Highlight syntax in start and end delimiters of region

I'm not sure I'm using the right tool for the job here, but I'm trying to embed Lua syntax highlighting inside a block syntax. The only way I can make this work is with a syn region. I can find the ...
2
votes
2answers
852 views

Toggle bold highlighting for comments in term/GUI

Currently, I use this: map <F7> <Esc>:if has("gui_running")<Bar>hi comment gui=bold<Bar>else<Bar>hi comment cterm=bold<Bar>endif<LF> It turns comments bold ...
2
votes
1answer
774 views

Syntax highlight multiple matches in the same line

I would like to know how to highlight multiple tokens in the same line. For example, if I want to highlight the value of 'a', I can write something like this: syn match num 'a=\zs\d\+\ze,b=\d\+.*' ...
2
votes
0answers
151 views

Search within syntax group?

Is there a way to take advantage of syntax highlighting for searches? For example, can a search be limited to comments or non-comments, if they are correctly marked by syntax highlighting?
1
vote
2answers
568 views

Highlight exported Go functions

Golang uses naming convention to separate functions visibility: exported (public) starts with a capital letter, non-exported (private) with a lower letter. I would like to highlight exported functions,...
1
vote
2answers
304 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
163 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 ...
1
vote
1answer
413 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 ...
0
votes
1answer
36 views

Is it possible to make a specific section have a different syntax? [duplicate]

I am working with markdown and writing snippets like: ```c int main() { return 0; } ``` It is highlighted as a code in vim. However would it possible for the c ...
0
votes
1answer
47 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 ...
0
votes
1answer
51 views

Reloading syntax on vimrc change

My vimrc has a function that extends the default-provided syntax for C: function! Bx_c_syntax() "{{{ "A faked version of the real thing let b:match_words= \ '\<...

1
2