#TIL #vim :s 명령어에서 현재 커서 단어를 입력하기

:%s/foo/<c-r><c-w>/g

Replace each occurrence of ‘foo’ with the word under the cursor. <c-r><c-w> means that you press Ctrl-R then Ctrl-W The word under the cursor will be inserted as though you typed it.

Search and replace - vim.fandom.com

* 키와 조합이 좋다. * 키를 눌러 찾은 단어를 :s 명령어에서 쓰고 싶을 때, 주로 사용한다.

참고

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post