Giter VIP home page Giter VIP logo

vim-hug-neovim-rpc's Issues

nvim_buf_get_lines not working

Hey!

I've been messing with this, and hit a weird bug where if I called nvim.api.buf_set_lines, I got back the error pynvim.api.nvim.NvimError: b"object of type 'int' has no len()".

This was when calling it with 0, 0, -1, True.

Looking at the code for nvim_buf_get_lines and set lines, it looks like the first argument buffer is treated as the buffer, rather than the buffer index, as implied by the nvim docs :

Parameters: 
                    {buffer}           Buffer handle, or 0 for current buffer

Or over in

EXT Type	C type					Data
  ------------------------------------------------------------------------
  Buffer	enum value kObjectTypeBuffer		|bufnr()|

I could be entirely wrong, and my code is just working oddly, but if I add in a buffer_contents = vim.buffers[buffer] (or I guess vim.current.buffer for buffer == 0) and then use buffer_contents rather than buffer, the set and get work as expected.

Is that expected, or am I just using the function wrong?

DeprecationWarning on imp module

Saw this warning when starting Vim after upgrading to python 3.7.0:

[vim-hug-neovim-rpc] Vim(pythonx):/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
Press ENTER or type command to continue

how hard would that be to switch?

Support additional systems for UNIX domain sockets

With commit 5a20db1, UNIX domain sockets was introduced, yet it only supports Linux and MacOS (Darwin). Additional systems can easily be added. There are a few options, but I am not sure which is best. Here is what I am currently using:

diff --git a/pythonx/neovim_rpc_server.py b/pythonx/neovim_rpc_server.py
index d669fd0..055bbc0 100644
--- a/pythonx/neovim_rpc_server.py
+++ b/pythonx/neovim_rpc_server.py
@@ -296,7 +296,10 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
     pass
 
 
-if sys.platform in ['linux', 'darwin']:
+# if sys.platform in ['freebsd11', 'linux', 'darwin']:
+# if platform.system() in ['Darwin', 'DragonFly', 'FreeBSD', 'Linux', 'NetBSD',
+#                          'OpenBSD']:
+if os.name == 'posix':
     class ThreadedUnixServer(socketserver.ThreadingMixIn,
                              socketserver.UnixStreamServer):
         pass

The test for posix is the most broad, but I do not know if it would include any systems that cannot handle it. While sys.platform would work, it would grow fairly quickly since the BSD's all have the version of the OS appended to them. There is finally platform.system() which is basically uname -s which would work too and be easier than sys.platform.

Another alternative is to try defining the class and handle the exception. It should work everywhere:

diff --git a/pythonx/neovim_rpc_server.py b/pythonx/neovim_rpc_server.py
index d669fd0..ca278c6 100644
--- a/pythonx/neovim_rpc_server.py
+++ b/pythonx/neovim_rpc_server.py
@@ -296,12 +296,12 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
     pass
 
 
-if sys.platform in ['linux', 'darwin']:
+try:
     class ThreadedUnixServer(socketserver.ThreadingMixIn,
                              socketserver.UnixStreamServer):
         pass
     has_unix = True
-else:
+except:
     has_unix = False

nvim_get_option not implemented

I use nvim.options['ignorecase'] to check vim option, it works in neovim, but fail to work in vim8.

The log says nvim_get_options was not implemented

2017-06-22 11:54:35,640 [INFO @ session.py:request:97] 19060 - 'Received error: [1, b'nvim_get_option not implemented']

I checked neovim_rpc_server_api_info.py, nvim_get_option was defined, but not implemented.
I add the implement in neovim_rpc_methods.py and it works as expected.

def nvim_get_option(name):
    return vim.options[name]

def nvim_set_option(name, val):
    vim.options[name] = val

I'm a little curious about the difference of nvim/vim python client.

import vim
print(vim.options['ignorecase'])

This snippet works on both neovim and vim with :py3file

But when I add import vim to my plugin, it reported No module named 'vim'

  File "C:\Users\jia.sui\AppData\Local\nvim\plugged\gen_tags.vim\pythonx\cm_sources\gtags.py", line 5, in <module>
    import vim
ImportError: No module named 'vim'

Does anyone know the difference?
Thanks

The echo neovim_rpc#serveraddr() test results in /tmp/vmrUX9X/2

After installing vim-hug=neovim-rpc, I proceeded to the mentioned test for a valid installation:

Use :echo neovim_rpc#serveraddr() to test the installation. It should print something like 127.0.0.1:51359.

However, what I get is /tmp/vmrUX9X/2, quite different from what seems to be expected. I am not entirely sure how problematic that can be, but indeed ncm-R is not working with vim-hug-neovim-rpc.

Vim cannot find neovim module

Since a few days, I get the following error message when launching Vim on my (uptodate) Archlinux x86_64 :

[vim-hug-neovim-rpc] Vim(pythonx):ImportError: No module named neovim 
Error detected while processing function deoplete#enable[9]..deoplete#initialize[1]..deoplete#init#_initialize[10]..<SNR>120_ini
t_internal_variables[28]..neovim_rpc#serveraddr:
line   18:
E605: Exception not caught: [vim-hug-neovim-rpc] requires one of `:pythonx import [pynvim|neovim]` command to work

I think the problem occured after an update, either to my System (there has been a lot of python packages updated recently) or to my Vim Plugins after a PlugUpdate.

To solve the this problem, I tried different solutions found on the Web, but no luck.
Finally, I uninstalled several packages pip, neovim, greenlet, ... and reinstalled neovim.

$ sudo pip3 install neovim
Collecting neovim
  Downloading https://files.pythonhosted.org/packages/78/ec/ac9905ccab8774b64c37cdff9e08db320c349eda0ae3161aebcac83e5590/neovim-0.3.1.tar.gz
Collecting pynvim>=0.3.1 (from neovim)
  Downloading https://files.pythonhosted.org/packages/94/73/9fcf169c4bf1bc6d931a1f4002b139a34950ba5804b9066ffd35fc791550/pynvim-0.4.0.tar.gz
Requirement already satisfied: msgpack>=0.5.0 in /usr/lib/python3.8/site-packages (from pynvim>=0.3.1->neovim) (0.6.2)
Collecting greenlet (from pynvim>=0.3.1->neovim)
  Downloading https://files.pythonhosted.org/packages/f8/e8/b30ae23b45f69aa3f024b46064c0ac8e5fcb4f22ace0dca8d6f9c8bbe5e7/greenlet-0.4.15.tar.gz (59kB)
     |████████████████████████████████| 61kB 2.9MB/s 
Installing collected packages: greenlet, pynvim, neovim
  Running setup.py install for greenlet ... done
  Running setup.py install for pynvim ... done
  Running setup.py install for neovim ... done
Successfully installed greenlet-0.4.15 neovim-0.3.1 pynvim-0.4.0

but without success, error remains the same !

Vim says :

:echo has('python')   --> 1
:echo has('python3')   --> 0
:echo has('pythonx')   --> 1

Please, can you help ?

My Vim version is :

$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compilé Nov  7 2019 22:30:47)
Rustines incluses : 1-2268
Compilé par Arch Linux
Énorme version avec interface graphique GTK3.
  Fonctionnalités incluses (+) ou non (-) :
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       +tcl/dyn
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
+balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
+browse            +gettext           +num64             +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     +perl/dyn          +toolbar
+cindent           +job               +persistent_undo   +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           +python/dyn        +visual
+cmdline_info      +libcall           +python3/dyn       +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          +ruby/dyn          +wildmenu
+cursorbind        +lua/dyn           +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con_gui    +mksession         +smartindent       +X11
+diff              +modify_fname      +sound             -xfontset
+digraphs          +mouse             +spell             +xim
+dnd               +mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        +xsmp_interact
+emacs_tags        +mouse_gpm         -sun_workshop      +xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary        
+extra_search      +mouse_sgr         -tag_old_static    
         fichier vimrc système : "/etc/vimrc"
     fichier vimrc utilisateur : "$HOME/.vimrc"
 2me fichier vimrc utilisateur : "~/.vim/vimrc"
      fichier exrc utilisateur : "$HOME/.exrc"
        fichier gvimrc système : "/etc/gvimrc"
    fichier gvimrc utilisateur : "$HOME/.gvimrc"
2me fichier gvimrc utilisateur : "~/.vim/gvimrc"
 fichier de valeurs par défaut : "$VIMRUNTIME/defaults.vim"
          fichier menu système : "$VIMRUNTIME/menu.vim"
               $VIM par défaut : "/usr/share/vim"
Compilation : gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/libffi-3.2.1/include -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread  -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Édition de liens : gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.30/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm  

Cannot get it to work

Hello,

first of, apologies if this is not the right place to ask. I cannot for the life of me figure out how to get this plugin to work. I have vim version 8.1 with python3 support (has('pythonx') and has('python3') both return 1) and I have installed neovim via pip (both locally with the --user flag and globally with sudo to see if it changes anything), but when running :echo neovim_rpc#serveraddr(), this is what I get:

[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function neovim_rpc#serveraddr:
line   15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovim` command to work
Press ENTER or type command to continue

Have I perhaps missed an installation step?

Thanks in advance!

Is there an option to turn vim-hug-neovim-rpc off?

So, I am using deoplete and coc. And I want to use deoplete for some filetypes, and coc for others.
What I want to do is use coc.vim for javascript, coc has its vim-node-rpc client, which is conflicting with vim-hug-neovim-rpc. I need vim-hug for deoplete to work in vim.
Now, what I do now is remove vim-hug from rtp. But, I don't think it's the right way to do it.

autocmd FileType javascript set runtimepath-=~/.config/nvim/repos/github.com/roxma/vim-hug-neovim-rpc
autocmd FileType javascript set runtimepath-=~/.config/nvim/repos/github.com/roxma/nvim-yarp

Is there a way to turn it off?

Tests and CI

Tests and CI are needed for the plugin to keep the compatibility.

error running in windows

if !has('nvim')
  " pip install msgpack-python
  Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'roxma/nvim-completion-manager'

image

"call s:py('import neovim')"failed

"pip3 install neovim" successed,
"python3 import neovim" error,
shows "no module named 'greenlet',
PC has files "d:\soft\need\Python\include\greenlet\greenlet.h"

rpc method [nvim_list_wins] not implemented

[vim-hug-neovim-rpc] rpc method [nvim_list_wins] not implemented in pythonx/neovim_rpc
_methods.py

Stacktrace:

[denite] Traceback (most recent call last):

[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\rplugin.py", line 65, in do_map

[denite] return do_map(ui, args[1], args[2])

[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\ui\map.py", line 20, in do_map

[denite] return MAPPINGS[name](denite, params)
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\ui\map.py", line 66, in _do_action

[denite] return denite.do_action(name, is_manual=True)
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\ui\default.py", line 97, in do_action

[denite] self._denite.do_action(self._context, action_name, candidates)
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\parent.py", line 63, in do_action

[denite] return self._get('do_action', [context, action_name, targets])
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\parent.py", line 84, in _get
[denite] return self._put(name, args)
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\parent.py", line 80, in _put
[denite] return self._child.main(name, args, queue_id=None) # type: ignore
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\child.py", line 79, in main
[denite] ret = self.do_action(args[0], args[1], args[2])
[denite] File "C:\Users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\child.py", line 260, in do_action

[denite] new_context = (action['func'](context)
[denite] File "c:\users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\kind\buffer.py", line 38, in action_preview

[denite] self._get_preview_window() and
[denite] File "c:\users\user-name\vimfiles\pack\minpac\start\denite.nvim\rplugin\python3\denite\kind\buffer.py", line 56, in _get_preview_window

[denite] return bool(next(f ilterfalse(
[denite] File "C:\Users\user-name\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\common.py", line 176, in _iter_

[denite] items = self._fetch()
[denite] File "C:\Users\user-name\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\api\nvim.py", line 182, in request

[denite] res = self._session.request(name, *args, **kwargs)
[denite] File "C:\Users\user-name\AppData\Local\Programs\Python\Python38\lib\site-packages\pynvim\msgpack_rpc\session.py", line 104, in request

[denite] raise self.error_wrapper(err)
[denite] pynvim.api.common.NvimError: nvim_list_wins not implemented

I want to send strings to terminal buffer.

Hello! I'm callmeklhei!

Can I send strings to terminal buffer with vim-hug-neovim-rpc?

Problems summary

I can not send strings to terminal buffer.

step 01: I create terminal buffer.

screen shot 2018-01-04 at 22 09 12

step 02: attach terminal buffer

screen shot 2018-01-04 at 22 08 04

screen shot 2018-01-04 at 22 08 42

Freeze... (^_^::

Expected

I can send strings to terminal buffer.

screen shot 2018-01-04 at 22 10 16

Environment Information

  • vim-hug-neovim-rpc version(SHA1):
vim-hug-neovim-rpc [master]$ gittree | head
* 	 6009384 Fri Dec 15 10:25:03 2017 +0800 implement nvim_err_write, nvim_out_write  (HEAD -> master, origin/master, origin/HEAD)
  • OS:
tmp$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.13.2
BuildVersion:	17C88
  • neovim/Vim version:
tmp$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 31 2017 18:45:52)
macOS version
Included patches: 1-1400
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.3.0 -lobjc    
tmp$ nvim --version
NVIM v0.2.3-dev
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180103-9790-l0wnjg/build/config -I/tmp/neovim-20180103-9790-l0wnjg/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180103-9790-l0wnjg/build/src/nvim/auto -I/tmp/neovim-20180103-9790-l0wnjg/build/include
Compiled by [email protected]

Features: +acl +iconv +jemalloc +tui 
See ":help feature-compile"

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/usr/local/Cellar/neovim/HEAD-09b9f9b/share/nvim"

Run :checkhealth for more info

Doesn't work on NixOS

Not really your problem, but maybe the right place to gather information on how to get this running on NixOS.

Installing python36Packages.neovim doesn't make this plugin visible in vim, so vim-hug-neovim-rpc will fail to import neovim python module. My config is

{
  allowUnfree = true;

  firefox = {
    enableGoogleTalkPlugin = false;
    enableAdobeFlash = false;
  };

  chromium = {
    enablePepperFlash = false;
    enablePepperPDF = true;
  };


  vim_configurable.customize = {
    guiSupport = true;
  };


  packageOverrides = pkgs_: with pkgs_; {

    my_vim = pkgs.vimHugeX.override {
      python = python3;
    };

    all = with pkgs; buildEnv {
      name = "all";

      paths = [
        ctags
        stack
        firefox
        wgetpaste
        spaceFM
        pnmixer
        cbatticon
        keepassxc
        pavucontrol
        workrave
        blueman
        my_vim
        neovim
        python2Full
        python3Full
        python27Packages.neovim
        python36Packages.neovim
pythonPackages.neovim
        python27Packages.pip
        python36Packages.pip
        stdenv
      ];
    };
  };
}

Document vim install steps for win32 users

Hello,

TDLR: For all windows users, install vim64bit and python64bit before running python3 -m pip install pynvim in a normal windows cmd.

Long story:

After multiple hours of searching, span accross multiple trials last year, and this year, I finally found the solution of a perplexing issue. Maybe it’s worth mentioning in the readme ?

I had both python32 and python64 installed on my system, and was using gvim-32bit (as blindly adviced in https://github.com/vim/vim-win32-installer/releases ).

Running :py3 import pip; pip.main(['install', '--user', 'pynvim']) from vim would trigger some errors because pip.main is not available anymore after pip 10. after correcting this, then some errors where pip complains that it’s not a tty.

However, running python3 -m pip install pynvim from the windows cmd works fine !

Then, from gvim-32bit, :python3 import pynvim would complain about greenlet not being installed. However, from gvim-32bit still, running :terminal then from this cmd run python3 then import pynvim would work fine !

After reading some forums, I realised that greenlet is probably some native code, and as such has to be the correct architecture. Even if this is wrong, I installed gvim-64bit instead, and now everything is good, all good.

Maybe none on the maintainers of this amazing lib is in my situation, but I though it would help other users like me (for example futur me).
You may close this issue if there is nothing more to add.

Best,

vim-hug-neovim-rpc fail to work with python3.6.1 on archlinux

image

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun  8 2017 20:51:28)
Included patches: 1-628
Compiled by Arch Linux

Same config works on windows with python3.5.3
When I switch to python2-neovim client, vim-hug-neovim-rpc works fine

Error Every time I load in vim8 (not neovim)

This seems to be a very common error with vim-hug-neovim-rpc

And I believe I followed all the correct instructions:

Error:

Error detected while processing /Users/chrisvaccaro/.vimrc:
line  118:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named ‘neovim'

Even though I ran pip install pynvim and pip install neovim successfully

No module named ‘neovim’ comes from calling it from my From my .vimrc:

if !has('nvim') " Vim 8 only
	pythonx import neovim
endif

Second error:

[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function <SNR>61_on_warmup[7]..<SNR>61_try_rnoti
fy[2]..yarp#core#try_notify[1]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#c
ore#serveraddr[1]..neovim_rpc#serveraddr:
line   15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovi
m` command to work
Error detected while processing function <SNR>61_on_warmup[7]..<SNR>61_try_rnoti
fy[2]..yarp#core#try_notify[1]..yarp#core#jobstart:
line    2:
E171: Missing :endif

:echo has(‘python’) returns 0 even though python in installed

Do I need to have this to point to the python location? (from .vimrc)

let g:pyenv_host_prog = '/usr/local/bin/pyenv'
let g:pip_host_prog = '/usr/local/bin/pip'
let g:python_host_prog = '/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/bin/'
let g:python3_host_prog = '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3’

let g:loaded_python_provider = 0
let g:loaded_python3_provider = 0

let $NVIM_PYTHON_LOG_FILE="/tmp/nvim_log"
let $NVIM_PYTHON_LOG_LEVEL="DEBUG"

How can I make 100% sure that the right location

also added:

if has('pythonx')
	set pyxversion=3
endif

echo neovim_rpc#serveraddr() returns /var/folders/4q/zfgdfzzzzdzzzzzdfgzgzgzzg, so i don’t think it worked right

alternative methods besides TCP

The problem with TCP is that the port is exposed and a malicious app can listen and write to it.
Are there plans to provide alternative protocol such as named pipes.

Not working on Windows

OS: window 10 x64
Vim: v8.0.1188 x64
Python 3.5.4 x64

When I install NCM and vim-hug-neovim-rpc, cm_start.py is being opened endlessly in new instances of Vim.

[nvim_set_client_info] no...m_rpc_methods.py

I am on Arch, and a few days ago after a huge list of python-[X] packages popped up in an update I started receiving the following error in vim when going into insert mode .. ( no errors on launch )

[vim-hug-neovim-rpc] rpc method [nvim_set_client_info] no...m_rpc_methods.py. Please send PR or contact the mantainer

I have re-performed the install/setup process I originally did but has no impact... figure I would try and ask here while I continue to scratch my head and figure it out ;-)

Android Issue - getaddrinfo()

Hello,
Not the fault of neovim-rpc.
I am trying to get this working on a chromebook running ChromeOS under Termux.
When executing "echo neovim_rpc#serveraddr()", I get:
~
[No Name] 0,0-1 All
Error detected while processing function neovim_rpc#serveraddr:
line 29:
E901: getaddrinfo() in channel_open(): Invalid value for ai_flags
line 32:
E906: not an open channel
/data/data/com.termux/files/usr/tmp/vbxd8DR/0
Press ENTER or type command to continue

Is there a way I can work around this, do I need to rewrite the call to getaddrinfo() so that its compatible?

Thanks for any pointers you can give me.

Sam

ImportError: undefined symbol: PyExc_ValueError

I cannot seem to get this plugin to work. Below is some system information:

$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 29 2019 20:08:59)
$ python3 --version
Python 3.7.3
$ uname -roms
Linux 5.0.5-arch1-1-ARCH x86_64 GNU/Linux

Vim:

:echo has('pythonx') 1

:echo has('python3) 1

:set pyxversion? pyxversion=3

It should be noted that importing pynvim through standard python3 shell works without errors. But when I try to import pynvim through vim, this error happens:

:python3 import pynvim

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/pynvim/__init__.py", line 11, in <module>
    from .msgpack_rpc import (ErrorResponse, child_session, socket_session,
  File "/usr/lib/python3.7/site-packages/pynvim/msgpack_rpc/__init__.py", line 10, in <module>
    from .session import ErrorResponse, Session
  File "/usr/lib/python3.7/site-packages/pynvim/msgpack_rpc/session.py", line 7, in <module>
    import greenlet
ImportError: /usr/lib/python3.7/site-packages/greenlet.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError
Press ENTER or type command to continue

What could be the cause of this issue?

I want to use the method `self.vim.current.buffer.append`.

Hello again! I'm callmekohei.

Thank you your vim-hug-neovim-rpc!


I wanna ...

I want to use following method:

self.vim.current.buffer.append

ScreenShot

screen shot 2017-12-12 at 1 19 07

vim-hug-neovim-rpc's message

[vim-hug-neovim-rpc] 
rpc method [nvim_buf_set_lines] not implemented in pythonx/neovim_rpc_methods.py. 
Please send PR or contact the mantainer.

Cause my code

def quirkrunfs(self,lines):

    lst = list(filter(lambda b:os.path.basename(b.name) == 'quickrunfs-output', self.vim.buffers ))

    if len(lst) != 0:
        self.vim.command("bw!{quickrunfs-output}")

    self.vim.command("vsplit quickrunfs-output")
    self.vim.command("setlocal buftype=nofile")
    self.vim.command("setlocal bufhidden=hide")
    self.vim.command("setlocal noswapfile")
    self.vim.command("setlocal nobuflisted")

    buf_quickrunfs = self.vim.current.buffer

    [ buf_quickrunfs.append(line, line_number)  # <------ THIS !!!
        for line, line_number in zip ( lines , range(0, len(lines)) ) ]

    self.vim.command("wincmd p")

Thank you (^_^)/

Bug - Tries to create ThreadedUnixServer on Windows if NVIM_LISTEN_ADDRESS is defined

see in neovim_rpc_server.py L329 onwards

    if 'NVIM_LISTEN_ADDRESS' in os.environ:
        nvim_server_addr = os.environ['NVIM_LISTEN_ADDRESS']
        if nvim_server_addr.find(':') >= 0:
            host, port = nvim_server_addr.split(':')
            port = int(port)
            _nvim_server = ThreadedTCPServer((host, port), NvimHandler)
        else:
            if os.path.exists(nvim_server_addr):
                try:
                    os.unlink(nvim_server_addr)
                except:
                    pass
            _nvim_server = ThreadedUnixServer(nvim_server_addr, NvimHandler)
    elif not has_unix:
        _nvim_server = ThreadedTCPServer(("127.0.0.1", 0), NvimHandler)
        nvim_server_addr = "{addr[0]}:{addr[1]}".format(
            addr=_nvim_server.server_address)
    else:
        nvim_server_addr = vim.eval('tempname()')
        _nvim_server = ThreadedUnixServer(nvim_server_addr, NvimHandler)
    _nvim_server.daemon_threads = True

Specify a path to the python program with the module installed

I have multiple python virtual environments installed on my pc, but I don't want to install pynvim in all of them.

Would it be possible to specify a certain path to an python executable that has this module installed, instead of letting vim search in the PATH for the first python executable it can find?

Vim-node-rpc

#50 (comment)
So, I commeted these lines

" autocmd FileType javascript set runtimepath-=~/.config/nvim/repos/github.com/roxma/vim-hug-neovim-rpc
" autocmd FileType javascript set runtimepath-=~/.config/nvim/repos/github.com/roxma/nvim-yarp

When, I open vim, these are the messages I get

[vim-hug-neovim-rpc] rpc method [nvim_set_client_info] not implemented in pythonx/neovim_rpc_methods.py. Please send PR or contact the
 mantainer.
[vim-hug-neovim-rpc] rpc method [nvim_get_vvar] not implemented in pythonx/neovim_rpc_methods.py. Please send PR or contact the mantai
ner.
[vim-node-coc]: Channel create error: request nvim_get_vvar - nvim_get_vvar not implemented

use stdio for communication?

Hi, I'm considering using stdio to communicate with the Python process, to avoid security issues I've talked about in #1. What do you think about this idea?

PS: Firefox uses stdio for extensions to communicate with its native application too.

Using latest neovim-package(pynvim) error

The example is defx error message in Vim8.

[defx] Vim(pythonx):Traceback (most recent call last):
[defx] function defx#util#call_defx[2]..defx#start[1]..defx#initialize[1]..defx#init#_initialize[5]..defx#init#_channel[18]..yarp#core#request[1]..yarp#core#wait_channel[5]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#core#serveraddr[1]..neovim_rpc#serveraddr[19]..<SNR>42_py, line 1

It seems fails to execute the line.
https://github.com/roxma/vim-hug-neovim-rpc/blob/master/autoload/neovim_rpc.vim#L36

call s:py('import neovim_rpc_server')

Failing to start

2019-09-21 23:48:37,607 [INFO @ neovim_rpc_server.py:handle:84] 143679 - === socket opened ===
2019-09-21 23:48:37,607 [INFO @ neovim_rpc_server.py:handle:103] 143679 - received: b'[1,"neovim_rpc_setup"]\n'
2019-09-21 23:48:37,607 [INFO @ neovim_rpc_server.py:handle:120] 143679 - sending ["ex", "call neovim_rpc#_callback()"]
2019-09-21 23:48:37,629 [INFO @ neovim_rpc_server.py:process_pending_requests:364] 143679 - process_pending_requests
2019-09-21 23:48:39,807 [ERROR @ base_request.py:HandleFuture:90] 143679 - HTTPConnectionPool(host='127.0.0.1', port=59521): Max retries exceeded with url: /ready (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fac1b4c9550>: Failed to establish a new connection: [Errno 111] Connection refused'))

I have python 3.7.4 (default, Jul 16 2019, 07:12:58)

pynvim isn't working

The attached log looks like it doesn't even try pynvim, but just goes straight to neovim.

myVim.log

(py310) MBP-bhundven:~ bhundven$ echo $VIRTUAL_ENV
/Users/bhundven/.virtualenvs/py310
(py310) MBP-bhundven:~ bhundven$ python3 -m pip list | grep pynvim
pynvim                 0.4.3

But weirdly, in vim:

:pythonx import pynvim
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pynvim'

:python3 import pynvim does the same. So I'm not sure what is going on.

Could not find neovim

python3 -c "import neovim" works perfectly fine.

Error message while starting vim:

[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):

I have set pyxversion=3.

.vimrc:

set nocompatible              " be iMproved, required
filetype off                  " required
syntax enable

set pyx=3
set pyxversion=3
set backspace=indent,eol,start

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
Plugin 'derekwyatt/vim-scala'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
let g:airline_theme = 'luna'
let g:powerline_symbols = 'unicode'

Plugin 'sheerun/vim-polyglot'

Plugin 'roxma/vim-hug-neovim-rpc'
Plugin 'roxma/nvim-yarp'
Plugin 'shougo/deoplete.nvim'
let g:deoplete#enable_at_startup = 1

Plugin 'zchee/deoplete-jedi'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

Could not find neovim

I have installed neovim via pip install neovim, and in vim the command :python import neovim has no errors. However, when I opened the vim, it reported that No module named 'neovim'.

Unable to import neovim

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

An error occurs attempting to use deoplete on Vim8.

[vim-hug-neovim-rpc] Vim(python3):Traceback (most recent call last):
Error detected while processing function deoplete#enable[1]..deoplete#initialize[1]..deoplete#init#_initialize[17]..deoplete#init#_variables[12]..neovim_rpc#serveraddr:
line 15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires :python3 import neovim command to work
Press ENTER or type command to continue

Expected

After following installation instructions, installing the plugins and performing the following commands

pip3 install neovim
python3 -c 'import neovim'

and seeing that both succeed, there should not be error messages saying that python3 can not import neovim.

Environment Information

I am using asdf-vm as a version manager, with python 3.6.1 installed on an Ubuntu 17.04 system.

" Minimal .vimrc to reproduce issue
call plug#begin()
  Plug 'Shougo/deoplete.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
call plug#end()

let g:deoplete#enable_at_startup = 1

The reproduce ways from neovim/Vim starting (Required!)

This error occurs on startup/attempting to enable deoplete

I actually have a workaround, and I'm not entirely sure where the fix really lies. However, since the error mentions that it's vim-hug-neovim-rpc that requires a command to succeed, that appears to succeed from the terminal, I figured I'd start here.

The issue appears to be caused that vim-hug-neovim-rpc when it attempts to require packages is not able to find the correct site-packages folder. If I manually export PYTHONPATH to the correct path, deoplete loads successfully. It seems that setting PYTHONPATH is usually not recommended, and it doesn't seem to be required for any other commands on my system for python3 and pip3 to work successfully.

export PYTHONPATH="~/.asdf/installs/python/3.6.1/lib/python3.6/site-packages"

Appears to be a temporary fix, is there a better solution to this?

Multiple Python versions

I'm on Fedora 33 with Python 3.9. It works just fine with every project that uses explicitly python3.9 or implicit python(3)?, both with and without a virtual environment.

However, I do have a project that requires 3.7 and won't run on newer versions and I'd like to keep using awesome python-language-server and asynchronous deoplete as regular synchronous jedi tends to block the whole editor's thread with bigger libraries like SQLAlchemy, but some of plugins just won't let me.

Sure thing I did install neovim and pynvim packages in my virtual environment.
echo exepath('python3') returns /home/euromancer/source/airflow/.venv/bin/python3 and has('pythonx') returns 1, however, has('python') returns 0. Nothing mysterious in my vimrc, just lsp#register_server() and few configs for lsp. Nothing special on deoplete as well.

I've quickly checked the source code, however, I'm not very familiar with vimscript nor vim plugins nor probably anything. Although I think it might be linked to list of python executables to check availability.

Sure thing all the packages and plugins and everything (except Python 3.7 lol) are up to date.

My completion-related plugins are:

  • Shougo/deoplete.nvim
  • prabirshrestha/vim-lsp
  • lighttiger2505/deoplete-vim-lsp

And I do have roxma/nvim-yarp and roxma/vim-hug-neovim-rpc.

Never tested it with neovim tho, as I prefer vim for some whatever reasons I find hard to point out.

I did install neovim and pynvim and python-language-server on the global Python 3.7 installation.

The issue was present on Ubuntu 20.04 with Python 3.8 too.

Screenshot from 2021-04-07 14-39-05

Don't have valid neovim_rpc#serveraddr()

Ubuntu 18.04 & Vim 8, trying to use ncm2, ncm-R, and Nvim-R for R development. As for vim-hug-neovim-rpc, when I ran :echo neovim_rpc#serveraddr(), didn't get the address but "/tmp/vPac7C8/0" instead. What does it mean and is it the reason for ncm not working?

FYI, I can run neovim in python3. :echo has('python3') returns 1.

Thanks, appreciate your time!

Get errors in vim8


Messages maintainer: Bram Moolenaar <[email protected]>
Error detected while processing function HandleBufReadPost[1]..yarp#core#notify[1]..yarp#core#wait_channel[5]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#core#serveraddr[1]..neovim_rpc#serveraddr:
line   15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovim` command to work
Error detected while processing function HandleBufReadPost[1]..yarp#core#notify[1]..yarp#core#wait_channel[5]..yarp#core#jobstart:
line    2:
E171: Missing :endif
Error detected while processing function HandleBufReadPost[1]..yarp#core#notify[1]..yarp#core#wait_channel:
line    5:
E171: Missing :endif

in neovim has('python') and has('python3') both return 1, and I install the client via pip install --user neovim and pip3 install --user neovim.

this plugin use pythonx by default, I think it will cause some issue:

if has('pythonx')
	let s:py = 'pythonx'
	let s:pyeval = function('pyxeval')
elseif has('python3')
	let s:py = 'python3'
	let s:pyeval = function('py3eval')
else
	let s:py = 'python'
	let s:pyeval = function('pyeval')
endif

in my pc, has('pythonx') return 1, and pyxversion=3 bydefault, then I can not use python2 remote plugin, BTW, if I want to use python2 remote plugin and python3 remote plugin at the same time, how should I do?

I will try to fix this issue, and send some PRs. test will be done in SpaceVim/SpaceVim#994

failed executing: pythonx import neovim (archlinux)

Im on Vim 8.1:

Following statements are true:

has('pythonx')
has('python')
has('python3')

neovim seem to be installed correctly:

Python 2.7.15 (default, May  1 2018, 20:16:04) 
[GCC 7.3.1 20180406] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import neovim
>>> 

Python 3.6.5 (default, May 11 2018, 04:00:52) 
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import neovim
>>> 

When i open vim i get this error:

[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last)

As cfg i have:

" Deoplete
set pyxversion=3
set encoding=utf-8
let g:python_host_prog = "/usr/bin/python2"
let g:python3_host_prog = "/usr/bin/python3"
let g:deoplete#enable_at_startup = 1

Plugin 'roxma/nvim-yarp'
Plugin 'roxma/vim-hug-neovim-rpc'
Plugin 'Shougo/deoplete.nvim'

Cann't start deoplete.nvim on Vim 8

First I posted it to deoplete Shougo/deoplete.nvim#616 but I was said issue caused by this plugin.

Problems summary

Deoplete cann't start and :call deoplete#enable() produces error:

[deoplete] Vim(let):E716: Key not present in Dictionary: 2
[deoplete] function deoplete#enable[1]..deoplete#initialize[1]..deoplete#init#_initialize[19]..deoplete#init#_channel[10]..yarp#core#notify[1]..yarp#core#wait
_channel[21]..neovim_rpc#_on_stderr, line 2

Expected

Successfull launch.

Environment Information

  • deoplete version(SHA1): a338ca8bbee086cc7b9265ae181f22de86d38491

  • vim-hug-neovim-rpc version(SHA1) : 6009384

  • nvim-yarp version(SHA1): b222af8dbbfb35c6d833fd76a940f6ca2fe322fa

  • OS: Gentoo Linux AMD64

  • neovim/Vim version: Vim 8.0.1298

  • :checkhealth or :CheckHealth result(neovim only):

Provide a minimal .vimrc with less than 50 lines (Required!)

set rtp+=~/.vim/bundle/deoplete.nvim
set rtp+=~/.vim/bundle/nvim-yarp
set rtp+=~/.vim/bundle/vim-hug-neovim-rpc

" Use deoplete.
let g:deoplete#enable_at_startup = 1

The reproduce ways from Vim starting (Required!)

  1. Install Shougo/deoplete.nvim, roxma/nvim-yarp, roxma/vim-hug-neovim-rpc
  2. Run :call deoplete#enable()

Upload the log file

nvim_log_py3_neovim_rpc_server.log

neovim imp error

when start vim it shows:

[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):/must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative u
ses

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.