Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imports vim module by default. #430

Merged
merged 2 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pynvim/plugin/script_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def __init__(self, nvim):
exec('import sys', self.module.__dict__)
self.legacy_vim = LegacyVim.from_nvim(nvim)
sys.modules['vim'] = self.legacy_vim

# mimic Vim by importing vim module by default.
exec('import vim', self.module.__dict__)
# Handle DirChanged. #296
nvim.command(
'au DirChanged * call rpcnotify({}, "python_chdir", v:event.cwd)'
Expand Down
9 changes: 8 additions & 1 deletion test/test_host.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# -*- coding: utf-8 -*-

from pynvim.plugin.host import Host, host_method_spec
from pynvim.plugin.script_host import ScriptHost


def test_host_imports(vim):
h = ScriptHost(vim)
assert h.module.__dict__['vim']
assert h.module.__dict__['vim'] == h.legacy_vim
assert h.module.__dict__['sys']


def test_host_clientinfo(vim):
Expand Down