Home

Awesome

Node.vim

Build status

Tools to make Vim superb for developing with Node.js.
It's the Node equivalent of Rails.vim (vimscript #1567) and Rake.vim (vimscript #3669).

This is just the first release to get the nodes rolling. If you've collected great helpers and shortcuts that help you work with Node, please share them via email, Twitter or GitHub issues so we could incorporate them here, too! Thanks!

Tour

Expect more to come soon and feel free to let me know what you're after!

PS. Node.vim is absolutely intended to work on Windows, but not yet tested there at all. If you could help, try it out and report issues, I'd be grateful!

Installing

The easiest and most modular way is to download this to ~/.vim/bundle:

mkdir -p ~/.vim/bundle/node

Using Git:

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

Using Wget:

wget https://github.com/moll/vim-node/archive/master.tar.gz -O- | tar -xf- --strip-components 1 -C ~/.vim/bundle/node

Then prepend that directory to Vim's &runtimepath (or use Pathogen):

:set runtimepath^=~/.vim/bundle/node

Vundle

Or use Vundle:

:BundleInstall moll/vim-node

Using

Open any JavaScript file inside a Node project and you're all set.

Want to customize settings for files inside a Node projects?

Use the Node autocommand. For example:

autocmd User Node if &filetype == "javascript" | setlocal expandtab | endif

Want <C-w>f to open the file under the cursor in a new vertical split?

<C-w>f by default opens it in a horizontal split. To have it open vertically, drop this in your vimrc:

autocmd User Node
  \ if &filetype == "javascript" |
  \   nmap <buffer> <C-w>f <Plug>NodeVSplitGotoFile |
  \   nmap <buffer> <C-w><C-f> <Plug>NodeVSplitGotoFile |
  \ endif

Viewing Node.js core modules

Open Vim in the directory of a Node.js project and use :Nedit with the name of the core module:

:Nedit http

This downloads a single file from the Node.js repository for your Node version through https://rawgit.com. If you'd like to change the base URL, set g:node_repository_url:

let node_repository_url = "https://example.com/nodejs/node"

License

Node.vim is released under a Lesser GNU Affero General Public License, which in summary means:

For more convoluted language, see the LICENSE file.

About

Andri Möll authored this in SublemacslipseMate++.
Monday Calendar supported the engineering work.

If you find Node.vim needs improving or you've got a question, please don't hesitate to email me anytime at andri@dot.ee, tweet at @theml or create an issue online.