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.

2
votes
2answers
471 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 ...
3
votes
1answer
56 views

Match by syntax highlighting instead of expressions

I want to delete all the comments from a program. Vim already knows (in some sense) where all the comments are because it is correctly formatting them based on the syntax file the particular language ...
5
votes
1answer
140 views

MacVim thinks I have unmatching parentheses, until I place cursor over each parenthesis

I am trying out MacVim for the first time and Vim seems to think I have a surplus of closing parentheses: However, Vim seems to change it's mind. Each highlighted closing parenthesis is no longer ...
4
votes
1answer
366 views

Highlighting Date in Vim

I have a file that has dates in this format: Fri Jun 05, 2015. It's essentially a diary. I have created the syntax keywords Day, Month, dateNum, and Year for the various components of the date but I ...
5
votes
1answer
511 views

Highlight double space in markdown

When writing markdown, a double space at the end of a line indicates a line break. Currently, neither single trailing whitespaces nor double-whitespaces are being highlighted. Is it possible to have ...
3
votes
4answers
4k views

Colorizing plain text

I love vim, i use it all the time for write codes, but now I want to write some personal notes. I'm trying vim-pandoc (with vim-pandoc-syntax) and it's nice to have 'rich text' features like titles, ...
5
votes
1answer
655 views

Improve performance of syntax highlighting in Vim

I have some C++ sources files which are in a few mega-bytes (a few tens thousands lines) to view and edit. The performance looks really bad in Vim. Refersh (<C-l>) or input single char in insert ...
5
votes
1answer
1k views

Visual Differences between vim on virtualbox Ubuntu guest (through putty) OR gVim on Windows host

Ok, it's a curiosity more than a real question, I apologize in advance for long post: Usually I code with vim on a ubuntu headless, as a virtualbox guest on my stupid windows 7 host; I access linux ...
7
votes
1answer
3k views

Override cursorline background color by syntax highlighting

I've set the background color of the current line to light gray like this: hi CursorLine cterm=NONE ctermbg=253 (Note that my color scheme is black-on-white.) However, this way any background ...
2
votes
1answer
725 views

Syntax highlightning with custom runtime path

A server only has old versions of vim available in the repo, so I compile and run vim from my ~. Starting vim it complains line 2: E484: Can't open file /usr/local/share/vim/syntax/syntax.vim ...
1
vote
0answers
144 views

Vim-SyntaxHighlight: Custom Syntax Highlighting With Vim [closed]

I'm trying to make my own syntax highlighting for vim. I was following the instructions in here (first answer) but I need to set a group for import and pack, and another group for func, lib, group. ...
2
votes
1answer
64 views

Highlight word, depending on its prior use in the file

I try to color a word depending on its prior use. For example I have the following text file a : Type1 b : Type2 And now I will take about a and b So Ideally I would like to define Type1 ...
0
votes
1answer
643 views

Override highlight group settings with default values

I am writing a plugin that highlights buffer settings violations. I use matchadd() function. In addition I need to add patterns that are force ignored. In order to achieve that I use priorities in ...
9
votes
3answers
374 views

How to output highlighted source code into a file to use outside vim

At my workplace, I want to do a presentation of a custom language I've developed for solving some problems we had. For easier development, I created my own vim syntax file for this particular language....
4
votes
2answers
408 views

How to jump to the end of quoted string, considering escaped delimiters

Assuming the following situation $someVar = "Some String with \"escaped\" inner delimiters"; with the cursor somewhere in the double-quote delimited string. What is the quickest way to jump to the ...
11
votes
3answers
4k views

Vim slows down over time with syntax on

Is there anything I can do to keep syntax on when using Vim? As soon as I open anything substantial it becomes nearly impossible to edit after a while. Every keypress causes a delay. If I turn syntax ...
4
votes
2answers
681 views

Highlight XML errors based on this XML file's XML Schema

I have an XML file that must conform to a particular XML Schema: <?xml version="1.0" encoding="UTF-8"?> <myroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
3
votes
2answers
301 views

Highlight longest common subsequence between two files? line by line

I'm asking about some sort of specialized diff highlighting mode. I need to diff, line by line, files A and B, which look similar to this in vimdiff: A B repo/manipulate_1....
19
votes
5answers
3k views

Set cursor colour different when on a highlighted word

With the current colourscheme I have been using, it is hard to find where the cursor is positioned when navigating through search results. The highlighting colour and the cursor colour are blending in ...
14
votes
1answer
12k views

How can I change the colour of the line highlighted with the 'cursorline' option?

I can highlight the current line like this :set cursorline, which underlines the current line. However I would like to highlight the entire line in a lighter color. How can I achieve this look?
2
votes
2answers
514 views

I have a something in my vimrc to match text over 80 characters as an error. It only works in the right most split. Any ideas?

From my .vimrc: match ErrorMsg '\%>80v.\+' And a screenshot: I have tried a minimal vimrc and it still doesn't work in the left splits.
5
votes
1answer
289 views

How can I make text formatting ignore concealed characters?

Question Working with text and various markup languages in Vim I have recently experimented with the conceal feature to hide some of the more verbose markup. I switch conceal off when writing and ...
5
votes
2answers
489 views

Entering search pattern with syntax highlighting?

A search pattern used with /, entered on the vim command line, can be very complex. But even for a normal regular expression pattern, syntax highlight of the expression syntax would be helpful. ...
5
votes
2answers
451 views

How to create syntax folding for pascal

I mostly want it to automatically create folds for between a begin and an end, although if there's anything more advanced that would be welcome too. I've looked in the help for the pascal syntax and ...
13
votes
2answers
786 views

Auto Highlighting identical lines text

I saw a skilled vim ninja do this a while back but I have no idea were to start. A) Is there a way to set up vims background colour so that consecutive lines with identical content get highlighted. ...
5
votes
2answers
579 views

Vim `cpp` Syntax highlighter prematurely ends macros mid-word

NOTE: This question is a "manual migration" from here: https://superuser.com/q/875751/199803 My Vim syntax highlighter for ft=cpp is prematurely ending some macros mid-line. For example: (The ...
6
votes
1answer
492 views

Why don't I get syntax highlighting when I open a file in an autocmd?

While trying to devise a solution to How do I make vim look in a set of directories for a file, if it doesn't exist in the current directory?, I have got so far using Python: function LookupFiles ...
5
votes
1answer
518 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
187 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
967 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
648 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 ...
28
votes
1answer
5k 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
855 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
234 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
294 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
327 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?