Tip 272 Printable Monobook Previous Next
created July 4, 2002 · complexity basic · author RobertKellyIV · version 5.7
If a user would like to paste text into a buffer and have that text indented properly so that the text matches surrounding indents, the following command can be given:
]p
Some users prefer to have all of their text pasted with indenting intact. In order to make this easier, the ]p command can be mapped to the p command, so that whenever p is used, ]p will be executed. The following can be added to the .vimrc to accomplish this:
:nnoremap p ]p :nnoremap <c-p> p
This simply maps normal mode p to what ]p. While ctrl+p now performs just p without the indenting functionality.