Linu实验六vi文本编辑器.docx
《Linu实验六vi文本编辑器.docx》由会员分享,可在线阅读,更多相关《Linu实验六vi文本编辑器.docx(14页珍藏版)》请在冰豆网上搜索。
Linu实验六vi文本编辑器
实验六Vi文本编辑器
上机实验容:
练习一:
1.
请在/root这个目录下建立一个名为vitest的目录;
2.进入vitest这个目录当中:
[root@localhost〜]#cd../root/vitest
[root(aiocalhostvitest]#|
3.将/etc/man.config拷贝到本目录底下:
[root(aiocalhost-]#cd../root/vitest
[root@localhostvitest]#cp/etc/man.config/root/vitest[root@localhostvitest]#Is
man.config
4.使用vi开启本目录下的man.config这个档案:
b
#Generatedautomaticallyfromman.conf.inbythe
#configurescript.
#
#man.conffromman・:
L・6f
#
#Formoreinformationaboutthisfile,seethemanpagesman(l)
#andman.conf(5)・
#
#Thisfileisreadbymantoconfigurethedefaultmanpath(alsoused
#whenMANPATHcontainsanemptysubstring)ftofindoutwherethecat
#pagescorrespondingtogivenmanpagesshouldbestored,
#andtomapeachPATHelementtoamanpathelement.
#Itmayalsorecordthepathnameofthemanbinary・[Thisisunused.]
#Theformatis:
#MANBIN
#HANPATH
#HANPATHMAP
#
pathname
manpath_element[correspondingcatdi门pathelementmanpathelement
#
tobeequaltothemandirandcatletc.subdirs).
Ifnocatdirisgiven.itisassumed
#(sothatthisdirhasbothmauletc.
#ThisisthetraditionalUnixsetup.
5.在vi中设泄一下行号;
95TROFF
/usr/bin/groff-Tps・mandoc
96NROFF
/usr/bin/nroff-c-mandoc2>/dev/null
97EQN
/usr/bin/geqn-Tps
98NEQN
/usr/bin/geqn-Tutf8
99TBL
/usr/bin/gtbl
100#COL
/usr/bin/col
101REFER
/usr/bin/grefer
:
setnumber
6.移动到第62行,向右移动40个字元?
|:
62G;40|
61#Thebelowmappingsaresuperfluouswhentherighthandsideis
62#inthemandatorymanpathalready,butjwillkeepmanfromstatting,63#lotsofothernearbyfilesanddirectories・
7.移动到第一行,并且向下搜寻一下『teTeXJ这个字串?
1S
2#6eneratedautonaticallyfromman.conf.inbythe
3#configurescript・
4#
5#man.conffromnan・1.6f
6#
7#Formoreinfornationaboutthisfile,seethemanpagesman(l)
8#andman.conf(5)・
9#
10#Thisfileisreadbymantoconfigurethedefaultmanpath(alsoused
11#whenMANPATHcontainsanemptysubstring),tofindoutwherethecat
12#pagescorrespondingtogivenmanpagesshouldbestored,
13#andtomapeachPATHelementtoamanpathelement.
14
#Itmayalsorecordthepathnameofthemanbinary.[Thisisunused・]
15#Theformatis:
pathname
manpathelement[correspondingcatdir]pathelementmanpathelement
8.接着下来,我要将50到100行之间的man改为MAN,并且一个一个挑选是否需要修改?
61#Thebelowmappingsaresuperfluouswhentherighthandsideis
62#inthe^gdatory|ajipathalready,butwillkeepmanfromstatting
30%
替换为HAN(y/n/a/q/lrErY)?
|51.18-24
9.修改完之后,突然反悔了,要全部复原?
44MANPATH/usr/share/lian
45MANPATH/usr/local/man
46HANPAIH/usr/local/share/jianl
47HANPATH/usr/XHR6/fan
48#
49#Uncommentifyouwanttoincludeoneofthesebydefault
50#
51#MANPATH
52#MANPATH
53#MANPATH
54#MANPATH
55#
/opt/*/MAN/usr/lib厂/MAN/usr/share/*/MAN/usr/kerberos/MAN
56#SetupPATHtoMANPATHmapping
57#
58#Ifpeopleaskfor"MANfooMandhave,7dir/bin/fooNintheirPATH
59#andthedocsarefoundinM/dir/MAN"rthennomappingisrequired・
60#
61#Thebelowmappingsaresuperfluouswhentherighthandsideis
62#intheMANdatoryMANpathalready,butwillkeepMANfromstatting
63#lotsofothernearbyfilesanddirectories・
=64#
44MANPATH/usr/share/B|
45MANPATH画
46manpath/local/share/jian
47MANPATH/usr/XLlR6/Jian
48a
ifyouwanttoincludeoneofthesebydefault
#Generatedautomaticallyfrommar|.conf.inbythe
#configurescript・
##
#Formoreinformationaboutthisfile,
#and[narj.conf(5).
#
#Thisfileisreadbymantoconfigurethedefaultmanpath(alsoused
SExplicitlygivencatdirsoveide・
#
13#FSSTND
14
15#
16#Thisfileisalsoreadbymaninordertofindhowtocallnroffrless,etc・.
17#andtodeterminethecorrespondencebetweenextensionsanddecompressors・
18#
19#MANBIN/usr/local/bin/fiart
20#
21#Everyautomaticallygeneratedr-1ANPATHincludesthesefields
22#
少J20行11,1顶端
12•将这个档案另存成一个man.test.config的档名:
13#FSSTND
14
15
#
16#Thisfileisalsoreadbymaninordertofindhowtocallnroff,less,et
c.,
17#andtodeterminethecorrespondencebetweenextensionsanddecompressors・
18#
19#MANBIN/usr/local/bin/画
20#
21#EveryautomaticallygeneratedMANPATHincludesthesefields
22#
wman.tgst.config
13.去到第29行,并且删除15个字符:
(29G之后,15X即可删除15个字符)
13#FSSTND
14
15#
16#Thisfileisalsoreadbymaninordertofindhowtocallnroffrless,etc.f
17#andtodeterminethecorrespondencebetweenextensionsanddecompressors・
18#
19#MANBIN/usr/local/bin/tog
20#
21#EveryautomaticallygeneratedMANPATHincludesthesefields
22#
29f15x|
14.储存后离开吧!
:
如
练习二
1.把操作目录转到/tmp
[root@localhost-]#cd/tmp[root(aiocalhosttmp]#[]
2.使用vim同时新建并编辑两个文件t1,t2
3.在两个文件中分别输入容并保存文本
回root创ocalhost:
-
.□:
文件(f)漪辑(巳童看(y)援奈⑸终端⑴帘助(也—
056789
K2
14
全部
123456
-
1J
•'t2MIL.7C
4.把t1的第一行复制粘贴到t2的第二行
固root@localhost:
~
文件(巳W(E)1<(Y)援宗⑸终端(I)帘助(H)456789
023456
I
123456
,t2MIL,7C
5.保存t2
6.显示当前打开的所有文件编号
文件(f)编辑匡)查看(V)援宗(S;
t2
123456
tl
:
files
1
行行行
121
隽第第
#aMtlM
2%a,,t2,1
3,,[t2]H
请按ENTER或其它命令继绫■
7.退出vim编借界而
回root@localhost:
-
还有2个文件等待编辑
[root(aiocalhost~]#vimtlt2
逕有2个文件等待编辑
Lroot^localhost~]#[]
练习三:
1.使用vim打开刚才创建的两个文件t1,t2
园root^localhost:
^.o
文件(E)瞬匡)2S(v)婕亲(5>谿《⑴粘助型)
[t2]0,0-1全部
123456
1,6全飾
己住于民旧的改吏
2.将上而窗口第一行的文本容复制到下面窗口的第二行
峯(日姑陋)或若(Y)够(S)貓(I)«Kb(H)
9Q
4•显示当前打开的所有文件编号
root^localhost:
-
.□XI
线消任)«M(H)
—
U【♦】
1,0-1
全禅
156789
123456
2
Z・1
files
1.松令"tl-
第1行
2a-t2-
第0行
3#M[T2]-
ft1行
R或其它乔令缁
5.撤消刚才的复制、删除操作
6.恢复刚才的复制、删除操作
7.保存该修改
9.先退出下面的窗口,再退出上而的窗口
root@localhost:
*
-□X
文件迟)卿(E)35挟污(S>约轴Dfltt(H)
456769
Q23456
J
“t2”2L,14C已写入
24