headlessvim
Introduction
headlessvim
makes Vim programmable to support developping Vim plugins.
The most distinctive characteristic is,
headlessvim
NEVER needs +clientserver
feature.
Install
Using pip
(recommended)
pip install headlessvim
The good old setup.py
python setup.py install
Usage
A simple example is here:
>>> import headlessvim
>>> with headlessvim.open() as vim:
... vim.echo('"spam"') # make sure to quote bare words
...
'spam'
>>> import os
>>> env = dict(os.environ, LANG='C')
>>> with headlessvim.open(executable='/usr/bin/vim', args='-N -u /etc/vim/vimrc', env=env):
... vim.send_keys('iham\033')
... vim.display_lines()[0].strip()
...
'ham'
Integrating to unittest
:
import unittest
import headlessvim
class TestVimPlugin(unittest.TestCase):
def setUp(self):
self.vim = headlessvim.open()
def tearDown(self):
self.vim.close()
def testSomeFeature(self):
res = self.vim.echo('"ham egg"')
self.assertEqual(res, 'ham egg')
Documentation
See the online document for more information.
Testing
Execute:
python setup.py test
License
The MIT License.
See LICENSE.txt for more information.