Skip to content

Commit

Permalink
Use vim.api instead of neovim.Nvim
Browse files Browse the repository at this point in the history
Neither is very clearly documented, but the former is recommended by
neovim devs.
  • Loading branch information
nixprime committed Dec 13, 2017
1 parent 3744240 commit f2ab9d2
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions autoload/cpsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@
import traceback
import vim

# Importing neovim succeeds as long as the neovim Python module is installed,
# whether or not we are actually running under Neovim, so trying and checking
# for ImportError isn't sufficient.
in_neovim = int(vim.eval("has('nvim')"))
if in_neovim:
import neovim

def _vim_eval(expr):
if in_neovim:
return neovim.Nvim.eval(vim, expr)
return vim.eval(expr)
try:
_vim_eval = vim.api.eval
except AttributeError:
# vim.api is a neovim feature.
_vim_eval = vim.eval

script_dir = _vim_eval("s:script_dir")
sys.path.append(script_dir)
Expand Down

0 comments on commit f2ab9d2

Please sign in to comment.