ervandew / supertab

Perform all your vim insert mode completions with Tab
3.18k stars 214 forks source link

E475: Invalid argument: pumvisible() ? "\<C-P>" : "\<S-Tab>" #185

Open M4rtinK opened 7 years ago

M4rtinK commented 7 years ago

After updating supertab from the master branch I'm getting the following error at vim startup:

$ vim
Error detected while processing /home/user/.vim/bundle/supertab/plugin/supertab.vim:
line 1000:
E475: Invalid argument: pumvisible() ? "\<C-P>" : "\<S-Tab>"
Press ENTER or type command to continue

The issue happens on Fedora 25 with vim version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 10 2017 11:31:25)
Included patches: 1-324
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
-clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "/etc/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: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -Werror=format-security -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro   -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux   -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-z,relro  -Wl,-z,relro  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -lnsl -ldl -lm -lcrypt -lutil -lc
igorilic commented 7 years ago

Same here, this happened after the update to vim 8, on vim 7 works fine.

empijei commented 7 years ago

If you use Vundle, or any other plugin manager, moving supertab as the first plugin being loaded should solve the issue.

The problem is caused by an experimental feature that is supposed to save users current mapping.

Quoting the author:

  " Note: this could cause more problems than it solves if it picks up <s-tab>
  " mappings from other plugins and misinterprets them, etc, so this block is
  " experimental and could be removed later.

To be precise, make sure you load supertab before YouCompleteMe

metalelf0 commented 7 years ago

Having the same issue, @empijei fix didn't solve it for me unfortunately. Using it on neovim latest head, no YCM. Put supertab at the top of my vim-plug block but the problem is still there.

miessos commented 7 years ago

Unfortunately @empijei's solution didn't work for me either.

empijei commented 7 years ago

@miessos are you on neovim too? Could you please share a list of plugins you're using/the vimrc lines before supertab plug?

miessos commented 7 years ago

@empijei see attached files: scriptnames.pdf is output from - well... obviously :) - the scriptnames command within vim and the other is the .vimrc.bundle I'm using.

I'm using VIM 8.0 (2016 Sep 12, compiled May 25 2017 12:22:08)

scriptnames.pdf vimrc_bundles.pdf

empijei commented 7 years ago

I'm sorry but I could not find the problem there. My best guess is to comment out lines in plugin/supertab.vim in the supertab bundle around line 993 in order to avoid picking up S-Tab mappings.. :disappointed:

miessos commented 7 years ago

@empijei your guess does suppress the error and supertab seems still functional

empijei commented 7 years ago

Happy to read that :)

D1mon commented 7 years ago

same error. (neovim)

empijei commented 7 years ago

Have you tried this: https://github.com/ervandew/supertab/issues/185#issuecomment-282976512 ?

D1mon commented 7 years ago

@empijei not working

metalelf0 commented 7 years ago

As a temporary workaround you can use this fork, with the lines regarding the S-Tab mappings commented out as @empijei suggested. This is the commit, if you wanna DIY. HTH.

D1mon commented 7 years ago

@metalelf0 Works!!!

Mte90 commented 5 years ago

The problem it is still there after years...

Lord-of-the-Galaxy commented 4 years ago

The problem still exists....

hvpkod commented 4 years ago

Get the same problem after installing some new plugins installed (tpope/vim-fugitive, tpope/vim-fugitive and tpope/vim-fugitive)

dagadbm commented 4 years ago

still the same issue yes.. nvim 0.5

dagadbm commented 4 years ago

this repo is dead for some years now anyways..

dagadbm commented 4 years ago

even with the forked repo i do the imap tab and i get that it is defined on UltiSnips and not on supertab (even putting it first or last in the plugin list)

cube-p commented 3 years ago

I solve it with this:

I went to the directory: ~ / .vim / plugged / supertab / plugin (the directory will depend on where you save your plugins)

with neovim enter the supertab.vim file and look for the pumvisible line (to search in vim, in normal mode put / and pumvisible ())

after this, delete everything that is in the function pumvisible (), now save the changes

in my case when I save the changes it told me that an endfunction was missing in a line

what you have to do is enter supertab.vim again and go to the last line, there you put an endfunction in another line

and problem solved¡

TheApeMachine commented 3 years ago

From line 247 to 259, just rewrite the function like this:

 function! SuperTabLongestHighlight(dir) " {{{
   " When longest highlight is enabled, this function is used to do the actual
   " selection of the completion popup entry.

   if !pumvisible()
     return ''
   endif
   if a:dir == -1
     return "\<up>"
   else
     return "\<down>"
   endif
 endfunction " }}}

Don't know vim script, but I am guessing for some reason his vim supports the oneliner if else syntax and some of ours don't? In any case if you still have an error after that, look in your own vimrc, I had some stuff copied from the readme which used the same syntax and turned out I didn't even need it.

TheApeMachine commented 3 years ago

Sorry, I hate myself, probably nicer like this:

 function! SuperTabLongestHighlight(dir) " {{{
   " When longest highlight is enabled, this function is used to do the actual
   " selection of the completion popup entry.

   if !pumvisible()
     return ''
   endif

   if a:dir == -1
     return "\<up>"
   endif

   return "\<down>"
 endfunction " }}}

I don't know...

LutfiLokman commented 1 year ago

Search for this block in supertab.vim and delete this whole block (it does says its experimental and could cause problems):

 " save user's existing <s-tab> mapping if they have one.
  " Note: this could cause more problems than it solves if it picks up <s-tab>
  " mappings from other plugins and misinterprets them, etc, so this block is
  " experimental and could be removed later.
  if g:SuperTabMappingForward ==? '<s-tab>' || g:SuperTabMappingBackward ==? '<s-tab>'
    let stab = maparg('<s-tab>', 'i')
    if s:has_dict_maparg
      let existing_stab = maparg('<s-tab>', 'i', 0, 1)
      if len(existing_stab) && existing_stab.expr
        let stab = substitute(stab, '<SID>\c', '<SNR>' . existing_stab.sid . '_', '')
        let stab = substitute(stab, '()$', '', '')
        let s:ShiftTab = function(stab)
        let stab = ''
      endif
    endif
    if stab != ''
      let stab = substitute(stab, '\(<[-a-zA-Z0-9]\+>\)', '\\\1', 'g')
      exec "let stab = \"" . stab . "\""
      let s:ShiftTab = stab
    endif
  endif

Or just use my fork https://github.com/LutfiLokman/supertab