Questions tagged [vim-syntax-highlighting]

This is reserved for vim questions which focus on syntax highlighting or colorscheme files.

Vim has a rich syntax highlighting system. Syntax files can be found via :e $VIMRUNTIME/syntax and colorschemes can be found in :e $VIMRUNTIME/colors. These files use special vim commands to color and syntax-highlight different filetypes within vim.

This tag should be used if you have questions specifically about syntax highlighting in vim, since these questions are quite different from standard vim commands and tasks. Make sure you are reporting the correct :echo &filetype in your question and that you have set :syntax on.

If you are trying to add syntax highlighting to a non-standard filetype, then place the downloaded syntax in your ~/.vim/syntax folder and name it <filetype>.vim. Then in your ~/.vimrc, use au BufRead,BufNewFile *.<extension> setl ft=<filetype> where <extension> is the extension of the filetype and <filetype> is the name you saved the syntax file as.

For more information on vim syntax highlighting see :help syntax in vim, which provides some excellent documentation.

386 questions
19
votes
5 answers

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
  • 39,849
  • 11
  • 94
  • 127
17
votes
1 answer

Vim syntax and Latex math inside markdown

I write documentation in markdown using ViM and I also put math using the latex $$ symbol (I compile using pandoc). The thing is that ViM syntax wouldn't ignore the underscores _ inside the dollar symbols and it is pretty annoying. For instance if I…
sharp
  • 171
  • 1
  • 4
17
votes
3 answers

Making vim show a git diff with colors like a git diff command (red-delete, green-add)

I ran git config --global alias.ci commit --verbose This makes it so running git ci is like running git commit --verbose The --verbose flag shows a diff in the commit message template, which is not commented so syntax highlighting works on it, but…
user1902689
  • 1,655
  • 2
  • 22
  • 33
17
votes
3 answers

Highlight python docstrings as comments (vim syntax highlighting)

Is it possible to modify python.vim (and the corresponding colorscheme file) such that triple-quoted strings right under class and def statements (a.k.a. docstrings) will be highlighted as comments during python syntax highlighting under vim? class…
silvernightstar
  • 1,885
  • 3
  • 19
  • 25
15
votes
2 answers

Is Vim's Haskell syntax highlighting broken?

It seems to me that Vim's syntax highlighting for Haskell is broken, or very buggy. Multiline comments in Haskell (beginning with {- and ending with -}) are arbitrarily greened-out and un-greened-out. Sometimes dragging the mouse over the commented…
xkdkxdxc
  • 511
  • 5
  • 9
15
votes
2 answers

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 it locally.
Olivier Refalo
  • 50,287
  • 22
  • 91
  • 122
15
votes
4 answers

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
  • 17,604
  • 23
  • 71
  • 117
14
votes
4 answers

VIM syntax highlighting of html nested in yaml

Given a yaml file that contains html, like this: template : |+
Hello, world
Is it possible in Vim (version 7.3.087) to highlight the html portion with html syntax highlighting? I found the post Different syntax highlighting…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
13
votes
3 answers

Vim syntax Highlighting

I have installed vim in Debian 6. I am trying to change color scheme and enable syntax highlighting. But it's not working. I added set background=dark in .vimrc file. But white background is displaying. I wonder what went wrong? Here is my .vimrc…
blakcaps
  • 2,647
  • 10
  • 46
  • 71
13
votes
2 answers

Change color settings in you complete me

I installed You Complete Me with the help of Vundle in vim. The first time I used it, the suggested words were completely unreadable. They had a dark purple background and a black font color. Then I saw this post on quora and changed my .vimrc now.…
ZedsWhatSheSaid
  • 467
  • 2
  • 9
  • 23
13
votes
5 answers

How to override default syntax highlight in vim?

In VIM, I need to perform a simple task - highlight "(" and ")". I can do this easily by issuing two commands: :syn match really_unique_name display "[()]" :hi really_unique_name guifg=#FF0000 But if I add same commands (without ':' of course) to…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
12
votes
2 answers

Vim syntax highlighting for ruby 1.9

Ruby 1.9 has a few new syntax elements, such as the {key: value} hash literal syntax. Has anyone written or seen an updated syntax/ruby.vim highlighting file that will highlight key: just like it highlights :key in {:key => value}?
Peter
  • 127,331
  • 53
  • 180
  • 211
12
votes
3 answers

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 viminfo='20,\"50 set history=50 set ruler set si set…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
12
votes
2 answers

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: +-- 4 lines: int foo(int a, int b)…
Mikeage
  • 6,424
  • 4
  • 36
  • 54
11
votes
4 answers

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 vim (I've never changed the default config…
1
2
3
25 26