Sunday, May 6, 2018

Re: Supporting xterm-bracketed-paste

I cannot reproduce the indentation issue. Besides, if I add -N to Vim's

I just realized the vim command in my previous message did not include 'set autoindent': try with `vim -u NONE  -c 'inoremap { {} | set autoindent'`.

Is nocompatible set in your Vim? I am using Vim 8.0.1750 on macOS 10.13.

Yes.

:echo &compatible
0

Thanks,
Matteo

On Sun, May 6, 2018 at 10:37 PM, Lifepillar <lifepillar@lifepillar.me> wrote:
On 06/05/2018 17:45, Matteo Landi wrote:
Hello everyone,

Only recently I got to learn about 'xterm-bracketed-paste' when all of a sudden CMD-V-ing had stopped working on my Mac, and while I found a solution that worked with my setup [0], I am still not 100% sure the solution I found is the correct one -- so here I am asking.

Question: is it expected that users create insert-mode mappings to support bracketed-paste?  Or, once enabled, proper-pasting should just work out of the box?  Because it looks like everything it's working fine when pasting in normal mode, but when in insert mode, the result is a mess (i.e. insert-mode mappings are executed, and autoindent screws indentation).

Example: say you had the following copied in the OS clipboard:

function foo() {
   while (true) {
     console.log('infinite!');
   }
}

And you started vim with: `vim -u NONE -c 'inoremap { {}'`; in normal mode, you press CMD-V and end up with the following buffer:

function foo() {
   while (true) {
     console.log('infinite!');
   }
}

~

Enter now insert mode, press CMD-V, and your buffer would look like the following (imaps and autoindent messed with the pasted content):

function foo() {
   while (true) {
     console.log('infinite!');
   }
}
function foo() {}
   while (true) {}
       console.log('infinite!');
         }
         }

I cannot reproduce the indentation issue. Besides, if I add -N to Vim's
options, I cannot reproduce the issue altogether. Is nocompatible set
in your Vim? I am using Vim 8.0.1750 on macOS 10.13.

Life.

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