免费注册 查看新帖 |

Chinaunix

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

[SCO UNIX] [原创]vi用法集锦 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2002-12-20 15:02 |只看该作者 |倒序浏览
不好意思,是英文的:p

Enter the following subcommands in command mode. You can cancel an incomplete
command by pressing the Esc key. If you need information about the format of vi
subcommands, see "vi General Subcommand Syntax."

Left Arrow or h or Ctrl-H Moves the cursor one character to the left.

Down Arrow or j or Ctrl-J or Ctrl-N Moves the cursor down one line (it remains
in the same column).

Up Arrow or k or Ctrl-P Moves the cursor up one line (it remains in the same
column).

Right Arrow or l Moves the cursor one character to the right.

Moving within a Line by Character Position

Enter the following subcommands in command mode. You can cancel an incomplete
command by pressing the Esc key. If you need information about the format of vi
subcommands, see "vi General Subcommand Syntax."

^ Moves the cursor to the first nonblank character.

0 Moves the cursor to the beginning of the line.

$ Moves the cursor to the end of the line.

fx Moves the cursor to the next x character.

Fx Moves the cursor to the last x character.

tx Moves the cursor to one column before the next x character.

Tx Moves the cursor to one column after the last x character.

&#59; Repeats the last f, F, t, or T subcommand.

, Repeats the last f, F, t, or T subcommand in the opposite direction.

Number| Moves the cursor to the specified column.

Moving to Words

Enter the following subcommands in command mode. If you need information about
the format of vi subcommands, "vi General Subcommand Syntax."

w Moves the cursor to the next small word.

b Moves the cursor to the previous small word.

e Moves the cursor to the next end of a small word.

W Moves the cursor to the next big word.

B Moves the cursor to the previous big word.

E Moves the cursor to the next end of a big word.

Moving by Line Position

Enter the following subcommands in command mode. If you need information about
the format of vi subcommands, see "vi General Subcommand Syntax."

H Moves the cursor to the top line on the screen.

L Moves the cursor to the last line on the screen.

M Moves the cursor to the middle line on the screen.

+ Moves the cursor to the next line at its first nonblank character.

- Moves the cursor to the previous line at its first nonblank character.

Enter Moves the cursor to the next line at its first nonblank character.

Moving to Sentences, Paragraphs, or Sections

Enter the following subcommands in command mode. You can cancel an incomplete
subcommand by pressing the Esc key. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

( Places the cursor at the beginning of the previous sentence, or the previous
s-expression if you are in LISP mode.

) Places the cursor at the beginning of the next sentence, or the next
s-expression if you are in LISP mode.

{ Places the cursor at the beginning of the previous paragraph, or at the next
list if you are in LISP mode.

} Places the cursor at the beginning of the next paragraph, at the next section
if you are in C mode, or at the next list if you are in LISP mode.

]] Places the cursor at the next section, or function if you are in LISP mode.

[[ Places the cursor at the previous section, or function if you are in LISP
mode.

Moving by Redrawing the Screen

Enter the following subcommands in command mode. You can cancel an incomplete
subcommand by pressing the Esc key. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

z Redraws the screen with the current line at the top of the screen.

z- Redraws the screen with the current line at the bottom of the screen.

z. Redraws the screen with the current line at the center of the screen.

/Pattern/z- Redraws the screen with the line containing the character string,
specified by the Pattern parameter, at the bottom.

Paging and Scrolling

Enter the following subcommands in command mode. You can cancel an incomplete
subcommand by pressing the Esc key. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

Ctrl-U Scrolls up one-half screen.

Ctrl-D Scrolls down one-half screen.

Ctrl-F Scrolls forward one screen.

Ctrl-B Scrolls backward one screen.

Ctrl-E Scrolls the window down one line.

Ctrl-Y Scrolls the window up one line.

z+ Pages up.

z^ Pages down.

Searching for Patterns

Enter the following subcommands in command mode. You can cancel an incomplete
subcommand by pressing the Esc key. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

[Number]G Places the cursor at the line number specified by the Number parameter
or at the last line if the Number parameter is not specified.

/Pattern Places the cursor at the next line containing the character string
specified by the Pattern parameter.

?Pattern Places the cursor at the next previous line containing the character
string specified by the Pattern parameter.

n Repeats the last search for the text specified by the Pattern parameter in the
same direction.

N Repeats the last search for the text specified by the Pattern parameter in the
opposite direction.

/Pattern/+Number Places the cursor the specified number of lines after the line
matching the character string specified by the Pattern parameter.

?Pattern?-Number Places the cursor the specified number of lines before the line
matching the character string specified by the Pattern parameter.

% Finds the parenthesis or brace that matches the one at current cursor
position.

Editing Text

The subcommands for editing enable you to perform the following tasks:

  o Marking a specific location in a file and returning
  o Adding text to a file
  o Changing text while in input mode
  o Changing text from command mode
  o Copying and moving text
  o Restoring and repeating changes

Marking a Specific Location in a File and Returning

Enter the following subcommands in command mode. You can cancel an incomplete
subcommand by pressing the Esc key. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

" Moves the cursor to the previous location of the current line.

" Moves the cursor to the beginning of the line containing the previous location
of the current line.

mx Marks the current position with the letter specified by the x parameter.

`x Moves the cursor to the mark specified by the x parameter.

'x Moves the cursor to the beginning of the line containing the mark specified
by the x parameter.

Adding Text to a File (Text Input Mode)

Enter the following subcommands in command mode to change the vi editor into
text input mode. If you need information about the format of vi subcommands, see
"vi General Subcommand Syntax."

aText Inserts text specified by the Text parameter after the cursor. End text
input mode by pressing the Esc key.

AText Adds text specified by the Text parameter to the end of the line. End text
input mode by pressing the Esc key.

iText Inserts text specified by the Text parameter before the cursor. End text
input mode by pressing the Esc key.

IText Inserts text specified by the Text parameter before the first nonblank
character in the line. End text input mode by pressing the Esc key.

o Adds an empty line below the current line. End text input mode by pressing the
Esc key.

O Adds an empty line above the current line. End text input mode by pressing the
Esc key.

Changing Text While in Input Mode

Use the following subcommands only while in text input mode. These commands have
different meanings in command mode. If you need information about the format of
vi subcommands, see "vi General Subcommand Syntax."

Ctrl-D Goes back to previous autoindent stop.

^ Ctrl-D Ends autoindent for this line only.

0Ctrl-D Moves cursor back to left margin.

Esc Ends insertion and returns to command state.

Ctrl-H Erases the last character.

Ctrl-Q Enters any character if xon is disabled.

Ctrl-V Enters any character.

Ctrl-W Erases the last small word.

\ Quotes the erase and kill characters.

Ctrl-? Interrupts and ends insert or the Ctrl-D key sequence.

Changing Text from Command Mode

Use the following subcommands in command mode. An incomplete subcommand can be
canceled by pressing the Esc key. If you need information about the format of vi
subcommands, see "vi General Subcommand Syntax."

C Changes the rest of the line (same as c$).

cc Changes a line.

cw Changes a word.

cwText Changes a word to the text specified by the Text parameter.

D Deletes the rest of the line (same as d$).

dd Deletes a line.

dw Deletes a word.

J Joins lines.

rx Replaces the current character with the character specified by x.

RText Overwrites characters with the text specified by the Text parameter.

s Substitutes characters (same as cl).

S Substitutes lines (same as cc).

u Undoes the previous change.

x Deletes a character at the cursor.

X Deletes a character before the cursor (same as dh).

<< Shifts one line to the left.

<L Shifts all lines from the cursor to the end of the screen to the left.

>;>; Shifts one line to the right.

>;L Shifts all lines from the cursor to the end of the screen to the right.

~ Changes letter at the cursor to the opposite case.

! Indents for LISP.

Copying and Moving Text

Use the following subcommands in command mode. An incomplete subcommand can be
canceled by pressing the Esc key. If you need information about the format of vi
subcommands, see &quot;vi General Subcommand Syntax.&quot;

p Puts back text from the undo buffer after the cursor.

P Puts back text from the undo buffer before the cursor.

&quot;xp Puts back text from the x buffer.

&quot;xd Deletes text into the x buffer.

y Places the object that follows (for example, w for word) into the undo buffer.

&quot;xy Places the object that follows into the x buffer, where x is any letter.

Y Places the line in the undo buffer.

Restoring and Repeating Changes

Use the following subcommands in command mode. An incomplete subcommand can be
canceled by pressing the Esc key. If you need information about the format of vi
subcommands, see &quot;vi General Subcommand Syntax.&quot;

u Undoes the last change.

    Note: After an undo, the cursor moves to the first non-blank character on
    the updated current line.

U Restores the current line if the cursor has not left the line since the last
change.

. Repeats the last change or increments the &quot;np command.

    Notes:

      1. This subcommand will repeat the last change, including an undo.
         Therefore, after an undo, repeat performs an undo rather than repeat
         the last change.
      2. This subcommand is not meant for use with a macro. Enter @@ (two at
         signs) to repeat a macro.

论坛徽章:
0
2 [报告]
发表于 2002-12-20 15:34 |只看该作者

[原创]vi用法集锦


论坛徽章:
0
3 [报告]
发表于 2002-12-21 12:05 |只看该作者

[原创]vi用法集锦

回头我译出来.

论坛徽章:
0
4 [报告]
发表于 2002-12-21 17:50 |只看该作者

[原创]vi用法集锦

vi自带的帮助比这个详细多了
不过也得翻译

论坛徽章:
0
5 [报告]
发表于 2005-03-13 08:31 |只看该作者

[原创]vi用法集锦

不好以西,看不懂!

论坛徽章:
0
6 [报告]
发表于 2005-03-13 18:17 |只看该作者

[原创]vi用法集锦

这么老的东西,怎么又翻出来了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP