Vim - 중괄호 탐색에 표시가 남지 않도록 중지

Vim - 중괄호 탐색에 표시가 남지 않도록 중지

중괄호 탐색을 사용할 때 단락 사이를 이동하려면 {, 를 사용하여 }"마지막 점프" 표시( 를 통해 액세스할 수 있는 표시 '')를 덮어씁니다. 이 표시를 그대로 두면 더 유용할 것 같습니다. 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>

관련 정보