ncm2 / ncm2-jedi

MIT License
23 stars 11 forks source link

can't work if add option `--remote-tab-silent` #3

Closed fcying closed 6 years ago

fcying commented 6 years ago

When I modify a python file in windows, it can't complete, it work fine in linux.

Plug 'roxma/vim-hug-neovim-rpc'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-tmux'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-pyclang'
Plug 'ncm2/ncm2-jedi'
Plug 'jsfaint/ncm2-vim'
Plug 'Shougo/neco-vim'
Plug 'jsfaint/ncm2-syntax'
Plug 'Shougo/neco-syntax'

ncm2_log_py3_ncm2_core:

2018-07-18 11:38:47,610 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\gen_tags.vim\ncm2-plugin\ncm2_gtags.vim
2018-07-18 11:38:47,618 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-bufword\ncm2-plugin\ncm2_bufword.vim
2018-07-18 11:38:47,621 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-tmux\ncm2-plugin\ncm2_tmux.vim
2018-07-18 11:38:47,624 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-path\ncm2-plugin\ncm2_path.vim
2018-07-18 11:38:47,625 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-pyclang\ncm2-plugin\ncm2_libclang.vim
2018-07-18 11:38:47,626 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-jedi\ncm2-plugin\ncm2_jedi.vim
2018-07-18 11:38:47,628 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-vim\ncm2-plugin\ncm2_vim.vim
2018-07-18 11:38:47,629 [INFO @ ncm2_core.py:load_plugin:69] 21356 - send vimscript plugin d:\tool\vim\plugged\ncm2-syntax\ncm2-plugin\ncm2_syntax.vim

reproduce way:

gvim t.py
i
import os
roxma commented 6 years ago

I don't have a windows dev pc currently.

I'll find some free time to setup and test it.

fcying commented 6 years ago

@roxma It's not a issue on windows only. I just set --remote-tab-silent by default in windows. If I set this options in linux, it can't work too. When I add --remote-tab-silent, all source can't work.

test in debian:

vim --remote-tab-silent t.py
roxma commented 6 years ago

hmm... vim8 --remote-tab-silent t.py works fine on my Debian.

Which version of vim are you using?

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul  4 2018 16:09:10)
Included patches: 1-135
Compiled by roxma@roxma-pc
Huge version with GTK2 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              +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           +python/dyn        +viminfo
+conceal           +linebreak         +python3/dyn       +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       -lua               -ruby              +writebackup
+dialog_con_gui    +menu              +scrollbind        +X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       +xim
+dnd               +mouse             +startuptime       -xpm
-ebcdic            +mouseshape        +statusline        +xsmp_interact
+emacs_tags        +mouse_dec         -sun_workshop      +xterm_clipboard
+eval              -mouse_gpm         +syntax            -xterm_save
+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"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/home/roxma/.local/stow/vim-8.1.0135/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -ldl
fcying commented 6 years ago

I rebuild the last vim, The same problem

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 19 2018 19:13:43)
Included patches: 1-196
Compiled by fcying
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              +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           -python            +viminfo
+conceal           +linebreak         +python3           +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua/dyn           +ruby/dyn          +writebackup
+dialog_con        +menu              +scrollbind        +X11
+diff              +mksession         +signs             +xfontset
+digraphs          +modify_fname      +smartindent       -xim
-dnd               +mouse             +startuptime       -xpm
-ebcdic            -mouseshape        +statusline        +xsmp_interact
+emacs_tags        +mouse_dec         -sun_workshop      +xterm_clipboard
+eval              -mouse_gpm         +syntax            -xterm_save
+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: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -fstack-protector -rdynamic -Wl,-export-dynamic -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib  -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl/lib  -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl/lib -L/home/linuxbrew/.linuxbrew/opt/readline/lib  -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/readline/lib  -L/usr/local/lib -Wl,--as-needed -o vim    -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl   -lacl -lattr -ldl     -L/home/linuxbrew/.linuxbrew/Cellar/python/3.6.4_5/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm

myvimrc

set nocompatible
set mouse=n

set runtimepath+=~/.vim/plugged/vim-hug-neovim-rpc
set runtimepath+=~/.vim/plugged/nvim-yarp
set runtimepath+=~/.vim/plugged/ncm2
set runtimepath+=~/.vim/plugged/ncm2-jedi

set completeopt=noinsert,menuone,noselect
autocmd BufEnter * call ncm2#enable_for_buffer()

filetype plugin indent on
syntax enable
roxma commented 6 years ago

It looks like --remote-tab-silent is affecting the BufEnter autocmd

autocmd BufEnter * call ncm2#enable_for_buffer()

Manually :call ncm2#enable_for_buffer() should work.

roxma commented 6 years ago

Try

autocmd BufEnter,BufRead * call ncm2#enable_for_buffer()
fcying commented 6 years ago

Manually :call ncm2#enable_for_buffer() after vim enter, can work. add call ncm2#enable_for_buffer() or autocmd BufEnter,BufRead * call ncm2#enable_for_buffer() to vimrc can't work also.

fcying commented 6 years ago

autocmd InsertEnter * call ncm2#enable_for_buffer() can work with --remote-tab-silent.
but it conflict with vim-multiple-cursors. I need close ncm2 complete when I use vim-multiple-cursors, if I use InsertEnter, ncm2 complete reopen by modify multiple-cursors.

  function! Multiple_cursors_before()
    let g:multiple_cursors_temp = &foldmethod
    set foldmethod=manual
    call ncm2#disable_for_buffer()
  endfunction

  " Called once only when the multiple selection is canceled (default <Esc>)
  function! Multiple_cursors_after()
    let &foldmethod = g:multiple_cursors_temp
    call ncm2#enable_for_buffer()
  endfunction  
roxma commented 6 years ago

but it conflict with vim-multiple-cursors.

There's ncm2#lock(name) and ncm2#unlock(name) function for co-operating with other tools

fcying commented 6 years ago

It can work by useing ncm2#lock(name), just popup some warning msg, But does not affect to use.

E486: Pattern not found: \<lock\>
Key '(ncm2_complete_popup)' cannot be replayed at 1 cursor location
Key '^[^[^[u' cannot be replayed at 1 cursor location
autocmd InsertEnter * call ncm2#enable_for_buffer()
  function! Multiple_cursors_before()
    let g:multiple_cursors_temp = &foldmethod
    set foldmethod=manual
    call ncm2#lock('vim-multiple-cursors')
  endfunction

  " Called once only when the multiple selection is canceled (default <Esc>)
  function! Multiple_cursors_after()
    let &foldmethod = g:multiple_cursors_temp
    call ncm2#unlock('vim-multiple-cursors')
  endfunction
roxma commented 6 years ago

Warning is now fixed.

fcying commented 6 years ago

It works fine, thanks a lot~~

balta2ar commented 6 years ago

@fcying By the way, do know about this recently emerged alternative plugin for multiple cursors? https://github.com/mg979/vim-visual-multi It is much more powerful, it's faster, it easily handles tens of cursors at a time, and it works great with completion menu in multiple cursors mode. Sorry if it sounds like a sales pitch, but I switched and I'm not looking back. (if you decide to give it a try, be sure to checkout test branch).

fcying commented 6 years ago

@balta2ar Thank you for recommending, I will try this at night~_~

fcying commented 6 years ago

@balta2ar mg979/vim-visual-multi is better, thank you again for recommending.