0

I've used Ctrl+Shift+v to paste in Ubuntu 14.04, but after I've updated my ubuntu and vim it automatically inserts the indentation when I past texts through ctrl+shift+v.

I found that automatic indentation can be turned off/on by entering set paste / set nopaste or map the key for pastetoggling (set pastetoggle= < F2 >) in the .vimrc file.

However, I am too lazy to push the pastetoggling key (F2), and tried clime's approach, but it seems not to be working.

First, for the above approach, it seems that shift doesn't make any difference, for example < C-V > and < C-S-V > cannot map two different keys. How can I remap the < C-S-V > in vimrc?

Second, I've found one trick in this blog, but cannot understand how it works. What kind of background is necessary to understand the details of it?

ruach
  • 1,369
  • 11
  • 21
  • 1
    The blog you point to is **the answer**. I've been using this for a few years now and quite satisfied with the results. You need to know [ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code), especially **bracketed paste mode**. – phd Feb 21 '18 at 14:15
  • @phd Thanks for a comment. By the way, why vimrc cannot discern differences between < c-s-v > and < c-v > and < c-V> etc? – ruach Feb 22 '18 at 04:48

1 Answers1

0

If you're simply trying to remap toggling paste/nopaste, you can do that with the ! operator. In the .vimrc that would look like:

nnoremap <your remap> :set paste!<cr>

adamkgray
  • 1,717
  • 1
  • 10
  • 26