Sunday, May 6, 2018

Supporting xterm-bracketed-paste

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!');
        }
        }

~

Thanks,
Matteo

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

Post a Comment