免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 888 | 回复: 0
打印 上一主题 下一主题

Introducing Vi [复制链接]

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-13 22:10 |只看该作者 |倒序浏览

Command
Meaning
vi File Name
Open or Create File
vi
Open New File To Be Named
vi -r File Name
Recover Crashed File
view File Name
Open File Read-Only
vipw
Edit the /etc/passwd file, setting locks and doing appropriate processing.
There are three modes of operation:
Command Mode
Insert Mode
Last Line Mode
Vi Commands Used To Edit Files Positioning The Cursor
[/url]
Command
Meaning
h
Move left one character
j
Move down one line
k
Move up one line
l
Move right one character
w
Move right one word
W
Move right one word (Past Punctuation)
b
Move left one word
B
Move left one word (Past Punctuation)
e
Move to end of current word
Return
Move down one line
Backspace
Move left one character
H
Move to top of screen
M
Move to middle of screen
L
Move to bottom on screen
Control-f
Scroll forward one screen
Control-d
Scroll forward one-half screen
Control-b
Scroll backward one-half screen
G
Go to last line of file
1G
Go to first line of file
21G
Go to 21st line of file
Appending Commands
[url=http://www.manucomp.com/solaris_tips/introducing_vi.html#top]

Command
Meaning
a
Append text after cursor
A
Append text at line end
i
Insert text before cursor
I
Insert text at beginning of line
o
Insert line below cursor
O
Insert line above cursor
Deleting Text
[/url]
Command
Meaning
x
Delete Character at the cursor
X
Delete character to the left of the cursor
dw
Delete word (or part of word to right of cursor)
dd
Delete line containing the cursor
D
Delete part of line to right of cursor
dG
Delete to end of file
d1G
Delete from beginning of file to cursor
:5,10d
Delete lines 5 through 10
Changing Text
[url=http://www.manucomp.com/solaris_tips/introducing_vi.html#top]

Command
Meaning
CW
Change word (or part of word) to right of cursor
cc
Change line
c
Change from cursor to end of line
s
Substitute string for characters from cursor forward
r
Replace character at cursor with one other character
r Return
Break line
Insert Mode
[/url]
Command
Meaning
J
Join current line and line below
xp
Transpose character at cursor and character to the right
~
Change case of letter (upper or lower )
u or :u
Undo previous command
Undo all changes to cuurent line
Copying and Pasting
[url=http://www.manucomp.com/solaris_tips/introducing_vi.html#top]

Command
Meaning
y
Yank or copy line
Y
Yank or copy line
p
Put yanked or deleted line below current
P
Same as above
Saving Changes and Quitting
[/url]
Command
Meaning
:w
Save changes (write buffer)
:w new file
Write buffer to named file
:wq
Save changes and quit Vi
:q!
Quit without saving changes
Displaying and Hiding Line#
[url=http://www.manucomp.com/solaris_tips/introducing_vi.html#top]

The SET command is used from last-line mode to control these options, as indicated in the table.
Command
Meaning
:set nu
Show line numbers
:set nonu
Hide line numbers; setting is case sensitive
:set ic
Searches should ignore case
:set noic
Searches should be case sensitive
:set list
Display invisible characters
Search and Replace
[/url]
Command
Meaning
/string
Search for string
?string
Search backward for string
n
Find next occurrence of string in search direction
N
Find previous occurrence of string in search direction
:%s/old/new/g
Search and replace
Refresh the Screen and Including Files
[url=http://www.manucomp.com/solaris_tips/introducing_vi.html#top]

Command
Meaning
Control-1
Clear (refresh) scrambled screen
:r file name
Insert (read) file after cursor
:34r file name
Insert file after line 34


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/524/showart_84862.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP