
花括號 當使用花括號導航時,{
, }
, 在段落之間移動,覆蓋「最後跳轉」標記(可透過 存取''
)。如果這個標記保持不變,我會發現它更有用。有沒有辦法像這樣配置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>