:help cursor()
不能更清楚:
[…]
Does not change the jumplist.
[…]
Run Code Online (Sandbox Code Playgroud)
(编辑)
这意味着cursor()
跳转不会记录在跳转列表中,因此,这cursor()
是一个不合适的工具.
(EndEdit中)
作为替代方案,你可以使用类似的东西
execute "normal " . target_line . "G" . target_col . "|"
Run Code Online (Sandbox Code Playgroud)
这是完全兼容的,<C-o>
并且<C-i>
正如惯用的那样
call cursor(target_line,target_col)
Run Code Online (Sandbox Code Playgroud)
即使它给JavaScripters带来了寒意;-)
小智 5
我本人也想这样做,对我有用的是在光标移动之前将其标记为`。
normal! m`
call cursor(l, c)
Run Code Online (Sandbox Code Playgroud)
如帮助所示,setpos()和cursor()都不会修改跳转列表,所以setpos()和cursor()有什么区别,很奇怪!
归档时间: |
|
查看次数: |
1147 次 |
最近记录: |