On May 7, 1:46 pm, Pablo Giménez <[email protected]> wrote:
> Hi
> I have some keymaps to paste text directly in insert mode:
> inoremap <C-v> <C-O>"+p<Right>
> The problem is that when I am programing and Iahev my code indented, using
> autoindent for instance with python everytime I copy in a new line I lose
> the indentation.
> In fact if I press enter, in insert mode, and then Esc to go to normal mode
> the cursor always goes to the begging of the line instead of going to the
> proper column and keep the indentation I had in the insert mode.
Two more ideas, now that I read your problem fully:
This one should prevent losing the indent when you go to normal mode:
inoremap <C-V> x<BS><C-O>"+p<Right>
This one lets you just insert the register contents directly without
ever going into normal mode:
inoremap <C-V> <C-R><C-R>+
The double <C-R> is to make sure the text gets pasted literally.
Otherwise, special characters may do unexpected things.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---