Vim 을 홍보합니다
description
Transcript of Vim 을 홍보합니다
Vim 을 홍보합니다서재백
Editor
Editor warVim• Small size• Faster than Emacs• Runs on all systems
that has standard C li-brary
• More users than Emacs
Emacs• larger set of features
than vi• Elips plugin• Special editing modes• Ability to emulate Vi
What is Vim?• Vim
Stands for Vi iMprovedreleased by Bram Moolenaar in 1991from Vi written by Bill Joy in 1976
Simple Vim$ vi helloworld.c
i#include<stdio.h><ESC>oint main(){<ESC>oprintf(“hellowolrd\n”);<ESC>oreturn 0; <ESC>o}<ESC><Ctl+z>
$ gcc helloworld.c$ ./a.out
h j k l 0 ^ $ // 이동a i o A I // 편집u Ctl+r // Do & Undo* # /asdf n N // SearchingAlt+v Ctl+v Shift+v // Select:<,>s/asdf/hello/g // 치환Ctl+p // 자동완성Ctl+s Ctl+q // Lock & Unlock
$ vimtutor
Advanced VimWe can combine two or more commands
w dw cw yw e de ce yefX dfX cfX yfX // X 가 나올 때까지tX dtX ctX ytX // X 가 나오기 직전까지$ d$ c$ y$ // 줄 끝까지j dj cj yj // 현재 & 다음 줄까지10i<ESC>hello<CR><ESC>
Advaned Vim( 세미나 후 보충 )d // delete c // deletef // find // andy // copy // insertp // paste o // newlinew // word // ande // word(end) // insertb // word(before)
Advanced Vimdab cab yab커서가 포함된 괄호 시작부터 괄호 끝까지dib cib yib현재 커서가 포함된 괄호 시작 다음부터 괄호 끝 직전까지 . 괄호는 포함하지 않음dd cc yy // 현재 줄만
Replacement:(range)s/(regular expression)/(something)/g
:<,>s/^.*int/char/g
:5,10s/<br>$/;/g
:%s/<div\(.\{-}\)class=\(.\{-}\)>/<div\1class=“\2”>/g
Regular Expression^ 문장의 맨 앞$ 문장의 맨 뒤. 임의의 한 character[0-9] 0~9 또는 a~z 또는 A~Z 한 개[A-Z][a-z]
Regular Expression( 세미나 후 보충 )
* // 문자 반복Ex. 1* 11..1 2* 22..2 a* aa..a
.* // 임의의 문자 반복\{-} // 문자 최소 반복\{+} // 문자 최대 반복Ex. 1\{-} a\{+} .\{-}
Regular Expression.* character 반복\(<RE>\)grouping
:<,>s/<div\(.\{-}\)class=\(.\{-}\)>/<div\1class=“\2”>/g
Macro$ vi macro_samplei1.<ESC>qayyp<Ctl+a>q98@a
q<reg>(some macro)q //macro 저장@<reg> @@ q: q/ //macro 실행:reg “kp //register 보기“5p //5 번 register paste
Split:sp // 수평 자르기:vsp or :vs // 수직 자르기Ctl+wh Ctl+wj Ctl+wk Ctl+wl // 이동Ctl+w- Ctl+w+ // 창 크기 늘리기Ctl+w_ // 현재창 세로로 최대화Ctl+= // window size 동일하게Ctl+r Ctl+R //window rotate
Tab$ vim -p a.txt b.txt c.txt$ vim -p3
:tabnew d.txt:tabp :tabn:tabfirst or :tabfir :tablast or :tabla
Set vimrc !!map sn :tabn<CR>map sp :tabp<CR>
Vim ShellThere is :!(command) .. but
Vim Shell
Shell on Vimhttp://code.google.com/p/conque/
Setting Vimrc such asmap sh :vs<CR>:ConqueTerm bash<CR>
Folding
FoldingSelect range by Shift+v and type zfzf // 지정된 영역 foldingzo or zO //folding openzc or zC //folding closezr or zR //folding all openzm or zM //folding all closezd //folding delete
Folding( 세미나 후 보충 )zj zk // 이전 , 다음 folding 으로 이동:set method=indent// indentation ( 들여쓰기 ) 단위로 자동 folding
:mkview :loadview //Save and Load
Epilogue더 알고 싶었던 것Vimscript
도와주신 분들강성훈 회원님조동현 회원님다른 여러 선배님들