作者: gopher.nchu.edu.tw (連線精華區)
標題: vi key menu
時間: Wed Dec 11 03:26:52 1996
發信人: cfliu@csie.nctu.edu.tw (劉醇豐), 信區: unix
標 題: Re: 請問那裏可ftp到有關unix vi的說明文件檔 ?
發信站: 交大資工 十舍326室 (Tue Apr 4 15:29:48 1995)
轉信站: pivot!news.nchu!ccnews.nchu!news.cc.nctu!news.csie.nctu!cfliu
[取自交大資工系vihelp指令]
----Invocation----
vi file ; Edit at first line of 'file'
vi file1 file2 ; Edit file1. Edit file2 via :n
vi [options] file ; As above, but with Command Line Options
----Command Line Options----
+n ; Edit at line n
+ ; Edit at last line
+/pattern ; Edit at line containing 'pattern'
-R ; open file(s) in read-only mode
-c ; Use line-oriented command mode
-e ; ... restricted 'edit' mode.
-l ; Enable 'lisp' and 'showmatch' options
-wn ; Specify window size of 'n' lines
----Exiting----
ZZ ; Exit visual mode, saving changes
:x ; Exit saving changes
:wq ; Write buffer, then quit.
:w ; Write buffer to original file
:w file ; Write buffer to 'file'
:w>> file ; Append to 'file'
:n,mw file ; Write lines 'n' through 'm' to 'file'
:q ; Quit out of editor
:q! ; Quit discarding changes
:e! ; Reedit file, discarding changes
----Setting Options----( can be put in .exrc )
:set all ; Prints all option settings
:set option ; Enables option 'option'
:set nooption ; Disables option 'option'
:set option? ; Prints current value of 'option'
:set ; Prints modified options
----Text Input----
i ; Insert before cursor
I ; Insert before first non-blank on line
a ; Append after cursor
A ; Append at end of line
o ; Open and insert at line below
O ; Open and insert at line above
;ESCape key terminates Input mode.
:r file ; Read the content of 'file' into buffer after current line
----Insert Mode Commands----
Control-@ ; Repeat Last Insertion
Control-W ; Erase last word entered
Control-H ; Erase last character entered
DELete or Backspace ; Same as Control-H
Control-U ; Erase entire line
Control-D ; Backtab over 'autoindent' (under :set autoindent)
0Control-D ; Kill all 'autoindent'
^Control-D ; Kill 'autoindent' on current line only
Control-V ; Next character literal (to insert control codes)
----Screen Adjustment----
Control-L ; Clear and redraw screen
Control-R ; Redraw only if @ (deleted) lines
zCR ; Redraw, current line at top of page
z. ; Redraw, current line at center of page
z- ; Redraw, current line at bottom of page
/pattern/z- ; Redraw, line containing 'pattern' at bottom of page
zn. ; Redraw, set new window size of 'n' lines
Control-E ; Scroll down 1 line
Control-Y ; Scroll up 1 line
Control-F ; Scroll forward one screen
Control-B ; Scroll backward one screen
Control-D ; Scroll down half screen
Control-U ; Scroll up half screen
----Cursor Motion----
H ; Move cursor to top of page
M ; ... to middle of page
L ; ... to last line of page
+ ; ... to next line at first non-white character
- ; ... to previous line at first non-white
down-arrow or j ; ... down one line, staying in same column
up-arrow or k ; ... up one line, staying in same column
left-arrow or h ; ... to the left
right-arrow or l ; ... to the right
0 ; ... to beginning of line
^ ; ... to beginning of line (first non-white)
$ ; ... to the end of line
n| ; ... to column 'n'
Control-H ; Same as left-arrow
----File Motion----
G ; Last line of file
nG ; Line 'n' of file
/pattern ; Next line containing 'pattern'
?pattern ; Previous line containing 'pattern'
n ; Next / or ?
N ; previous / or ?
/pattern/+n ; 'n'th line after line containing 'pattern'
?pattern?-n ; 'n'th line before line containing 'pattern'
) ; Next sentence
( ; Preceding sentence
} ; Next paragraph
{ ; Preceding paragraph
]] ; Next section/function
[[ ; Preceding section/function
`` ; Previous context
'' ; Previous context at first non-white in line
----Search Patterns----
^ ; Beginning of line
$ ; End of line
.. ; Any character
* ; Zero or more of previous character
[A-Z] ; Matches any character from A to Z
[abc] ; Matches a, b, or c
[^abc] ; Matches any character BUT a, b or c
\ ; escape character for literal: \ / $ . ^ [ ' & * | ~
\< ; Beginning of word
\> ; End of word
----Marking Position----
mx ; Mark current position with locator 'x'
`x ; Return to position at locator 'x'
'x ; ... at first non-white in line
----Yank and Put----
yy or Y ; Yank line to buffer
yw ; Yank word to buffer
nyy or nY ; Yank 'n' lines to buffer
p ; Put back lines below cursor
P ; Put back lines above cursor
"xyy ; Yank line to buffer 'x'
"x7y ; Yank 7 lines to buffer 'x'
"xy'p ; Yank lines from cur-lin till marked 'p' line to buffer 'x'
"xy`p ; Yank all from cursor till char before marked 'p' to buffer 'x'
"xy/pattern ; Yank all from cursor to the char before pattern to buffer 'x'
"xp ; Put from buffer 'x' after current char or line
"xP ; Put from buffer 'x' before current char or line
----Substitution----
stext ; Substitutes 'text' for character until ESCape
S ; Substitute for entire line until ESCape
:s/X/Y/opt ; Substitute 'Y' for first occurrence of 'X'
; Options: g - Change every currence in line
; c - Confirm each change
; p - Print each change (Command mode only)
& ; Repeat last :substitute command
:g/X/s//Y/opt ; Globally find the first 'X' on each line and
; substitute 'Y' for the string 'X'
; this is same as :1,$s/X/Y/opt
----Deleting Text----
x ; Delete character under cursor
nx ; ... 'n' characters
X ; ... character before cursor
dw ; ... word
ndw ; ... 'n' words
dd ; ... entire line
ndd ; ... 'n' lines
dtx ; ... to 'x' in current line
D ; ... to end of line ( same as d$ )
d/pattern ; ... up to 'pattern' (not included)
d?pattern ; ... back to 'pattern'
d`x ; ... to marked location 'x'
d'x ; ... current line and to line which contains marked location 'x'
d$ ; ... to end of line ( same as D )
d0 ; ... to begin of line (not include char under cursor)
d) ; ... to end of sentence
d( ; ... to beginning of sentence
d} ; ... to end of paragraph
d{ ; ... to beginning of paragraph
d]] ; ... to end of section
d[[ ; ... to beginning of section
----Changing Text----
cw ; Change word
ncw ; ... 'n' words
cc ; ... entire line
ncc ; ... 'n' lines
C ; ... to end of current line
c/pattern ; ... up to 'pattern'
c?pattern ; ... back to 'pattern'
c`x ; ... to marked location 'x'
c'x ; ... current line and to line which contains marked location 'x'
c) ; ... to end of sentence
c( ; ... to beginning of sentence
c} ; ... to end of paragraph
c{ ; ... to beginning of paragraph
c]] ; ... to end of section
c[[ ; ... to beginning of section
rx ; Replace character with 'x'
R ; Replace all characters until ESCape is entered
----Word and Within Line Motions----
w ; Move cursor forward by one word
W ; ... including any punctuation
b ; Move cursor backward by one word
B ; ... including any punctuation
e ; Move cursor forward to end of word
E ; ... including any punctuation
fx ; Search current line (only) forward for 'x'
Fx ; Search current line (only) backward for 'x'
; ; Repeat last 'f' or 'F'
, ; Reverse of last 'f' or 'F'
----Undo----
u ; Undo last change
U ; Restore current line
"np ; Retrieve from buffer 'n' (1-9 and a-z)
"n1pu.u.u.u. ; Scan recent deletions
----Miscellaneous----
.. ; Repeat previous operation
~ ; Reverse case of letter and advance one position
J ; Join lines together
<< ; Shift line left one tab position
>> ; Shift line right one tab position
:g/pattern/p ; Locate and print all occurrences of 'pattern' within the file
xp ; Reverse order of two letters
dwwP ; Reverse order of two words
ddp ; Reverse order of two lines
==============end of vihelp===============
--
Chun-Feng Liu (劉醇豐)
Dept. of Computer Science and Information Engineering
National Chiao-Tung University,Shinchu,Taiwan
Email:cfliu@csie.nctu.edu.tw
Hello!
發信人: cfliu@csie.nctu.edu.tw (劉醇豐), 信區: unix
標 題: Re: 請問那裏可ftp到有關unix vi的說明文件檔 ?
發信站: 交大資工 十舍326室 (Tue Apr 4 15:31:53 1995)
轉信站: pivot!news.nchu!ccnews.nchu!news.cc.nctu!news.csie.nctu!cfliu
[這是較短的版本.取自交大資工系計中helpvi指令]
----exit/save/read file----
:wq ; Write buffer, then quit.
ZZ (same as :wq)
:w ; Write buffer to original file
:w [file] ; Write buffer to "file" or to original file
:r file ; read (include) "file"
:q ; Quit out of editor
:q! ; Quit discarding changes
----Text Input----
i ; Insert before cursor (ESCape key terminates Input mode.)
a ; Append after cursor ( A ; Append at end of line)
o ; Open and insert at line below( O ; Open at line above)
----Cursor Motion----
+ ; ... to next line at first non-white character
- ; ... to previous line at first non-white
up-arrow or k ; ... up one line, staying in same column
down-arrow or j ; ... down one line, staying in same column
left-arrow or h ; ... to the left
right-arrow or l ; ... to the right
0 (zero) ; ... to beginning of line
$ ; ... to the end of line
n ; forward n characters
----File Motion----
G ( or :$ ) ; Last line of file
nG ( or :n ) ; Line 'n' of file
/pattern ; Next line containing 'pattern'
?pattern ; Previous line containing 'pattern'
----Yank and Put----
yy or Y ; Yank line to buffer
nyy or nY ; Yank 'n' lines to buffer
p ; Put back lines below cursor
P ; Put back lines above cursor
"xy ; Yank line to buffer 'x'
"xp ; Put from buffer 'x'
----Deleting Text----
x ; Delete character under cursor
nx ; ... 'n' characters
dd ; ... entire line
ndd ; delete n lines
----Changing Text----
rx ; Replace character with 'x'
R ; Replace all characters until ESCape is entered
----Miscellaneous----
u ; Undo last change
U ; Restore current line
J ; Join lines together
Control-L ; Clear and redraw screen
:g/pattern/p ; Locate and print all occurrences of 'pattern' within the file
:# ; show line number
----Substitution----
:s/X/Y/opt ; Substitute 'Y' for first occurrence of 'X'
; Options: g - Change every ocurrence in line
; c - Confirm each change
; p - Print each change (Command mode only)
& ; Repeat last :substitute command
:g/X/s//Y/opt ; Globally find the first 'X' on each line and
; substitute 'Y' for the string 'X'
--
┌────────────────────────────────────┐
│ 我想去旅行 跟著一顆流浪的星星 走進最深最綠的叢林 一個人遠遠地 ... │
│ 風兒吹開我的心 捲走了憂慮 我把夢想一個一個洗乾淨 │
│ 攤開寫給你的信 那些微笑的字跡 告訴你別為我擔心 │
│ 當夏天過去 在飄雪的夜裡 我會 到你 夢裡 │
└─【風與草的對話】───────────────────────────┘
.
沒有留言:
張貼留言