Pet*_*ker 29
您可以使用:yank带有范围的命令来完成此效果.
:.-6,.yank
Run Code Online (Sandbox Code Playgroud)
范围说明:
. 或点表示当前行.-6 表示当前行减去6.-6,. 是当前行减去6的当前行.-6为仅仅-6给我们-6,.yank-6,yank:y给我们-6,y最终命令:
:-6,y
Run Code Online (Sandbox Code Playgroud)
如需更多帮助:
:h :yank
:h [range]
Run Code Online (Sandbox Code Playgroud)
您可以执行以下操作:
6yk6j
Run Code Online (Sandbox Code Playgroud)
这将会拉动前面的6行和当前的行,但是courser会移动.6j跳回到上一个位置.
你可以简单地猛拉到运动,然后返回游标使用无论是位置'[还是'].
6线的冲击加上当前总共7个:
y6u
Run Code Online (Sandbox Code Playgroud)
然后,使用一些鲜为人知的标记:
'[ -> to the first character on the first line of
the previously yanked text (or changed)
`[ -> to the first character of the previously yanked text
'] -> to the first character on the last line of yanked text
`] -> to the last character of the preciously yanked text
Run Code Online (Sandbox Code Playgroud)
所以:
y6u']
y6u`]
Run Code Online (Sandbox Code Playgroud)
根据您的具体需求,您可以使用两种解决方案.前者将光标移动回的第一个字符就行了你的光标是,后者移动到该行的最后一个字符.
但还有另一个标记可能很方便:'^.它表示离开插入模式时光标的最后位置.
'^ -> moves to the beginning of the last line when leaving insert mode.
`^ -> moves to the exact position where insert mode was last left.
Run Code Online (Sandbox Code Playgroud)
然后这是另外两个解决方案:
y6u'^
y6u`^
Run Code Online (Sandbox Code Playgroud)
那不是结束!如果您假装继续插入文本,则可以使用该gi命令.它会移动到`^标记并进入插入模式.然后我们有第五个解决方案:
y6ugi
Run Code Online (Sandbox Code Playgroud)
我希望其中一个满足您的需求!
| 归档时间: |
|
| 查看次数: |
4047 次 |
| 最近记录: |