~cpp
1.VI(Visual interface Editor)
구
▶ 그 (binary)
그 source data (ASCII)
▶Editor(unix system) Line editor (ex ed)
Screen editor (vi)
▶Vi vi ex The University of California, Berkeley California computer Science Division, Department of Electrical Engineering and Computer Science 개
▶Vi () 기 , , ; <ESC>
(a A I ...) : <ESC>
(: / ? !) CR( ) 기 <DEL> ;
▶Vi [from][.][to][][ ] or [n][][ ]
/ (z G | ) (^D ^U) 과 ( 경)
(.) 경(d s c ..)
▶.exrc vi vi vi경 set 고 .exrc set값 default
set wm=3 set sm ## . bbm bbmaster@flower.chungnam.ac.kr ab bbm bbmaster@flower.chungnam.ac.kr ## map V :w^M:!spell -x %^M:e!^M^M
vi ) d , dw , db .
Ctrl 결 ) ^u Ctrl u
그 기 고 경 . )
그
▶File
구 기
(↓: CR)
ZZ (=:wq) 경 그 고 그
:w ↓ 경 기
:w! ↓ 경 기
:w <file>↓ name 기
:w! <file>↓ name 겹 기
:q↓ vi고 Unix
:q!↓ 경 vi
:e <file>↓
:e!↓ 경 고
:e+ <file>↓ 개
:e +n↓ n 개
:e #↓ 고 file
:e! #↓ 경 고 file
:r <file> ↓ <file> read
:r !<>↓ <> 결과 read
:nr <file>↓ n <file> read
기
:sh↓ vi (^d, exit )
:!cmd↓ cmd 고
:n args↓
^G 과
:ta tag↓ tag
:f<ESC> ?
$vi A B C D 4개 (A B C D)
:n
구
$vi -r 꺼거( ), 고 경 구
구 기
/
n n
+ (n+) ( n)
- (n-) ( n)
G
1G
nG n
H
L
M
CR +
↓ j
↑ k
1
^ 공
O
$
h →
l ←
^H ←( )
nl n
space →( )
fc (nfc) c
Fc (nFc) c
tc (ntc) c
Tc (nTc) c
; (n;) 과 c
, (n,) 과 c
w (nw) ()
W (nW) () 공
e (ne) ()
E (nE) () 공
b (nb) () ()
B nB () 공
//그
{ or n{ 그
} or n} 그
(
)
]] or n]]
[[ or n[[
^F n^F 기
^B n^B 기
^D n^D
^U n^U
^Y n^Y
^E n^E
z top ,
z. 간 ,
z- bottom ,
^L 고 (refresh)
^R ^L →key 경 거고 refesh
구 기
(insert)
a
i
A
I
o
O
^H ( )
^W
erase 거 ^H
kill . 거
\ 거 ESC
ESC 고
DEL
^D back tab. autointent
^^D (^) control-d(^D) .
back tab. autointent
O^D back tab autointent
^V ESC
결
J 결
기(delete)
x nx
X nX
D 까
d0 까
dd ndd ( n)
dG 까
d1G 까
dnG , n 까
d- 과
d+ 과
nd- 과 n
nd+ 과 n
ddp 과 교
//구
d) dn) 까
d( dn( 까
d} dn} paragraph 까
d{ dn{ paragraph 까
d] dn] section 까
d[ dn[ section 까
까
dfc dnfc (n) 'c'까
dFc dnFc (n) 'c'까
dtc dntc (n) 'c'까
dTc dnTc (n) 'c'까
d/pat (pat)까
d?pat (pat)까
text구
p (change, delete, yank) 구
P (change, delete, yank) 구
구
$vi -r <> <> 기기 * 꺼거, 고 *
구 기
교
cw cnw (n ) 까 경
cW cnW (n ) 까 경
cb cnb 까(n) 까경
cB cnB 까(n) 까경
//구
c) cn) 까 경
c( cn( 까 경
c} cn} paragraph 까 경
c{ cn{ paragraph 까 경
c]] cn]] section 까 경
c[[ cn[[ section 까 경
까
cfc cnfc (n) 'c'까 경
cFc cnFc (n) 'c'까 경
ctc cntc (n) 'c'까 경
cTc cnTc (n) 'c'까 경
/
10,20/ 10 20까
1,$/ 까
//+n n
?
??+n n
n 금 과 (/)
N 금 과 (?)
(^)기
:/^M(^V+^M) (^) ^V 고
(replacement) :
[]s/old/new/[cgi] ( . , * [ ^ $ \ / &) 각각 (\. \* \[ \^ \$ \ \/ \&)
[]
[]
[$]
[. ]
[%]
[cgi]
[c] 경 경 게
[g] 경
[i] 구
:s/old/new/g
:10,$s/old/new/g
10 까
:g/A/s//B/g
A (g/A)
A B (s//B), s // text 게
(/g)
:g/ABC/s/B/Z/g
ABC (s/B/Z)
ABC B Z (/g)
(/g)
구 기
Mark() mc 'c' ('c' 1 )
'c 'c'
` 'c'
" 거,
`` 거, 그
/ :10,20w 10 20까
:10,20w >> 10 20까
:10,20r 10 20까
기(yank) "a5dd 5고, a
yw 기
3yw 3 기
y$ 까 기
y) 까 기
yy nyy (n개) 기 (Y)
"a5Y 5 a 기
기(put) p
P
"ap a
"np n , yank 기 고 기
( ) :map<><기> <> 10 까
<기> 100 까
*) vi bug
:unmap <>
:map #n <기> <> #n - n 0 9까 - , 그 .
:map #2 :w^M 기 F2 :w^M
:map V :w^M:!ispell -x $^M:e!^M^M ( )
:map #2 :w^M: !cc %^M:e!^M^M (vi 기 F2 )
. 근
J 결
~
^1 거고
기 기 commond 기
: ex() ^f :r <file> <file> read
) sentence G . . . (dft ) :r !<> <>결과 read
( sentence ^g :nr <file> n<file> read
} paragraph h :!
{ paragraph H :sh 감
]] section ^h backspace :x 고 기
[[ section i :wq 고 기
0() line I :11,22w <file> 11과 12
$ line ^i tab () :w >> <file> <file>
^ line j :w! 기
+ k :q 기( )
- l :q! 경과 계
spacebar L :e <file> vi 고<file>
return ^l refresh :e! 경 고
/ m :n
? M 간 :n <files> 기 <file>
% (,{,[,-),},} ^m (CR)
, f,F,t,T n :e# 고 <file>
; f,F,t,T N :args
. ^n ( ) :rew
` mark곳 o :map m n
' O :map! m n ( )
`` 곳 or 기 p :unmap m
'' `` P :unmap! m ()
~ ↔ ^p ( ) :ab <1> <2>
" Q 고 ex :unab <1>
!! r 교 :set <option> set
! send next to commend, replace output(eg !) R 까 교 ( ESC 까) :set number 기
>> shiftwith paragraph ^r refresh( ) !} unix 그 결 결과 과 교
<< shiftwith paragraph s 교
>% (,{,[ 까 S 그
<% (,{,[ 까 t 그 까
a T "
A ^t shiftwith
b u
B 공 구 U
^b ^u
c 까 경 ^V
C 까 경 w
^c ( x) W 공 구
d . 까 text ^w ()
D 까 x
^d X
e y . . . yank
E 공 구 Y yank
^e ^y
f . . . z top(. mid -bot)
F . . . ZZ 고 감(=wq)
set 기
Option Default
:set <option> <param>
:set <nooption> <param> set <option> no
:set all vi
autoindent(ai) noai 기 기
autoprint(ap) ap 각
autowrite(aw) noaw (:n, :!)
beautify(bf) nobf tab, newline, formfeed
directory(dir=) /tmp 기
edcmpatible noedcmpatible ed기 기
errorbells(eb) errorbells
exrc(ex) noexrc home 곳 .exrc
hardtaps=(ht=) 8
ignore case(ic) noic 교
lisp nolisp indentation lisp
list nolist ^I, $
magic magic [*. 규 갖
mesg masg 기
number(nu) nonumber 게
open noopen Vi ex 게
optimize(opt) optimize
paragraphs=(para=) IPLPPQPPLIbp
prompt prompt ex prompt
readonly(ro) noro ! 기
reraw noredraw
remap remap map
report= 5 경 기 공
scroll 1/2
sections= SHNHH section
shell=(sh=) 경
shiftwith=(sw=) 기
showmatch(sm) {,( 경 },) 1 고
showmode noshowmode "input mode"
slowopen(slow) tab 경 공간
tabstop(ts=) tab간격 경
taglength(tl=) tab 결
tags= tag /usr/lib/tags 그 pass
term=
timeout(to) timeout 간
tty type= Set 1 "time out"
warn warn
window=(w=) 고 경 경고
wrapmargin=(wm=) 0
wrapscan(ws) ws
writeany(wa) nowa 기