Skip to content

Commit fc7bee8

Browse files
committed
Merge pull request #109 from buztard/wrap_command_output
Add wrapper for vim_command_output
2 parents f44e171 + a17eaf9 commit fc7bee8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

neovim/api/nvim.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ def command(self, string):
116116
"""Execute a single ex command."""
117117
return self._session.request('vim_command', string)
118118

119+
def command_output(self, string):
120+
"""Execute a single ex command and return the output."""
121+
return self._session.request('vim_command_output', string)
122+
119123
def eval(self, string):
120124
"""Evaluate a vimscript expression."""
121125
return self._session.request('vim_eval', string)

test/test_vim.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def test_command():
1818
os.unlink(fname)
1919

2020

21+
@with_setup
22+
def test_command_output():
23+
eq(vim.command_output('echo test'), 'test')
24+
25+
2126
@with_setup(setup=cleanup)
2227
def test_eval():
2328
vim.command('let g:v1 = "a"')

0 commit comments

Comments
 (0)