Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
M4rtinK opened this issue Feb 17, 2017 · 24 comments
Open

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

M4rtinK opened this issue Feb 17, 2017 · 24 comments

Comments

@M4rtinK
Copy link

M4rtinK commented Feb 17, 2017

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 <[email protected]>
Compiled by <[email protected]>
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
Copy link

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

@empijei
Copy link

empijei commented Feb 28, 2017

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
Copy link

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
Copy link

miessos commented May 30, 2017

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

@empijei
Copy link

empijei commented May 30, 2017

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

@miessos
Copy link

miessos commented May 30, 2017

@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
Copy link

empijei commented May 30, 2017

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.. 😞

@miessos
Copy link

miessos commented May 31, 2017

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

@empijei
Copy link

empijei commented May 31, 2017

Happy to read that :)

@D1mon
Copy link

D1mon commented Oct 23, 2017

same error. (neovim)

@empijei
Copy link

empijei commented Oct 23, 2017

Have you tried this: #185 (comment) ?

@D1mon
Copy link

D1mon commented Oct 23, 2017

@empijei not working

@metalelf0
Copy link

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
Copy link

D1mon commented Nov 8, 2017

@metalelf0 Works!!!

@Mte90
Copy link

Mte90 commented Oct 28, 2019

The problem it is still there after years...

@Lord-of-the-Galaxy
Copy link

The problem still exists....

@hvpkod
Copy link

hvpkod commented Jun 18, 2020

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

@dagadbm
Copy link

dagadbm commented Jun 24, 2020

still the same issue yes.. nvim 0.5

@dagadbm
Copy link

dagadbm commented Jun 24, 2020

this repo is dead for some years now anyways..

@dagadbm
Copy link

dagadbm commented Jun 24, 2020

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
Copy link

cube-p commented Dec 27, 2020

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
Copy link

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
Copy link

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...

jnimety pushed a commit to ContinuityControl/dotfiles that referenced this issue Sep 30, 2021
and there doesn't seem to be a fix
(ervandew/supertab#185). supetab development
seems stalled as well.

Error detected while processing
/home/jnimety/.homesick/repos/dotfiles/home/.vim/plugged/supertab/plugin/supertab.vim:
line 1000:
E475: Invalid argument: pumvisible() ? "\<C-P>" : "\<C-H>"
@LutfiLokman
Copy link

LutfiLokman commented Jan 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests