programmable Vim, no need of +clientserver!
Project description
Introduction
headlessvim makes Vim programmable to support developping Vim plugins.
The most distinctive characteristic is, headlessvim NEVER needs +clientserver feature.
Also, headlessvim is fully compatible among Python 2.6, 2.7, 3.2, 3.3, 3.4.
Install
The good old setup.py
python setup.py install
Examples
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')
Testing
The unit test requires pytest module.
Execute:
python setup.py test
License
The MIT License.
See LICENSE.txt for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
headlessvim-0.0.3.tar.gz
(5.5 kB
view hashes)
Built Distributions
headlessvim-0.0.3-py2.6.egg
(13.9 kB
view hashes)
Close
Hashes for headlessvim-0.0.3.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cff8b1dc20b45f5d728f0ba8c6a013856c8fb42759bd189059e63516e6388a48 |
|
MD5 | cbcfe14825b5aa3254a7cdeaffac1aa6 |
|
BLAKE2b-256 | f2d08374bec4faed46d7347f33c347eda16a2f6a9163675d309963706a165d00 |