All Questions

Filter by
Sorted by
Tagged with
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.
Karthick's user avatar
  • 4,576
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 ...
Bendihossan's user avatar
  • 2,447
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"....
gotgenes's user avatar
  • 39.3k
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 ...
Daniel Spiewak's user avatar
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 ...
xralf's user avatar
  • 3,544
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....
tomekfranek's user avatar
  • 6,960
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 ...
never_had_a_name's user avatar
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 ...
ivanTheTerrible's user avatar
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?
Paul Biggar's user avatar
  • 28.2k
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 ...
Gilad Naaman's user avatar
  • 6,490
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?
unholysampler's user avatar
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 ...
cg433n's user avatar
  • 729
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 <% %>? ...
lyuba's user avatar
  • 6,330
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.
MKo's user avatar
  • 4,908
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 ...
wyc's user avatar
  • 54.4k
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 ...
pfnuesel's user avatar
  • 14.7k
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 ...
monojohnny's user avatar
  • 6,075
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 ...
Peter Coulton's user avatar
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 ...
hasen's user avatar
  • 164k
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 ...
RusAlex's user avatar
  • 8,415
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 ...
zpon's user avatar
  • 1,512
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?
teknix's user avatar
  • 935
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 ...
user avatar
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 ...
devEvan's user avatar
  • 361
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, ...
Paul Beckingham's user avatar
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>...
HS.'s user avatar
  • 15.6k
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 ...
Michael Kristofik's user avatar
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 ...
Jason R's user avatar
  • 11.4k
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?
John Weldon's user avatar
  • 40.4k
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 ...
yogsototh's user avatar
  • 14.8k
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{...
Maxy-B's user avatar
  • 2,832
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-...
Alois Mahdal's user avatar
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.
Hailiang Zhang's user avatar
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 ...
user1536048's user avatar
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 ...
Olivier Refalo's user avatar
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 ...
Brian M. Hunt's user avatar
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?
C. Ross's user avatar
  • 31.5k
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 ...
daltonb's user avatar
  • 665
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 ...
Michael Kristofik's user avatar
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 ...
SingleNegationElimination's user avatar
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. (...
Brian's user avatar
  • 923
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 ...
Patrick O'Doherty's user avatar
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 &...
Mike Pennington's user avatar
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 ...
svrist's user avatar
  • 7,092
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 ...
valadil's user avatar
  • 1,668
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 ...
Alexander Farber's user avatar
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?
Marco Mariani's user avatar
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 ...
oblitum's user avatar
  • 11.7k
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: +...
Mikeage's user avatar
  • 6,524
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 ...
CS Student's user avatar
  • 1,633

1
2 3 4 5
9