nodejs-server-functions


Ⅰ. 插件描述

Start, Stop and Restart a Node.js server inside Vim!

Ⅱ. 基本信息

创建日期:  2013-07-17
使用用户:  1
Github星:  1
插件作者:  Matias Linares

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'matiaslina/nodejs-server-functions'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'matiaslina/nodejs-server-functions'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'matiaslina/nodejs-server-functions'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/matiaslina/nodejs-server-functions

Ⅳ. 文档说明

# Node.js Server Functions

What's this?

This is a plugin for vim that allows you to Start, Stop and
Restart a Node.js server. It contains
just that 3 functions for now, so don't expect magic about this plugin.

Installation

The best way to install this plugin it's from Pathogen.vim

cd ~/.vim/bundle
git clone https://github.com/matiaslina/nodejs-server-functions

Options

you can change how you run the server. There are three different possibilities for this:

  • npm: Uses npm (start/stop) internally. This can be useful if you do not want to put the file on the server every time you start vim
  • node-dev: Uses node-dev to run the server. It's required to install it with the -g option. (i.e. npm install -g node-dev)
  • bash: This is the default option. simply runs the node.js server in a bash.

You can change this in your .vimrc with:

let g:NodejsRunType = "bash" | " this is the default
let g:NodejsRunType = "npm"
let g:NodejsRunType = "node-dev"

How to use

Functions

  • :NodejsSetFile <file>
  • :NodejsStart
  • :NodejsStop
  • :NodejsRestart

First of all you need to set the file that is going to run the server (be /home/user/nodejs-app/app.js the file that runs the server). This is not needed if you set to run the server with npm.

:cd /home/user/nodejs-app
:NodejsSetFile app.js

And then you can use the other three functions to run or stop the server.

添加新评论