smartpairs.vim icon indicating copy to clipboard operation
smartpairs.vim copied to clipboard

error when switching from visual-line to visual-block mode

Open naught101 opened this issue 8 years ago • 6 comments

When I highlight something with shift-v (visual line mode), and then try to switch to visual-block mode with ctrl-v, I get the following error:

Error detected while processing function <SNR>34_Revert:                     
line    1:
E121: Undefined variable: s:history
E116: Invalid arguments for function len(s:history)
E15: Invalid expression: len(s:history)
line    2:
E121: Undefined variable: length
E15: Invalid expression: length > 1

It's possible I've got some clashing plugins, but s:history only exists in smartpairs, so this seems like a good place to start.

naught101 avatar Aug 17 '15 10:08 naught101

Could you share vim version? Do you have any customization for smartpairs bindings?

gorkunov avatar Aug 17 '15 10:08 gorkunov

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  9 2014 17:36:40)
Included patches: 1-488
Modified by [email protected]
Compiled by buildd@
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +dialog_con_gui  +insert_expand   +mouse_sgr       +ruby            +vertsplit
+arabic          +diff            +jumplist        -mouse_sysmouse  +scrollbind      +virtualedit
+autocmd         +digraphs        +keymap          +mouse_urxvt     +signs           +visual
+balloon_eval    +dnd             +langmap         +mouse_xterm     +smartindent     +visualextra
+browse          -ebcdic          +libcall         +multi_byte      -sniff           +viminfo
++builtin_terms  +emacs_tags      +linebreak       +multi_lang      +startuptime     +vreplace
+byte_offset     +eval            +lispindent      -mzscheme        +statusline      +wildignore
+cindent         +ex_extra        +listcmds        +netbeans_intg   -sun_workshop    +wildmenu
+clientserver    +extra_search    +localmap        +path_extra      +syntax          +windows
+clipboard       +farsi           +lua             +perl            +tag_binary      +writebackup
+cmdline_compl   +file_in_path    +menu            +persistent_undo +tag_old_static  +X11
+cmdline_hist    +find_in_path    +mksession       +postscript      -tag_any_white   -xfontset
+cmdline_info    +float           +modify_fname    +printer         +tcl             +xim
+comments        +folding         +mouse           +profile         +terminfo        +xsmp_interact
+conceal         -footer          +mouseshape      +python          +termresponse    +xterm_clipboard
+cryptv          +fork()          +mouse_dec       -python3         +textobjects     -xterm_save
+cscope          +gettext         +mouse_gpm       +quickfix        +title           +xpm
+cursorbind      -hangul_input    -mouse_jsbterm   +reltime         +toolbar
+cursorshape     +iconv           +mouse_netterm   +rightleft       +user_commands
   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"
    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/l
ib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pan
go-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/us
r/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -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/f
reetype2    -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_
FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby2.1-2.1.2/debian/lib -fstac
k-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-
z,now -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
 -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib
-llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.20/CORE -lperl -
ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil
 -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ld
l -lz -lpthread -lieee -lm -lruby-2.1 -lpthread -lgmp -ldl -lcrypt -lm

No, no customisations, I just installed it and forgot about it a couple of months ago, and have only just started getting annoyed enough to fix this bug (I don't hit it that often)

naught101 avatar Aug 17 '15 13:08 naught101

Could you share list of plugins that you use?

gorkunov avatar Aug 17 '15 13:08 gorkunov

All these are autoloaded with pathogen:

ls ~/.vim/bundle 
csapprox   matchit         taglist       ultisnips           vim-latex          vim-surround
csv.vim    molokai         tags          vim-addon-mw-utils  VimOrganizer       vim-vinegar
ctrlp.vim  NrrwRgn         tags-te       vim-arduino-ino     vim-pandoc-syntax  VOoM
desert2    pydoc.vim       tlib_vim      vim-arduino-syntax  vim-pweave         YouCompleteMe
desert256  smartpairs.vim  todo.txt-vim  vim-indent-guides   Vim-R-plugin       zeavim.vim
drupal     syntastic       twilight256   vim-ipython         vim-snippets

naught101 avatar Aug 17 '15 13:08 naught101

I see now that visual selection Ctrl + V may conflict with smaprtpairs bindings. You can temporary fix this by changing default binding. Add this line to your .vimrc:

let g:smartpairs_revert_key = '<C-G>' " default is Ctrl+V changed to Ctrl+G

gorkunov avatar Aug 17 '15 13:08 gorkunov

Ok, yep, that seems to work.

naught101 avatar Aug 17 '15 23:08 naught101