Question

Lately I've been working with Javascript and to be honest it does not feel quite right when I see the numbers are not being highlighted as in other programming languages, like C, Python, Ruby or Haskell.

Does this thing have something to do with Javascript I'm not aware of?

Was it helpful?

Solution

Does this thing have something to do with Javascript I'm not aware of?

No. JavaScript has numeric literals just like other languages do.

Why vim syntax highlighting for javascript does not highlight numbers by default?

I can't tell you "why," but I can tell you how you can change it.

The JavaScript syntax file does classify numbers (at least, my /usr/share/vim/vim73/syntax/javascript.vim does), so you can change the colors used for them in your colors file or .vimrc:

hi javaScriptNumber guifg=#ffffff guibg=#287eff ctermfg=white ctermbg=lightblue

(Those colors would probably be obnoxious, choose ones you like.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top