I want to map a Shift + Insert, as I usually paste code for studing (or even take some of stackoverflow'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 from question Import nested classes into namespace - C++:
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.