3

in the case of javascript syntax highlighting, I just had to download javascript.vim file and place the file in the corresponding folder, and vim would automatically make syntax highlighting when I open .js files.

But how does node.vim work?? Where should I place the node.vim file for vim to understand that I am working on node applications and apply the node syntax highlighting??

Thanks in advance....

nart
  • 1,508
  • 2
  • 11
  • 24
Sardonic
  • 441
  • 3
  • 8
  • 19
  • Node *is* JavaScript. Why would it have different syntax highlighting? – Amadan Jul 25 '14 at 12:30
  • for example,.. keywords like require, http, etc.. they are not highlighted using the javascript.vim file only, I thought it would need some additional help from node.vim or other equivalent files – Sardonic Jul 25 '14 at 14:47
  • Those are not keywords, they are variables: `require` contains a function, and `http` just an object. There is no difference between `require` and `http` on one hand and, say, `numberOfFlags` or `x` on the other. It makes little sense to colour them differently when you can just make new "keywords" simply by installing more packages. Real keywords are a fixed inventory, that can't be redefined or used as identifiers, like `continue`, `function` or `in`. – Amadan Jul 25 '14 at 16:13

2 Answers2

4

Node.vim has a few ways to install it listed in its README. Did you have trouble with them?

I personally use and suggest Pathogen together with Git. In Node.vim's case installing it would be only:

git clone https://github.com/moll/vim-node.git ~/.vim/bundle/node

Pathogen would then find Node.vim on next startup and initialize it.

Andri Möll
  • 426
  • 7
  • 8
0
  1. Some third party plugins may enhance the defaults but Javascript is supported natively so you don't need to download anything for Vim to detect and highlight .js files.

  2. What node.vim file are you talking about? Does it come from that plugin?

romainl
  • 186,200
  • 21
  • 280
  • 313