We’re rewarding the question askers & reputations are being recalculated! Read more.

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
583 views

Why I am losing syntax highlighting when folding code within a <script> tag?

I am working with an HTML file and within a <script> tag specifically. I usually fold my code using the marker method. However an annoying behavior sometimes happens with my syntax highlighting ...
7
votes
2answers
1k 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. ...
0
votes
1answer
189 views

Can I replace Vim's syntax highlighting with my own script?

Is there any way to replace Vim's syntax highlighting? For example, I now have this test script to make everything between quotes red: #!/usr/bin/env python import re, sys print(re.sub(r'"(.*?)"', r'...
3
votes
1answer
1k views

How can I get syntax highlighting to support multiline JavaScript strings?

Currently I have JavaScript (.js) files that contain multiline strings. Vim's syntax highlighting does not seem to support these, as seen in the image below: Anything below the first line is not ...
1
vote
1answer
733 views

How can I remove the red highlighting of ejs code braces?

I'm pretty new to vim and am working on a node.js project with ejs files. I have syntax highlighting turned on with syntax on in my .vimrc file. I also have an ejs file that contains JavaScript code ...
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 ...
29
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 ...
13
votes
1answer
916 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,...
16
votes
2answers
2k views

Disable syntax highlighting depending on file size and type

I often have to edit various XML files with vim, which vary wildly in size - from configuration files containing a few hunded lines to production data files with sizes up to 2GB. Having syntax ...
4
votes
1answer
94 views

Custom syntax file for FIX data doesn't work

I tried to create a custom syntax file to read FIX messages. Note: I am certain my custom files are being loaded by Vim. The file format is sequences of NUMBER=VALUE pairs separated by the ...
8
votes
2answers
236 views

How can I get correct autocompletion for ambiguous file extensions?

I'm editing Prolog files as part of an exploratory project, and some of the files I'm working with have the extension .pl, which is shared by Perl files. Whenever I do work on a Prolog file named [...
16
votes
1answer
326 views

Treat string literals as a different language

I have a number of JavaScript files where the strings are snippets of HTML to be inserted into the webpage. Vim performs syntax highlighting on the JavaScript, and highlights the quoted strings as ...
10
votes
2answers
346 views

How can I add syntax highlighting to vim as I can do in gedit?

When I write a script in gedit, the commands, comments, variables etc... are given different colors. How do I setup vim to do the same?