0.0.4 • Published 10 years ago
remote-vim v0.0.4
Control vim servers (or instances) programmatically. You can think this module as the Node.js equivalent of vimrunner.
Install
npm install remote-vimUsage
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): Openpathatline.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: trueuses:qa!<CR>.