Shougo / neocomplete.vim

Next generation completion framework after neocomplcache
2.74k stars 203 forks source link

neocomplete preview window alternative #120

Closed Netherdrake closed 10 years ago

Netherdrake commented 10 years ago

Hi,

My issue is as follows: http://stackoverflow.com/questions/20164541/golang-vim-autocomplete-hints

I am wondering if you know how could I achieve this.

Thanks, your plugin is awesome!

Shougo commented 10 years ago

OK. I get it. I want to implement this feature. I don't like preview window feature, too.

Netherdrake commented 10 years ago

Thanks, sir, you are awesome!

Shougo commented 10 years ago

I added the feature. Please install echodoc and enable it.

https://github.com/Shougo/echodoc.vim

Netherdrake commented 10 years ago

Thanks for quick response, but it doesn't seem to work for me. Here is my vimrc. https://bitbucket.org/furion/dotfiles

Shougo commented 10 years ago

You must upgrade neocomplete.

Netherdrake commented 10 years ago

I did.

Netherdrake commented 10 years ago

I managed to get it pop once but otherwise it doesn't work. Maybe its smt wrong with my config.

Shougo commented 10 years ago

screenshot

It works for me. You should create minimal .vimrc. I will check it.

Shougo commented 10 years ago

Can you upload gif screenshot for your behavior?

Netherdrake commented 10 years ago

Nothing appears on status line on bottom, however neocomplete menu works fine. http://imgur.com/cFcpdqu

Shougo commented 10 years ago

I think it is your settings problem. But your .vimrc is too huge. You must reduce and minimize .vimrc and upload it.

Netherdrake commented 10 years ago

I disabled all of the plugins and all of my vimrc, now its just neocomplete and golang: http://pastebin.com/1Tw93UpM

And it still doesn't work. Could be something in my neocomplete config.

http://imgur.com/eva0EwQ,fCBLgxT#0 http://imgur.com/eva0EwQ,fCBLgxT#1

EDIT: I stripped down my .vimrc even further, still no luck: http://pastebin.com/JVaWRSt2

Shougo commented 10 years ago

Above code is not minimal. You must reduce codes more and more. Minimalist plugin is:

only.

And your .vimrc settings also too huge.

OK. Minimal settings is like this:

set encoding=utf-8

" start vundler
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Bundle "nsf/gocode"
Bundle "Blackrush/vim-gocode"

  Bundle "Shougo/neocomplete"
  Bundle "Shougo/echodoc.vim"

" enable all the plugins
filetype plugin indent on

  let g:neocomplete#data_directory = "~/.vim/tmp/swap"
  " Use neocomplete.
  let g:neocomplete#enable_at_startup = 1

  " Enable heavy omni completion.
  if !exists('g:neocomplete#sources#omni#input_patterns')
    let g:neocomplete#sources#omni#input_patterns = {}
  endif

  " golang fix
  let g:neocomplete#sources#omni#input_patterns.go = '[^.[:digit:] *\t]\.\w*'

Can you test it?

Netherdrake commented 10 years ago

Ok, I used your minimal sample, and it still doesn't work. I ran :BundleUpdate again, no new updates.

Shougo commented 10 years ago

OK. I get it. To use echodoc, you must set cmdheight to 2 in .vimrc

set cmdheight=2
Netherdrake commented 10 years ago

Ok, I am running the minimal sample and cmdheight=2, still no luck.

Shougo commented 10 years ago
" .vimrc
set nocompatible

let s:neobundle_dir = expand('~/.bundle')

set runtimepath+=~/work/neobundle.vim

call neobundle#rc(s:neobundle_dir)

set runtimepath+=~/work/neobundle.vim/
set runtimepath+=~/work/neocomplete.vim/
set runtimepath+=~/work/echodoc.vim/

NeoBundleLazy 'nsf/gocode', {
      \ 'rtp' : 'vim',
      \ 'autoload' : {
      \   'filetypes' : 'go',
      \ }}

let g:neocomplete#enable_at_startup = 1
let g:echodoc_enable_at_startup = 1

filetype plugin indent on

set completeopt+=menuone
set completeopt-=preview

set cmdheight=2

I tested it(using neobundle) and it works.

Shougo commented 10 years ago
let g:echodoc_enable_at_startup = 1

is needed.

Netherdrake commented 10 years ago
set encoding=utf-8

" start vundler
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Bundle "nsf/gocode"
Bundle "Blackrush/vim-gocode"

Bundle "Shougo/neocomplete"
Bundle "Shougo/echodoc.vim"

" enable all the plugins
filetype plugin indent on

set cmdheight=2
set completeopt+=menuone
set completeopt-=preview
let g:neocomplete#enable_at_startup = 1
let g:echodoc_enable_at_startup = 1

" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif

" golang fix
let g:neocomplete#sources#omni#input_patterns.go = '[^.[:digit:] *\t]\.\w*'

No luck.

Shougo commented 10 years ago

It may be Vim's version problem. Can you upgrade Vim?

screenshot

In my environment, it works in minimal .vimrc.

Shougo commented 10 years ago

I think you should install neobundle and try my minimal .vimrc.

Netherdrake commented 10 years ago

I have Vim 7.4.52.

if has('vim_starting')
   set nocompatible               " Be iMproved
   set runtimepath+=~/.vim/bundle/neobundle.vim/
 endif

 call neobundle#rc(expand('~/.vim/bundle/'))

 " Let NeoBundle manage NeoBundle
 NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle "nsf/gocode"
NeoBundle "Blackrush/vim-gocode"
NeoBundle "Shougo/neocomplete"
NeoBundle "Shougo/echodoc.vim"

set cmdheight=2
set completeopt+=menuone
set completeopt-=preview
let g:neocomplete#enable_at_startup = 1
let g:echodoc_enable_at_startup = 1

filetype plugin indent on

No luck

Shougo commented 10 years ago

You must select candidate by <C-y>. I think your key operations are wrong.

Netherdrake commented 10 years ago

Doesn't matter. The minimal vimrc doesn't have the key-bindings setting. I tried it on 2 machines, both don't work.

My second machine is:

jan@arch ~/D/g/s/g/N/b/sql> vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 10 2013 20:26:12)
Included patches: 1-86
Compiled by Arch Linux
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -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/glib-2.0/include -I/usr/include/freetype2  -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -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 -lncurses -lelf -lnsl   -lacl -lattr -lgpm -ldl  -L/usr/lib -llua -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic   -lruby -lpthread -lrt -ldl -lcrypt -lm  -L/usr/lib   
Shougo commented 10 years ago

Operations:

  1. input "fmt." popup is shown
  2. Select candidate "Scan(" by <C-n>.
  3. Close popup by <C-y>.
  4. Printed candidate arguments.
Netherdrake commented 10 years ago

Oh. <C-y> does the trick. Thank you!

incorvia commented 10 years ago

Is it not possible to autocomplete the function arguments rather then putting it in a scratch or printing it using echodoc? Having it inline would obviously be amazing.

Shougo commented 10 years ago

Having it inline would obviously be amazing.

I don't want to implement it. Yes, some plugins implement it(like jedi-vim). But, it is complicated feature.

incorvia commented 10 years ago

Thank you for the response and all the great work.

sirfz commented 9 years ago

Is there a specific configuration for echodoc with jedi? Doesn't seem to work for me. (tried with increased cmdheight and also noshowmode). Ctrl+y doesn't display anything.

Shougo commented 9 years ago

jedi does not support echodoc. To support it, you must write Vim script code like neocomplete.