[ ref0 , ref1 , ref2 , ref3 , ref4 , ref5 , ref6 , ref7 , ref8 , ref9 , refa , refb , refc ]
-
vi
orvim
are text editors widely used in Unix/Linux world.vi
또는vim
편집기는 Unix/Linux 세계에서 널리 사용되는 편집기임. -
It has command and edit modes.
명령 과 편집 모드가 있음. -
emacs
is also a widely used editor.emacs
도 널리 사용되는 에디터임. -
Following table has a few of the
vi
editor commands.
아래는vi
편집기 명령의 일부임.
command 명령 |
feature 기능 |
---|---|
:h :help |
show documentation 도움말 표시 |
:e test.txt :e LIC Tab |
start editing a file of given name 주어진 이름의 파일 편집 시작 |
hjkl | ←, ↓, ↑, → |
0^Home | Move to the beginning of the line 행의 처음으로 이동 |
H | go to top of the screen 현재 화면의 가장 위로 이동 |
L | go to bottom of the screen 현재 화면의 가장 아래로 이동 |
:0 Enter |
go to the beginning of the file 파일의 처음으로 이동 |
:$ |
go to the end of the file 파일의 맨 뒤로 이동 |
:19 |
go to the line # 19 19행 으로 이동 |
Ctrl+f | page up 한 페이지 위로 이동 |
Ctrl+b | page down 한 페이지 아래로 이동 |
$ End | Move to the end of the line 행의 맨 끝으로 이동 |
i | Switch to insert mode and insert 삽입 모드로 변경 후 삽입 |
a | Switch to insert mode and append 삽입 모드로 변경 후 덧붙이기 |
c | Switch to replace mode 대체 모드 |
Esc Ctrl+[ |
Switch from insert mode to command mode 명령 모드로 변경 |
x d |
delete one character 한 글자 삭제 |
16d | delete 16 characters of current line 16글자 삭제 |
dw | cut one word 한 단어 cut |
2dw | cut two words 두 단어 cut |
D d$ |
cut until the last of the line 행 나머지 cut |
dd | cut one line 한 행 cut |
4dd | cut four lines 4 행 cut |
u | undo 변경 취소 |
yw | copy word 한 단어 복사 |
yy | copy line 한 행 복사 |
p | Paste 붙여넣기 |
/wordd |
search wordd 검색 |
/w..d |
search wood or wind or ...w와 d 사이에 두 글자가 있는 패턴 검색 |
:s/wordd/word/ |
search the first wordd and replace with word 처음 나오는 wordd 를 word 로 대체 |
:s/wordd/word/g |
in the current line, search all wordd and replace with word 현재 행에 나오는 wordd 를 모두 word 로 대체 |
:%s/wordd/word/g |
in the current file, search all wordd and replace with word 현재 파일의 모든 wordd 를 word 로 대체 |
n | find next 다음 검색 |
N | find previous 이전 검색 |
!<shell command> | run shell command 셸 명령 실행 |
Ctrl+p | (edit mode) autocompletion (편집모드에서) 자동 완성 |
(command mode):q |
quit editor (명령모드에서)편집기 마치기 |
:w |
write file 편집 내용 쓰기 |
:w new.txt |
write to file new.txt 주어진 이름으로 편집 내용 쓰기 |
:wq |
write file and quit 편집 내용을 쓰고 나가기 |
:q! |
quit without saving 편집 내용을 쓰지 않고 나가기 |
Ctrl+q | make vi working again after Ctrl+sCtrl+s이후 잠긴 vi 를 다시 작동하게 만들기 |
/quick |
search pattern quick quick 같은 형태의 문자열 찾기 |
Ctrl+] | follow link within help 도움말 안에서 링크 따라가기 |
Ctrl+T | return within help 도움말 안에서 돌아가기 |
Ctrl+w,s:sp <filename> |
split horizontally 수평 창 나누기 |
Ctrl+w,v:vsp <filename> :vs <filename> |
split vertically 수직 창 나누기 |
Ctrl+w,q:q |
close a window 창 닫기 |
Ctrl+w,w | switch between windows 창 전환 |
Ctrl+w,j | switch to upper windows 위 창 전환 |
Ctrl+w,k | switch to lower windows 아래 창 전환 |
Ctrl+w,L | switch to right windows 오른쪽 창 전환 |
Ctrl+w,h | switch to left windows 왼쪽 창 전환 |
- Following is a key map for the command (or normal) mode.
아래는 명령 (또는 노멀) 모드의 명령 키 모음임.
- In the
insert mode
, sometimes direction arrow keys add characters.
삽입 모드에서 때로 방향 화살표 키를 누르면 이동 대신 글자가 입력되는 경우가 있음. - To avoid this, create a
~/.vimrc
and writeset nocompatible
.
이 경우,~/.vimrc
파일을 만들고set nocompatible
이라는 행을 추가함.
- Show line numbers.
- 행 번호 표시.
- You can enable grammar coloring in the
vi
editor.vi
편집기에서 구문을 색으로 표시하는 것이 가능함. - Add a line of
syntax on
to the~/.vimrc
file.syntax on
이라는 행을~/.vimrc
파일에 추가함. - If the line above does not work, try following commands:
위 명령이 잘 작동하지 않는 경우, 아래 명령을 시도하기 바람.
sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime