All Questions
Tagged with vim syntax-highlighting
434
questions
190
votes
7
answers
141k
views
How to force vim to syntax-highlight a file as html?
How do I set vim's syntax highlighting to treat a file extension as an html file?
I'm using ez template, so the file's extension is .ezt. But a lot of it is normal html code.
147
votes
4
answers
64k
views
Persistent :set syntax for a given filetype?
I'm working on a Symfony2 project which uses Twig, and the filetypes are myfile.html.twig. Vim doesn't automatically detect the syntax highlighting and so applies none. I can use :set syntax=HTML ...
129
votes
3
answers
60k
views
How to tell which colorscheme a Vim session currently uses
You can set the Vim color scheme by issuing
:colorscheme SCHEME_NAME
but, oddly enough, you can't get the currently used scheme by issuing
:colorscheme
as this results in "E471: Argument required"....
118
votes
4
answers
95k
views
Vim Configure Line Number Coloring
I'm looking for a way to configure the color used for line numbering (as in: :set nu) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I ...
108
votes
9
answers
106k
views
How to change font color for comments in Vim
I'd like to change the default font color for comments, which is dark blue to slightly yellow color. It is difficult to read on the black background. I'm using xfce4-terminal, not gvim with GUI.
How ...
101
votes
7
answers
30k
views
Vim, how to reload syntax highlighting
When I execute Rmodel, Rcontroller and others in Vim. I see only white text.
But when I go to next buffer and then go back by :bn and :bl, colors are working.
This is my .vim folder
https://github....
92
votes
13
answers
85k
views
How to highlight Bash scripts in Vim?
My Vim editor auto highlights PHP files (vim file.php), HTML files (vim file.html) and so on.
But when I type: vim file and inside it write a Bash script, it doesn't highlight it.
How can I tell Vim ...
77
votes
11
answers
66k
views
class & function names highlighting in Vim
I just recently set up my Vim environment from Textmate, after becoming addicted to its modal input.
However, syntax highlighting seems to be not so beautiful in Vim. I code in C++ and since the ...
58
votes
3
answers
40k
views
In vim, how do I highlight TODO: and FIXME:?
In vim, FIXME and TODO are highlighted, but I can't get FIXME: and TODO: (note the colon after the keyword) to highlight? What should I put in my .vimrc to make this happen?
57
votes
9
answers
96k
views
Vim Syntax Highlighting does not work
I've installed a fresh Arch Linux system on my laptop and downloaded the vim package.
I haven't altered the .vimrc file, but the syntax highlighting doesn't seem to work with any of the languages I ...
53
votes
7
answers
42k
views
Change syntax color in vim?
I have syntax highlighting on, but comments are set to dark blue. This hard for me to read against a black terminal. How do I change it so that the comments are colored green instead?
52
votes
6
answers
36k
views
Highlighting the current line number in vim
Is there a way to highlight only the current line number (in the left hand coloumn) in vim, without highlighting the background of the current line? Ideally, I would Like to make the current line ...
48
votes
6
answers
16k
views
Syntax highlight for .ejs files in vim
What is the best way to make vim highlight ejs (http://embeddedjs.com/) files?
Is it possible to set up html highlight for the file in general and javascript highlight to it's parts inside <% %>?
...
41
votes
2
answers
11k
views
vim's current highlighed language
How to know which programming language is set for highlighting the syntax in vim.
I can set the language by "setf" command, but how to get the current language?
Thanks.
37
votes
5
answers
50k
views
How to change the color of the selected code (Vim scheme)?
How do I change the color of the selected code in Vim?
There are three selection modes, Visual Line mode or Visual Block mode, and selecting with the mouse).
hi CursorLine guibg=#DDDDDD gui=none
...
35
votes
3
answers
9k
views
vim randomly breaks syntax highlighting
When working on a remote server with rather large ping times, the syntax highlighting suddenly and seeming randomly breaks. When that happens, it looks like this:
The syntax highlighting is fine til ...
35
votes
5
answers
19k
views
VIM: simple steps to create syntax highlight file - for logfiles
I have some (log4j generated) logfiles to go through; I know their format pretty well (I mean I have already got off-the-peg regexes etc I can use).
I want to automatically highlight them in VIM when ...
32
votes
4
answers
12k
views
Vim inconsistently syntax highlighting bash files
When I open some bash script files with vim it sometimes identifies them as conf files, that's okay, I can just correct that by setting the filetype to sh with :setf sh.
That great, except I've ...
30
votes
2
answers
7k
views
vim: associate extension with language
I have gvim 7.2, it recognizes .d files and highlights it correctly according to the syntax of the D programming language. However, .di files are not recognized as D files, and no highlighting is ...
29
votes
4
answers
11k
views
vim syntax highlight improve performance
How do I improve performance when I'm scrolling my files and coding them? With syntax highlighting, vim is so slow. When I switch it off, everything is ok.
Is there a way or any recommendations to ...
26
votes
3
answers
18k
views
Vim highlight a list of words
I need to highlight a list of words in vim, preferably the words should be defined in a file. A bit like spell checking. I have been looking at http://vim.wikia.com/wiki/Highlight_multiple_words but ...
25
votes
2
answers
24k
views
How do you get Vim to highlight C++ syntax errors like Visual Studio?
Is it possible to get gVim to highlight C++ syntax errors (the red squiggles underneath) in real-time like Visual Studio?
24
votes
3
answers
3k
views
Vim context highlighting
I think standard highlighting is useful -- to some extent. When programming with callbacks and nested structures, this does not help. Keywords and strings, they appear everywhere, and it helps when ...
21
votes
3
answers
3k
views
syntax highlighting doesn't work after restore a previous vim session
since dividing and loading each windows every time are kinda bothersome, I saved my session using:
mksession ~/session1.vim
and restored it using:
vim -S session1.vim
or
source session1.vim
it ...
20
votes
6
answers
12k
views
Vim syntax coloring: How do I highlight long lines only?
I would like vim to color "long" lines for me. Using 80 columns as an example, I would like to highlight lines that exceed that length. Here is roughly what I think the .vimrc file should contain, ...
20
votes
2
answers
5k
views
How to syntax highlight fragments of code in one language embedded in the source code in another language in Vim?
I have a custom XML file format which can contain blocks of code within certain tags.
For example:
<Root>
<Sql> select * from foo </Sql>
<MoreJunk> ... </MoreJunk>...
20
votes
2
answers
2k
views
Turn off vim syntax highlighting inside C++ comments
I recently downloaded vim 8.0. I don't know if I messed something up or a default changed, but in this code...
int foo()
{
// This is a comment containing a "string" and the number 5.
return ...
19
votes
3
answers
15k
views
Can I make vim do syntax highlighting on C++ headers that don't have extensions?
I have a project with a bunch of C++ header files that follow the standard C++ header naming convention; that is, a class called Foo would be declared in a file called Foo, not Foo.h or Foo.hh. Is ...
19
votes
5
answers
5k
views
Razor .cshtml syntax highlighting for vim?
I'm looking for a .cshtml vim syntax file. Are there any projects that haven't made it to www.vim.org?
18
votes
2
answers
5k
views
vim conceal with more than one character
Actually I'd like to display -> with → (there is a space after the arrow) in haskell files. But I have the impression the conceal mechanism only work to replace -> by one character. An ...
18
votes
2
answers
3k
views
Trouble using Vim's syn-include and syn-region to embed syntax highlighting
I am trying to get Vim to syntax highlight any file that ends with extension .Rtex in the following way:
All top level text is highlighted as TeX
Exception: any text enclosed in \begin{python}...\end{...
17
votes
1
answer
5k
views
vim syntax highlighting for git commit messages - custom commentchar
As mentioned in this answer, since Git 1.8.2 you can use core.commentchar config value to change commit message comments to something else than the default # (hashmark or hashsign).
That is a life-...
15
votes
4
answers
6k
views
How to enable syntax highlighting for CUDA .cu and .cuh files in Vim?
I found that my ~/.vimrc file has syntax on but it didn't work for any CUDA file (.cu).
Not sure to how to do it.
15
votes
1
answer
4k
views
Vim : Highlight the word TODO for every filetype
I would like to highlight the word TODO in vim, no matter what file is edited (code or normal text). It currently works for many different languages (for example, TODO is highlighted in C/Java ...
15
votes
2
answers
9k
views
Syntax coloring with Vim and Fish-Shell
What is the best editor for fish scripts? I mean an editor which can properly highlight, indent and syntax check.
I found the vim-fish project, but I am still scratching my head as to how to install ...
15
votes
4
answers
4k
views
VIM syntax highlighting of html nested in yaml
Given a yaml file that contains html, like this:
template : |+
<div>Hello, world</div>
Is it possible in Vim (version 7.3.087) to highlight the html portion with html syntax ...
14
votes
4
answers
5k
views
Where can I find a Vim syntax file for the go language?
Has anyone created a vim syntax file for the go language?
14
votes
7
answers
8k
views
Enabling italics in vim syntax highlighting for mac terminal
I'd like to have vim display my comments in italics, and I understand I need to place
cterm=italic
in the
hi Comment
line in the color.vim file I'm using. This, however, is having no effect on the ...
14
votes
7
answers
17k
views
Highlighting unmatched brackets in vim
I'm getting burned repeatedly by unmatched parentheses while writing python code in vim. I like how they're handled for C code - vim highlights in red all of the curly braces following the unmatched ...
14
votes
2
answers
1k
views
gvim long multiline string highlighting
I make extensive use of multiline docstrings in my python source code to include doctests. Unfortunately, vim/gvim seems to have a hard time with syntax highlighting, occasionally losing it's place ...
14
votes
3
answers
10k
views
In Vim, how to keep characters concealed even when cursor enters that line
I may have a unique situation here. I want gVim (gui version, in Linux) to keep concealed characters concealed no matter what, even when the cursor is on that line or that character gets selected. (...
14
votes
4
answers
11k
views
VIM Colorschemes in Screen & PuTTy?
I've been trying to get colourschemes to work properly in VIM when using it over ssh with PuTTy as a client but unfortunately I haven't had much success. I can only get 8bit colours working with PuTTY ...
14
votes
1
answer
2k
views
Syntax-highlight Python in a vim fold line
I have found that code-folding helps me organize my files better. Thus, at the bottom of my ~/.vimrc, I enable vim code folding by default:
""Folding
set foldmethod=indent
set foldnestmax=2
nnoremap &...
12
votes
3
answers
2k
views
vim folding messes up syntax highlighting
I'm using vim for LaTeX and I'm using latex-suite. It gives me nice syntax highlighting and folding, but in large files syntax highlighting gets "confused". If I open all folds, the syntax ...
12
votes
3
answers
6k
views
How do I make vim syntax highlight a whole line?
I'd like to have vim highlight entire lines that match certain patterns. I can get all the text in a line to highlight (by doing syn match MyMatch "^.*text-to-match.*$"), but it always stops at the ...
12
votes
3
answers
30k
views
MacVim gets all settings from ~/.vimrc, but not the colors and I have to source it again
I am using the following ~/.vimrc with MacVim 7.4 on MacOS X Mavericks:
set guifont=Menlo:h14
set encoding=utf8
set mouse=a
set expandtab
set ts=8
set showcmd
set nocompatible
set backspace=2
set ...
12
votes
3
answers
2k
views
Can I use both Python and SQL syntax highlighting in the same file in Vim?
I use multiline strings for SQL queries inside Python programs.
Is there a way to tell Vim to apply different highlighting rules inside them, possibly by using a --SQL marker?
12
votes
3
answers
4k
views
how to partially "link" highlighting groups?
I'm trying to do this on my .vimrc:
hi link SyntasticErrorLine SignColumn
hi link SyntasticErrorSign SignColumn
hi SyntasticErrorSign guifg=red ctermfg=red
What I want is to have the ...
12
votes
2
answers
6k
views
syntax highlighting in a VIM fold header
Is there any way to have VIM continue to apply formatting to the line used as the header for a fold?
E.g., I have the following code:
int foo(int a, int b) {
int c;
....
}
When folded, I see:
+...
12
votes
4
answers
8k
views
Vim variable syntax highlighting
I'd like to change my vim config file to allow highlighting of only my declared variables, not keywords. This article shows and explains what I mean: Alternate syntax highlighting
I'm a beginner to ...