How to paste correctly when autoindent in vim resets the line if nothing typed
-
05-03-2021 - |
Question
This question describes how auto indent is ignored with empty lines, using his/her example:
....{
....█
....}
becomes
....{
█
....}
when no text is entered. Apparently this is supposed to prevent having indented blank lines. Problem is it interferes with my ability to paste words/lines properly. If I yank a word (lets say 'aardvark'), if I paste on the first line, I get
....{aardvark
....}
and if I press 'o' then 'p' to paste on the second line, I get
....{
aardvark
....}
when what I really want is
....{
....aardvark
....}
I have a similar problem pasting lines two lines down.
La solution
Maybe you'll like to use oCTRL-R" instead of oESCp. See :help i_CTRL-R
, :help registers
Autres conseils
Yank lines, then press ]p
instead of p
.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow