⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l3.4

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 4
字号:
#print			Second ReviewThese are the commands we've seen for making changes to a file:	i   a = Insert text before ('i') or after ('a') current character	I   A = Insert text at beginning ('I') or end ('A') of line	x   X = Delete current ('x') or previous ('X') character	o   O = Open a new blank line before ('O') or after ('o') current line	   dd = Delete the current line	   cc = Change the current line	r   R = Replace one ('r') or more ('R') characters by overwriting	    s = Substitute new characters for old ones   Type 'ready' to go into vi and get some more practice with thesecommands.  As before, be sure that you understand how each one works;they're the ones you'll use every day.#user#create Review2	i   a = Insert text before ('i') or after ('a') current character	I   A = Insert text at beginning ('I') or end ('A') of line	x   X = Delete current ('x') or previous ('X') character	o   O = Open a new blank line before ('O') or after ('o') current line	   dd = Delete the current line	   cc = Change the current line	r   R = Replace one ('r') or more ('R') characters by overwriting	    s = Substitute new characters for old onesHere is a set of examples, one per command.  If you don't remember howsomething works, you might take a look.---------------------------------------------------------------------------EXAMPLESCommand		Explanation-------		-----------   i		In the text below, if one wanted to fix the word 'novate'		so that it read 'renovate', one would move the cursor to		the 'n' in novate and type 'i' (to go into insert mode),		're' (to add the fix), and hit Escape (to leave insert mode).			I'm going to novate my house.				   ||				   ||				   \/			I'm going to renovate my house.   a		In the text below, suppose one wanted the word 'searching'		instead of 'search'.  One could move the cursor to the 'h'		in search, hit 'a' (to enter insert mode, appending to the		current character), type 'ing' to add the fix, and hit the		Escape key (to exit insert mode).			Chapter Five of this tutorial is on search.					||					||					\/			Chapter Five of this tutorial is on searching.   I	A	Strictly speaking, the 'I' and 'A' commands aren't needed		at all.  One could always just move the cursor to the		beginning or end of the line and type 'i' or 'a'.  They are		merely conveniences for when you are somewhere in a line		and need to insert some text at the front or back of the		line.  I personally find myself using 'A' constantly, to		add a period on the end of a sentence that I forgot earlier,		to continue a sentence that I interrupted, etc.  'I' is less		frequently-used, but nice at least for completeness.  Anyway,		here's the example:		Suppose one wanted to enclose the following C statment in		a comment.  This involves putting a '/*' on the front and a		'*/' on the back.  Assume the cursor is somewhere in the		middle of the line.  One would type 'I' (to go into insert		mode at the front of the line), '/*' (to add the opening of		the comment), Escape (to leave insert mode), 'A' (to insert		at the end of the line), '*/' (to close the comment), and		Escape again (to again leave insert mode).			if (getchar() != EOF) count++;				||				||				\/			/*if (getchar() != EOF) count++;*/   x   X	In the expression below, suppose one wanted to be rid of the		'(or -)' phrase.  One could move the cursor to that opening		parenthesis and type 'xxxxxxx' (i.e. seven x's).  An easier		way would be to type '7x', which has the same effect.  For		people used to a back-space style deletion, move the cursor		to the 's' and type 'XXXXXXX' or '7X'.			(-b + (or -) sqrt(b*b - 4*a*c)) / (2*a)				    ||				    ||				    \/			(-b + sqrt(b*b - 4*a*c)) / (2*a)   o   O	Any time you want to add a line of text to your file, you'll		probably use the 'open' commands.  Which one you use generally		depends entirely upon where you happen to be in relation to		where you want to add the line.  If you're right above it,		you'll use 'o', if right below, it'll be 'O'.		To add another item to the end of the list below, one would 		move the cursor to the current last line (#3), hit 'o' (to		open up space for the new line), type the new item, and hit		Escape (to leave insert mode).			1. Finish writing that darn tutorial			2. Find out about VAX Prolog implementation			3. Set up meeting times with NET committee				    ||				    ||				    \/			1. Finish writing that darn tutorial			2. Find out about VAX Prolog implementation			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home   dd	^R	A very easy command to use.  To delete item #2 in the list		below, just move the cursor to that line and type 'dd'.		The line will go away, but (if you're using a 'dumb'		terminal) it will be replaced by a blank line with an		at-sign ('@') in the first column. To get rid of that		pseudo-line, just type ^R.  Remember, those at-sign lines		aren't really in your file, they're just a convenience so		that vi won't take time to redraw the screen every time		you delete a line.			1. Finish writing that darn tutorial			2. Find out about VAX Prolog implementation			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home				    ||				    ||				    \/			1. Finish writing that darn tutorial			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home   cc		To change item #2 in the list below, just move the cursor		to that line, hit 'cc' (the line will disappear and you'll		be in insert mode), type the replacement line, and hit		Escape (to leave insert mode).				1. Finish writing that darn tutorial			2. Find out about VAX Prolog implementation			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home				    ||				    ||				    \/			1. Finish writing that darn tutorial			2. Write folks at Rochester about Prolog/VAX			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home   r		Having deleted an item from the list below, it would be		nice to fix up the line numbers.  Just move the cursor		to the '3' and type 'r2' to replace it with a '2'.  Similarly,		move to the '4' and type 'r3'.			1. Finish writing that darn tutorial			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home				    ||				    ||				    \/			1. Finish writing that darn tutorial			2. Set up meeting times with NET committee			3. Buy a loaf of bread on way home   R		To change the table entries below when Prof. Conway gets		his new Ambassador, one could just use the 'x' command to		delete the word 'Datamedia' and then use 'i' to type in		'Ambassador', but that's a lot of work and besides, it		might mess up the nice way in which the table lines up.		Instead, move the cursor to the 'D' on Conway's line,		type 'R' (to go into overwrite mode), type 'Ambassador',		and hit Escape (to leave overwrite mode).		 tty     where      what           baud    device  who		-----  ----------  -----           ----    ------  --- 		ttyh0  422  Upson  Ambassador      9600    TS  7   Demers		ttyi0  419c Upson  Datamedia       9600    TS  8   Gilbert		ttyj0  408  Upson  Datamedia       9600    TS  9   Conway		ttyk0  415c Upson  Ambassador      9600    TS  10  Gries				    ||				    ||				    \/		 tty     where      what           baud    device  who		-----  ----------  -----           ----    ------  --- 		ttyh0  422  Upson  Ambassador      9600    TS  7   Demers		ttyi0  419c Upson  Datamedia       9600    TS  8   Gilbert		ttyj0  408  Upson  Ambassador      9600    TS  9   Conway		ttyk0  415c Upson  Ambassador      9600    TS  10  Gries   s		Substituting is usually handy when there are some number		of characters that you want to replace with some other number		of characters.  If the two numbers are the same, you could use		the 'R' command.  If not, 's' is probably your best bet.  For		example, suppose, in the list below, you wanted to change		the word 'VAX' to 'PDP11'.  You'd move the cursor to the 'V'		and hit '3s', meaning that you're going to type some stuff to		replace the next three characters.  You'd then type 'PDP11'		and hit Escape, to leave insert mode.			1. Finish writing that darn tutorial			2. Find out about VAX Prolog implementation			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home				    ||				    ||				    \/			1. Finish writing that darn tutorial			2. Find out about PDP11 Prolog implementation			3. Set up meeting times with NET committee			4. Buy a loaf of bread on way home#vi Review2#next4.0  10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -