Coder Social home page Coder Social logo

joshgillies / vim-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moll/vim-node

0.0 2.0 0.0 481 KB

Tools and environment to make Vim superb for developing with Node.js. Like Rails.vim for Node.

Home Page: http://www.vim.org/scripts/script.php?script_id=4674

License: Other

Ruby 78.36% Makefile 1.47% Vim Script 20.16%

vim-node's Introduction

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

  • Use gf on paths or requires to open the same file Node.js would.
  • Use gf on require(".") to open ./index.js
  • Use gf on require("./dir") to open ./dir/index.js
  • Use gf on require("./foo") to open foo.js.
  • Use gf on require("./package") and have it open package.json.
  • Use gf on require("module") to open the module's main file (parsed for you from package.json).
  • Use gf on require("module/lib/utils") and open files inside the module.
  • Automatically sets the filetype to JavaScript for files with Node's shebang (#!).
  • Use [I etc. to look for a keyword in required files (Sets Vim's &include).
  • Use :Nedit to quickly edit any module, file in a module or your project file.
  • Use :Nopen to quickly edit any module and lcd to its directory.
  • Lets you even open Node's core modules. They're shown straight from Node's online repository without you having to download everything.
  • Node.vim itself is tested with a thorough automated integration test suite! No cowboy coding here!

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.

  • Use gf inside require("...") to jump to source and module files.
  • Use [I on any keyword to look for it in the current and required files.
  • Use :Nedit module_name to edit the main file of a module.
  • Use :Nedit module_name/lib/foo to edit its lib/foo.js file.
  • Use :Nedit . to edit your Node projects main (usually index.js) file.

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

License

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

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

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 [email protected], tweet at @theml or create an issue online.

vim-node's People

Contributors

moll avatar dweinstein avatar jalcine avatar

Watchers

Josh Gillies avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.