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

Causes <cr> to insert infinite newlines

Open c-lliope opened this issue 11 years ago • 4 comments

When in insert mode with cursorcross enabled, typing enter (<cr>) causes vim to hang. When I press <c-c> to break out of it, I find that it's inserted thousands of newlines.

Any thoughts as to what is causing this? Here's my version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 10 2014 09:25:30)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without 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      -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
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python   -lruby.2.0.0 -lobjc   

c-lliope avatar Dec 16 '14 23:12 c-lliope

What other plugins do you have? Could you send the output of :imap?

mtth avatar Dec 17 '14 06:12 mtth

Ah! sorry for the late response. Here's my :imap output:

i  <BS>          <BS><Plug>CursorCrossBS
i  <Plug>CursorCrossBS & <SNR>74_CursorCrossBS
i  <SNR>74_CursorCrossBS * <C-R>=cursorcross#on_backspace()<CR>
i  <Plug>CursorCrossCR & <SNR>74_CursorCrossCR
i  <SNR>74_CursorCrossCR * <C-R>=cursorcross#on_enter_insert()<CR>
i  <Plug>AlwaysEnd & <SNR>37_AlwaysEnd
i  <Plug>DiscretionaryEnd & <SNR>37_DiscretionaryEnd
i  <SNR>37_AlwaysEnd * <C-R>=<SNR>37_crend(1)<CR>
i  <SNR>37_DiscretionaryEnd * <C-R>=<SNR>37_crend(0)<CR>
!  <D-v>         <C-R>*
i  <CR>          <CR><Plug>DiscretionaryEnd<CR><Plug>CursorCrossCR
i  <C-U>       * <C-G>u<C-U>
i  <C-X><CR>   & <CR><SNR>37_AlwaysEnd
i  jk          * <Esc>
i  kj          * <Esc>

I only manually coded those bottom two mappings.

Here are the other plugins I'm using:

" Core Functionality
Plug 'rking/ag.vim'
Plug 'skwp/greplace.vim'
Plug 'tpope/vim-sensible'
Plug 'kien/ctrlp.vim'

" Language Support
Plug 'kchmck/vim-coffee-script'
Plug 'mustache/vim-mustache-handlebars'
Plug 'scrooloose/syntastic'
Plug 'tpope/vim-endwise'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'

" Development Environment
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-fugitive'
Plug 'thoughtbot/vim-rspec'

" Aesthetics
Plug 'Lokaltog/vim-distinguished'
Plug 'itchyny/lightline.vim'
Plug 'blueyed/vim-diminactive'

If you can tell which :imap command are likely culprits, I can try removing plugins to try to isolate it.

c-lliope avatar Jan 07 '15 04:01 c-lliope

Also, thanks for your help! :smile:

c-lliope avatar Jan 07 '15 04:01 c-lliope

I had this same problem. For me, the culprit was tpope/vim-fugitive. It seems to override my init.vim when I write:

inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

My (not so great) workaround was to override it (hook into it "later") at the filetype level:

~/.config/nvim/ftplugin/go.vim
inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

You can tell it works when :imap <cr> returns output without <SNR>37_DiscretionaryEnd--i.e., like this:

<CR>        * pumvisible() ? "\<C-Y>" : "\<C-G>u\<CR>"

seanw2020 avatar May 29 '19 23:05 seanw2020