小编Urs*_*aDK的帖子

VIM undo:撤消`undojoin`时为什么光标跳到错误的位置?

编辑:

  • 我已经简化了这个功能并澄清了这个问题.
    原始问题仍在页面下方.

  • 已转载到vim_dev邮件列表:https://groups.google.com/forum/#!topic/vim_dev/_Rz3uVXbwsQ

  • 报告为Neovim的错误:https:
    //github.com/neovim/neovim/issues/6276


为什么光标在以下两个示例中的位置不同:

  1. [CORRECT CURSOR POSITION]替换的结果与缓冲区中的先前更改(第3行的添加)相结合,光标位置正确地恢复到缓冲区中的第二行.

    normal ggiline one is full of aaaa
    set undolevels=10 " splits the change into separate undo blocks
    
    normal Goline two is full of bbbb
    set undolevels=10
    
    normal Goline three is full of cccc
    set undolevels=10
    
    undojoin
    keepjumps %s/aaaa/zzzz/
    normal u
    
    Run Code Online (Sandbox Code Playgroud)
  2. [INCORRECT CURSOR POSITION]替换的结果与缓冲区中的先前更改(第4行的添加)相关联,光标位置错误地恢复到缓冲区中的第一行(应该是第3行).

    normal ggiline one is bull of aaaa
    set undolevels=10 " splits the change into separate undo blocks
    
    normal Goline …
    Run Code Online (Sandbox Code Playgroud)

vim undo cursor-position neovim

10
推荐指数
1
解决办法
1058
查看次数

标签 统计

cursor-position ×1

neovim ×1

undo ×1

vim ×1