vim-noderepl


Ⅰ. 插件描述

Creates an interface to a persistent node repl session in a Vim buffer.

Ⅱ. 基本信息

创建日期:  2010-11-06
使用用户:  1
Github星:  4
插件作者:  intuited

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'intuited/vim-noderepl'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'intuited/vim-noderepl'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'intuited/vim-noderepl'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/intuited/vim-noderepl

Ⅳ. 文档说明

noderepl.txt Vim interface to node.js REPL

noderepl creates an interface to a node repl session
in a Vim buffer.

SETUP noderepl-setup

You will need to have a python-enabled vim (|+python|)
in order to use noderepl.

Before you can use noderepl from within vim,
you will have to start an instance of the server.

This can be done by running the command >

node deps/noderepl/server/src/replique.js

from wherever noderepl is installed.

The Python client can be used to test whether or not the server is working: >

$ deps/noderepl/client/poste_replique.py evaluate '["hello", "world"].join(" ")'
'hello world'

VARIABLES noderepl-variables

g:noderepl_connect noderepl_connect

Determines the parameters used to connect to the noderepl server.

By default this will use port 4994 on the local host,
with a timeout of 2 seconds.

This variable should be a Dictionary containing any or all of the keys
host, port, and timeout.

COMMANDS noderepl-commands

NodeRepl [context_name] :NodeRepl

Starts a new REPL in a new buffer.

If no context name is given, the default is used.

NodeReplContext [context_name] :NodeReplContext

If invoked from an existing REPL, switches the context.

Otherwise functions like |:NodeRepl|.

CONCEPTS noderepl-concepts

Contexts noderepl-contexts

A REPL session is bound to a given execution context.

That context determines the values of all top-level variables.

More than one REPL session can be bound to a given context,
and a session's context can be changed with |:NodeReplContext|.

INTERFACE noderepl-interface

Keybindings for the REPL are based on those for the VimClojure addon.

Specifically:

  • CTRL-UP and CTRL-DOWN move backwards and forwards in the history
  • ENTER attempts to evaluate the current expression.
    If the text given constitutes a syntax error,
    the cursor is moved to the next line
    and entry continues.
    Pressing ENTER again will attempt to re-evaluate
    the entire text.

The string "Node=>" is the REPL prompt.
Deleting all or part of the prompt will confuse the REPL. Don't do that.

ISSUES noderepl-issues

Console output is not displayed in the vim REPL.
It will be printed on the real console where the the node server was launched.

This may make sense in some situations.

In any case, the server does not (yet) support any way
of redirecting output to the client.

Since output may be generated by asynchronous functionality,
to do this properly would require session tracking
and a more complex communication protocol than that currently used.

PYTHON FOOTPRINT noderepl-python-footprint

noderepl is relatively clean in the way it uses Python.

Other than importing the poste_replique module,
its only addition to vim's global Python namespace
is a class called NodeRepl.

NodeRepl contains glue code to facilitate the integration
of the poste_replique functionality into the vim addon.

DEPENDENCIES noderepl-dependencies

noderepl includes code for its two dependencies:
the replique server, written in javascript for the node platform,
and the poste_replique client, written in Python.

These modules are also available from, respectively,
the npm and pypi repositories.

添加新评论