Friday, May 11, 2018

Re: Supporting xterm-bracketed-paste

> You might want to check, if this mapping works, if you only define it in a VimEnter autocommand.

I tried that, but no luck.  Again, the only way to make it work is by including: https://github.com/ryanpcmcquen/fix-vim-pasting -- or with the following snippet

  if empty('&t_BE')
      inoremap <expr> <Esc>  pumvisible() ? "\<C-e>" : "\<Esc>"
  else
      augroup bracketed_paste
          au!
  
          function! XTermPasteBegin()
              set pastetoggle=<Esc>[201~
              set paste
              return ""
          endfunction
          au VimEnter * inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
  
          au VimEnter * inoremap <special> <expr> <Esc>  pumvisible() ? "\<C-e>" : "\<Esc>"
      augroup END
  endif

Which feels like cheating, as it seems like we are re-implementing support for braketed-paste, manually.  Anyway, at least now I think I understood why that plugin/snippet is required.

> Alternatively, I wouldn't recommend mapping ESC anyhow.

Yeah, that would work too ;-)

Thanks,
Matteo

On Wed, May 9, 2018 at 12:11 PM, Christian Brabandt <cblists@256bit.org> wrote:

On Mi, 09 Mai 2018, Matteo Landi wrote:

> Found the offending line in my .vimrc:
>
>   inoremap <expr> <Esc>  pumvisible() ? "\<C-e>" : "\<Esc>"
>
> Is this somehow breaking braketed paste? (i.e. swallowing the escape the
> terminal send at the beginning of a paste block)

Very likely. It also breaks the various terminal request strings that
Vim requests when starting up. You might want to check, if this mapping 
works, if you only define it in a VimEnter autocommand.

Alternatively, I wouldn't recommend mapping ESC anyhow.

Best,
Christian
--
Läßt der Knecht die Arbeit liegen, kann er leicht 'n Arsch vollkriegen.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: