remote-vim
v0.0.4
Published
Control vim remote servers from node.
Downloads
6
Readme
Control vim servers (or instances) programmatically. You can think this module as the Node.js equivalent of vimrunner.
Install
npm install remote-vim
Usage
Import ls
and create
functions.
var ls = require('remote-vim').ls;
var create = require('remote-vim').create;
ls
: List the running vim servers.
ls(function (err, vims) {
if (err) { throw err; }
vims.forEach(function (vim) {
console.log('vim instance named "' + vim.id + '" running at "' + vim.cwd + '"');
});
});
create
: Create a new vim server.
create('myvim', function (err, vim) {
if (err) { throw err; }
// Gets first command from history
vim.expr('histget("cmd", 1)', function (err, historyItem) {
console.log('First command was: ' + historyItem);
});
});
vim instances have the following methods:
open(path,[line,]cb)
: Openpath
atline
.cb: func (err) { }
.expr(path, cb)
: Evaluate expression.cb: func (err, result) { }
.sendKeys(keys, cb)
: Send keys to vim instance.cb: func (err) { }
.exit([force,]cb)
: Close instance using:qa<CR>
. withforce: true
uses:qa!<CR>
.