- 浏览: 1397134 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (328)
- JSF (27)
- 生活 (12)
- Ajax (26)
- Maven (6)
- CSS (1)
- Shale (3)
- SiteMesh (1)
- Ext (15)
- JMX (2)
- Windows技巧 (7)
- 工作感悟 (18)
- SVN (2)
- SVG (0)
- GoogleGear (0)
- RAP (2)
- SOA与WebService (3)
- 笔记本技术研究 (1)
- Microsoft (2)
- 英语学习 (3)
- PHP (7)
- web 2.0 (6)
- 语义Web (1)
- IT史话 (3)
- iText (3)
- JVM (1)
- PropertiesEditor (1)
- J2SE (33)
- Spring (2)
- Java Batch (1)
- log (2)
- Struts2 (2)
- DWR (0)
- JAAS (3)
- EJB3 (4)
- Flex (8)
- JFreeChart (1)
- WAS (0)
- 数据库 (2)
- 摄影 (0)
- SQL (1)
- Google App Engine (1)
- linux (5)
- Eclipse plugin (10)
- Testing (0)
- Portal (0)
- 移动互联网 (0)
- SWTBot (1)
最新评论
-
江奇缘:
不错!!!!!!
web.xml里<filter-mapping>中的<dispatcher>作用 -
yy8093:
commonj 第三步,那个调用的方法要在哪里调?servle ...
JAVA中多种计时器的比较与分析 -
di1984HIT:
学习了,不错~
web.xml里<filter-mapping>中的<dispatcher>作用 -
penkee:
com.lowagie.text.DocumentExcept ...
iText中输出 中文 -
氵壞男亼乀:
我想请问下 你哪个html里面引入的几个js文件没看懂!你 ...
DWR入门教程之HelloWorld
vi is Found on Nearly Every Unix Computer vi is Powerful and Fast vi Stays Out of Your Way Open a file with vi. Type: vi myfile.txt Command Mode Insert (or Text) Mode When in doubt about which mode you are in, press <Esc> NOTE: Many vi commands can take a leading count (e. g., 6k, 7e). Displaying Line Numbers Setting Right Margin You are back at the Unix prompt. Deleted text goes into a temporary buffer that is replaced each time you delete (or copy) more text. The current contents of the buffer can be put back into your file. Copied text goes into a temporary buffer that is replaced each time you copy (or delete) more text. Only the current contents of the temporary buffer can be put back into your file. As a result, when you use copy (y), use the put (p) command immediately. A yank and put procedure using colon commands: Temporary Buffer Deleted or copied text goes into a temporary unnamed buffer. The contents of the temporary buffer may be retrieved by using the p or P commands. Lettered Buffers There are 26 lettered buffers (a-z). Contents of a lettered buffer are saved until you copy or delete more characters into it, or until you quit your current vi session. Both temporary and lettered buffers last only for the current vi session. :beginning_line, ending_line command destination where destination is the line after which you want the text placed. The simplest way to do substitutions over a range of lines, or throughout the file, is to use the s colon command. The basic form of this command is the following: Options can be set four ways: On the Uniform Access systems (Homer, Saul, Mead, Alcott), the EXINIT environmental variable is used to set the shell within which the vi editor operates. Since the EXINIT environmental variable, if it has been defined, overrides anything set by a .exrc file, customizing vi on these computers requires redefining EXINIT. For example, to add numbering and auto indent, you would take the following steps: This response indicates that the shell is set to the C shell. Order of Precedence Do not leave blank lines at the beginning or end of the .exrc file. Abbreviations are text strings that automatically expand into larger strings during insert mode. Mapping defines a single key to execute a sequence of keystrokes when the single key is pressed in command mode. In the following example,the @ key is mapped to replace the current word with "University of Washington". The <Control>v allows you to enter the <Esc> key into the command sequence. Mapping can also be used to call commands external to vi, such as sort or fmt. In the following example, the @ sign is mapped to the sort command, so that the current paragraph (indicated by the }) will be sorted. The <Control>v allows you to enter the <Return> key into the command sequence. The second <Return> completes the map command. Note: You can also put abbreviation and mapping commands in your .exrc file. When finished editing in vi, exit vi and you will be returned to the compose screen. You can edit more than one file at a time with vi. When you print a file you may want the left margin moved to the right. This leaves room for a three-hole punch. You can issue a single shell command while in the vi editor. For example, to list the files in your directory (ls), follow these steps: You can issue many shell commands by temporarily leaving the vi editor. Occasionally, you may want a double spaced version of your file for editing or review. © Copyright 1996 University of Washington Computing & Communications. Class notes URL: http://weber.u.washington.edu/~rells/R110/
Using vi, the Unix Visual Editor
A. VI BASICS
From Command Mode
k Up one line
j Down one line
h Left one character
l Right one character (or use <Spacebar>)
w Right one word
b Left one word
From Command Mode
i Enter text entry mode
x Delete a character
dd Delete a line
r Replace a character
R Overwrite text, press <Esc> to end
From Command Mode
:set nu Display line numbers
:set nonu Hide line numbers
From Command Mode
:set wm=number Set Wrap Margin number of spaces from right
edge of screen
:set wm=10 Set Wrap Margin 10 spaces from right edge
of screen
:set wm=0 Turn off Wrap Margin
From Command Mode
ZZ Write (if there were changes), then quit
:wq Write, then quit
:q Quit (will only work if file has not been changed)
:q! Quit without saving changes to file
UNIX ---> vi file ---> COMMAND ---> i I a A o O ---> TEXT
SHELL <---- ZZ <------- MODE <------ <Esc> <------ MODE
B. INTERMEDIATE VI
From Command Mode
e Move to end of current word
$ Move to end of current line
^ Move to beginning of current line
+ Move to beginning of next line
- Move to beginning of previous line
G Go to last line of the file
:n Go to line with this number (:10 goes to line 10)
<Ctrl>d Scroll down one-half screen
<Ctrl>u Scroll up one-half screen
<Ctrl>f Scroll forward one full screen
<Ctrl>b Scroll backward one full screen
) Move to the next sentence
( Move to the previous sentence
} Move to the next paragraph
{ Move to the previous paragraph
H Move to the top line of the screen
M Move to the middle line of the screen
L Move to the last line of the screen
% Move to matching bracket: ( { [ ] } )
From Command Mode
i Insert text before current character
a Append text after current character
I Begin text insertion at the beginning of a line
A Append text at end of a line
o Open a new line below current line
O Open a new line above current line
Format Example
operator number object c2w
number operator object 2cw
Operators
c change
d delete
y yank
Objects and Locations
w one word forward
b one word backward
e end of word
H, M, L top, middle, or bottom line on screen
), ( next sentence, previous sentence
}, { next paragraph, previous paragraph
^, $ beginning of line, end of line
/pattern/ forward to pattern
From Command Mode
r Replace only the character under the cursor.
(Note: using r you remain in command mode.)
R Beginning with the character under the cursor,
replace as many characters on this line as you
want. (You are in overtype mode until you
press <Esc>
cw Beginning with the character under the cursor,
change a word to whatever you type. (You are
in insert mode until you press <Esc>)
c$ Beginning with the character under the cursor,
C change a line to whatever you type. (You are
in insert mode until you press <Esc>)
From Command Mode
x Delete a character
dw Delete an alphabetic word and the following space
(6dw deletes six words)
dW Delete a blank-delimited word and the following space
dd Delete a line (6dd deletes six lines)
d$ Delete all characters to the end of the line.
D
d} Delete all characters to the end of the paragraph.
:5,30d Delete lines 5 through 30
From Command Mode
yy Copy (yank) the current line
6yy Copy (yank) six lines, beginning with the current line
yw Copy the current word
p Put the text after the cursor position
P Put the text before the cursor position
From Command Mode
. Repeat last command
n. Repeat last command n number of times
J Join next line to current line
u Undo last single change
U Restore current line
~ Change letter's case (capital to lower and vice versa)
p Put words from temporary buffer after cursor or
put lines from temporary buffer below current line
P Put words from temporary buffer before cursor or
put lines from temporary buffer above current line
From Command Mode
"ayy Copy (yank) a line into buffer a
"Ayy Appends to buffer a
"a10yy Copies 10 lines into buffer a
"a10dd Deletes 10 lines of text into buffer a
"ap Put contents of lettered buffer a below the current line
From Command Mode
:5,10 co 105 Copy lines 5-10 to the line after 105
:5,20 m $ Move lines 5-20 to end of file
:7,300 d Delete lines 7-300 (to buffer)
From Command Mode
/text Search forward (down) for text (text can include spaces
and characters with special meanings.)
?text Search backward (up) for text
n Repeat last search in the same direction
N Repeat last search in the opposite direction
fchar Search forward for a charcter on current line
Fchar Search backward for a character on current line
; Repeat last character search in the same direction
% Find matching ( ), { }, or [ ]
:n1,n2s/old/new/gc
n1 is the beginning line
n2 is the ending line number
s means to substitute text matching the pattern (old)
with text specified by (new)
g (global) is optional. It indicates you want to substitute
all occurrences on the indicated lines. If you use
g, the editor substitutes only the first occurrence
on the indicated lines.
c (confirm) is optional. It indicates you want to confirm
each substitution before vi completes it.
From Command Mode
:%s/old/new/g Substitutes old with new throughout the file
:.,$s/old/new/g Substitutes old with new from the current
cursor position to the end of the file
:^,.s/old/new/g Substitutes old with new from the beginning
of the file to the current cursor position
:& Repeats the last substitute (:s) command
C. ADVANCED VI
From Command Mode
:w file Write current file to file
:w>>file Append current file to file
:5,10w file Write lines 5 through 10 to file
:5,10w>>file Append Lines 5 through 10 to file
:r file Read a copy of file into current file
:!ls See a list of files in your current directory
From Command Mode-within vi for the current file only
:set all Display all options
:set Display current settings of options
:set nooption Unset option
:set ai Set Auto Indentation during text entry
:set ic Set Ignore Case during searches
:set nu Show line Numbers
:set sm Show Matching ( or { when ) or } is entered
:set wm=10 Set Wrap Margin 10 spaces from right edge of screen
:set nu
Sample contents of a .exrc file
set nu
set ai
set wm=10
Example of setting the EXINIT environmental variable
setenv EXINIT "set nu ai ic"
% printenv EXINIT
set shell=/bin/csh
% setenv EXINIT "$EXINIT nu ai"
% printenv EXINIT
set shell=/bin/csh nu ai
set ai
set ic
set nu
set wm=8
From Command Mode
:ab UW University of Washington
From Command Mode
:map @ cwUniversity of Washington <Control>v <Esc> <Return>
From Command Mode
:map @ !}sort <Control>v <Return> <Return>
D. TIPS AND TRICKS
editor=
editor=vi
From The Unix Shell Prompt
vi file1 file2 vi two (or more) files at the same time
From Command Mode
:n Move to file2 from file1
:rew Rewind back to file1
:e! Restore original file1 file2 (start all over)
ZZ Save and quit file. (Must be done for each file.)
From Command Mode
:1,$> Move entire file 1 shift width (eight spaces)
to the right
:1,$< Move entire file eight spaces to the left
:%s/^/ /g Insert any number of spaces at the
beginning of each line in the entire file.
Simply press the space bar the
desired number of times.
:20>> Moves next 20 lines over 1 shift width.
From Command Mode
:w Write changes to your file (just in case).
:!ls List contents of your current directory on the screen.
Press <Return> to return to vi.
From Command Mode
:w Write changes to your file.
:sh Return to the shell to enter a number of commands
without leaving vi.
Press <Control>d to return to vi editing.
In Command Mode
:w original.backup Save a backup copy of the original file
:%! sed G Double space the entire file.
:1,5! sed G Double space the lines from 1-5.
This tutorial has been adapted from course notes developed by Rick Ells and Kathryn Sharpe. The original copyright notice is reproduced below.
Permission to reprint or adapt sections from these class notes for noncommercial purposes is granted, provided that the source is acknowledged. Inquiries may be submitted to rells@cac.washington.edu.
Your comments on this class are welcome. Please send email to rells@cac.washington.edu
Last Modified: August 1, 1996
发表评论
-
ubuntu11.04 恢复菜单栏
2011-06-14 21:37 4267ubuntu终端在:应用程序->附件->终端中 ... -
linux 中安装中文字体
2010-05-07 17:42 6368可能是因为在安装linux的过程中忘记了选择支持中文, ... -
Linux下常用压缩格式的压缩与解压方法
2009-07-23 13:32 1273Linux下常用压缩格式的压缩与解压方法 .tar解 ... -
-bash: /bin/rm: Argument list too long
2009-07-23 10:59 7366今天要删除shopex的cache目录下的文件,结果提示 - ...
相关推荐
Stephen Rago's update is a long overdue benefit to the community of professionals using the versatile family of UNIX and UNIX-like operating environments. It removes obsolescence and includes newer ...
Chapter 5 The vi/vim Editor Chapter 6 The Shell Chapter 7 The Process Chapter 8 The Shell—Customizing the Environment Chapter 9 Simple Filters Chapter 10 Filters Using Regular Expressions—grep and ...
OrCAD PCB Editor is a relatively new printed circuit board (PCB) design application that has replaced ...new users of the software with a basic introduction to OrCAD PCB Editor and the design of PCBs.
OrCAD PCB Editor is a relatively new printed circuit board (PCB) design application that has replaced ...new users of the software with a basic introduction to OrCAD PCB Editor and the design of PCBs.
"Stephen Rago's update is a long overdue benefit to the community of professionals using the versatile family of UNIX and UNIX-like operating environments. It removes obsolescence and includes newer ...
vi(Visual Editor)是Linux和Unix系统中最常用的文本编辑器之一,它的全称是“视觉编辑器”。vi不仅适用于简单的文本编辑,还具备强大的文本处理功能,是许多系统管理员和程序员的首选工具。由于vi在命令模式下工作...
This book covers using Visual Studio LightSwitch 2013 to create LightSwitch HTML Client, and Cloud Business Applications. This book describes creating ...
03 Coding Challenge #1 - Using the Layout Editor in Android Studio and Github
A practical, problem-solving approach to the fundamental concepts of Object Oriented Design and their application using C++. This book is written for the "engineer in the trenches". It is a serious ...
《Special Edition Using Visual C++ 6》是一本深入讲解微软Visual C++ 6开发环境的专著,其源代码提供给读者实践和学习C++编程的宝贵资源。Visual C++ 6是微软在1998年发布的经典版本,它在当时是Windows平台上最...
Using a practical approach, this book provides hands-on examples and detailed explanations to demystify the UNIX environment. Designed for the novice to intermediate user, it covers basic user-level ...
Using examples from leading open-source projects, he shows UNIX and Linux programmers how to apply this wisdom in building software that's more elegant, more portable, more reusable, and longer-lived...
《Visual Studio Tools for Office Using C# with Excel, Word, Outlook and InfoPath》是一本非常全面且实用的指南,它不仅深入浅出地介绍了 VSTO 的各个方面,而且还提供了大量的实例和代码片段,对于想要使用 C# ...
Arbortext Editor can be extensively customized using the Arbortext Command Language (ACL). You can also use Arbortext Editor with the Arbortext Content Manager(or Windchill) as a content management ...
Abstract— In this paper, we present a monocular visual-inertial odometry algorithm which, by directly using pixel intensity errors of image patches, achieves accurate tracking performance while ...