![Vim -- 阻止大括号导航留下标记](https://linux22.com/image/109140/Vim%20--%20%E9%98%BB%E6%AD%A2%E5%A4%A7%E6%8B%AC%E5%8F%B7%E5%AF%BC%E8%88%AA%E7%95%99%E4%B8%8B%E6%A0%87%E8%AE%B0.png)
花括号 当使用花括号导航时,{
, }
, 在段落之间移动,覆盖“最后跳转”标记(可通过 访问''
)。如果这个标记保持不变,我会发现它更有用。有没有办法像这样配置vim?
答案1
您可以使用该keepjumps
命令。从:h :keepjumps
:
*:keepj* *:keepjumps*
:keepj[umps] {command}
Moving around in {command} does not change the |''|,
|'.| and |'^| marks, the |jumplist| or the
|changelist|.
Useful when making a change or inserting text
automatically and the user doesn't want to go to this
position.
所以在你的情况下,你会想要
nnoremap } :keepjumps normal! }<cr>
nnoremap { :keepjumps normal! {<cr>
或者,如果您希望它也适用于视觉模式(您可能会这样做):
xnoremap } :<C-u>keepjumps normal! gv}<cr>
xnoremap { :<C-u>keepjumps normal! gv{<cr>