vi editor
When you want to work on unix systems, you need to know the basics of using an editor like vi. This will help you to do basic tasks on remote server such as staging, production etc where you don't have your favorite IDE / text editor. This episode covers the basics required to use vi editor.
Here is the notes:
vi demo.txt
~ means that the file is empty. It will disappear when you add lines to the file.
:q! - Quit without saving work
Press i to enter Input mode. It allows text to be typed into the file.
Escape will take the vi to Command Mode (Beeps if it is already in command mode)
:set number [ENTER] will display line numbers
:set nonumber to turn off numbering
i - Insert before the cursor
a - append after the cursor
:help insert - Shows help for insert feature
j or down arrow Moves cursor down
Control-D - Scroll Down
Control-U - Scroll Up
(Half a window at a time)
:q! - Closes the help window
hjkl - To move cursor
x - Delete character
dw - Delete word
dd - Delete a line
u - Undo the previous command (can do multiple undo's)
:redo - Redo (can do multiple redo's)
o - Open a new line below the cursor
O - Open a new line above the cursor
w - Move forward one word at a time
b - Move backward one word at a time
Control-F - Page Down
Control-B - Page Up
:line_number - Go to the line number
r - Replace one character
R - Replace till escape is hit
:s/old/new - Substitute string
~ - Changes case
yy - Yank
p - Paste
Recommended Book
A Practical Guide to UNIX(R) for Mac OS(R) X Users
Signup now to download the episode for free.