tags:

views:

86

answers:

3

If I use 'p' to paste, vim will remain at normal mode. Is there a command where I can paste and enter insert mode?

+3  A: 

That depends where you wish to insert text after you've pasted. Paste as normal using p and then enter insert mode using aAiIoO...

The vim mindset is to enter insert mode as frequently as is strictly necessary.

If you meant how do I paste whilst remaining in insert mode you can use <ctrl-r>[register name]. E.g <ctrl-r>" for the default register.

Greg Sexton
Press twice CTRL-R to insert literal contents of the register.
Benoit
A: 

You can map a shortcut to do that, and use it instead to paste:

nmap <leader>p pi

If your leader key is "," then ",p" will paste and then enter insert mode.

Sudhanshu
I would say that after p, i is not good, rather use a.
Benoit
And *never* use `*map` for such mappings. You have much safer `*noremap` commands, use them.
ZyX
+2  A: 

You can paste from insert mode directly, using Ctrl+op. Perhaps this will work for you?

Peter
I tried that and it doesn't work for me ... using GVim on Windows
Eugene M
@Eugene M, `<C-o>` and then `p`? Or perhaps the `mswin32.vim` haunts again there in back.
progo
Actually can't blame this one on Windows ... just dumb user error ... I saw that Ctrl+o took me out of insert mode and I don't know if that confused me or what, but now I see it works fine ... must have been too early in the morning ...
Eugene M