vim 단축키

YEONGHUN KO·2024년 1월 11일
0

ETC

목록 보기
29/30
post-thumbnail

ssh에서 vim을 이용해 파일을 수정할 일이 많아져서 정리해본다.

크게 insert모드와 normal모드로 visual모드로 나눠진다.

esc - normal mode

file modified

:q - quit
:w - write(save)
:wq - write & quit
:q! - quit override (not saving anything)

jump

o - new line below
O - new line above

b - previous word
W - next word (ignore special characters)
zz - centerd selected line
4 + j/<Down Arrow> - move four lines down

A - move to end of the line and insert
I - move to start of the line and insert

change the word

dw - delete word
D - delete rest of line
dd - delete line - deletes the whole line wherever your cursor is
cc - change line - change the whole line wherever your cursor is

time traveling

u - undo
ctrl + u - redo

i - insert mode

Ctrl + u undo

v - visual mode

arrow key - select
d - delete
y - yanking(copy)
c - change
p - paste
ctrl + v - visual block
shift + v - visual line

출처 : https://www.youtube.com/watch?v=jXud3JybsG4

searching + replace

/word + enter - search for "word"

  • n - next occurence
  • N - previous occurence

*:s/old/new/g - replace word only on current line
:%s/old/new/g - replace everywhere

profile
'과연 이게 최선일까?' 끊임없이 생각하기

0개의 댓글