Wednesday, August 1, 2012

How to make a vim map to after some treatment pass foward to the natural treatment

I want to map a Shift + Insert, as I usually paste code for studing (or even take some of forum's questions to prepare an answer). But as mapped for .cpp and .h the pasted code appears messed up.

Example:

1 class A {
2 }
3 public:
4 class B {
5 }
6 // ...
7 // };
8 // static void f();
9 // // ...
10 // };
11 // )

Original code:

class A {
public:
class B {
// ...
};
static void f();
// ...
};

To avoid this is necessary to run :set paste.

So, the question is, how to map a Shift + Insert, just like imap <S-Insert> <Esc>:set paste<CR>i and very here pass foward the Shift + Insert to its natural behavior, that is pasting and then turn back and set :set paste! back?

Obs.: { is mapped to break line and put and ending }, along with that kind of maps the pasted text will be messed up.

Thanks.

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

No comments: