插入(通过粘贴)多行文字后,如何移动光标?
在进行内联插入(粘贴)时,p
和P
工作正常。但是,如果我粘贴多行文字,我的光标无论p
还是P
移动到新文字的顶部。
如何将光标放在p
或P
之后的新文字?
答案 0 :(得分:11)
使用mark是一种方式。但对于p or P
,如果您想将光标留在新粘贴的文本之后,则会有内置gp
:h gp
了解详情
["x]gp Just like "p", but leave the cursor just after the new
text. {not in Vi}
["x]gP Just like "P", but leave the cursor just after the new
text. {not in Vi}
答案 1 :(得分:5)
您希望使用]
标记移至粘贴文本的末尾。摘录摘自:help ']
:
After executing an operator the Cursor is put at the beginning of the text
that was operated upon. After a put command ("p" or "P") the cursor is
sometimes placed at the first inserted line and sometimes on the last inserted
character. The four commands above put the cursor at either end. Example:
After yanking 10 lines you want to go to the last one of them: "10Y']". After
inserting several lines with the "p" command you want to jump to the lowest
inserted line: "p']". This also works for text that has been inserted.