Monday, March 22, 2010

Select last pasted area---Indent after paste

Hi everyone!

I wonder if there is a way to select last pasted area. When
programming I do copy&paste much, but the indent
after copy&paste isn't always right. I need to select them and press
'='. It would be very nice if I can select the last pasted area
qucikly. Is that possible, or is there a better soluton about the
indent after paste?

And here is my paste Settings:

" Copy
vnoremap <C-C> "+y
inoremap <C-C> <Nop>

" Paste
nnoremap <C-V> "+p
vnoremap <C-V> "+p
nnoremap ,<C-V> "+P
inoremap <C-V> <C-O>:call Paste("beforePaste")<CR><C-R>
+<C-O>:call Paste("afterPaste")<CR>
cnoremap <C-V> <C-R>+

" I write this function because if not, the pasted C code will be a
real mess >_<
function! Paste(mode)
if a:mode == "beforePaste"
let b:pasteOpt = &paste
set paste
elseif a:mode == "afterPaste"
if !exists("b:pasteOpt")
return
endif
let &paste = b:pasteOpt
unlet b:pasteOpt
endif
endfunction

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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: