A Look at the VI Editor - Undo editing (Page 4 of 4 )
Use u for undoing the last command. For undoing the last edit on the current line only, unless you move off the line you were editing. use U.
Tips: To perform the last change, use . (period once).
Copying and pasting: You can paste the content you deleted, since the deleted contents are kept in a buffer. Use p to paste. Use yy to copy the current line or use :y for copying (or yanking) the current line, and use yw to copy the buffer contents ("yw" for "yank work"). You can use yyp together to copy and paste the current line. Use p to put the buffer contents after the position or after the line. Use P to put the buffer contents before the position or before the line.
You can copy the content in different buffers from a to z, and you can also paste from these buffers by specifying the buffer before the paste command like (a-z)p or (a-z)P. Named buffers may be specified before any deletion, change, yank or put command. The general prefix has the form "c where c is any lowercase character. For example, "adw deletes a word into buffer a. It may thereafter be put back into text with an appropriate "ap.
Searching:Use / for searching in the forward direction and, use ? for searching in the backward direction. The following are some examples.
/str | search down for "str" in forward direction |
?str | search up for "str" in backward direction |
You can ignore cases during searching by using the set command.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |