Basic Syntax Or Command Vi (vim)
There never feel frustrated when you have to do edit the file in Linux? Or have you how the confusion out of the vi editor? I have therefore I write this article that do not have to kill every time should exit from the vi ..
To start vi editor can be done in two ways, namely:
1. to use them directly
vi
and you will be under the vi editor with the blank page.
2. to use them with
vi filename
done to edit a file that already exists or if the filenames are not automatically opened a blank file with a name like that typed.
Mode in vi
1. command mode:
the mode where we give commands to the vi text manipulation to make or files. To ensure that we are in the command mode just press ESC
2. Insert mode:
the mode where we are allowed to insert text to edit or delete text in the file. to start this mode enough when I command in the mode.
Before us dizzy with the commands that we must recognize the following command with this because we can exit from the vi editor.
all done via the command mode
1. : Q [enter]
exit from the vi editor only when there are no modifications at all.
2.ZZ
exit from the vi and save the results of last modification
3. : wq [enter]
exit from the vi and save the results of last modification to the files.
4. [enter]
exit from the vi and save the results of last modification to the files.
5. : q! [enter]
vi forced out of the store without modification results.
Ok you can exit from the vi now we learn how to move in the vi editor.
1. l, right arrow or space
used to move the right one character
2. h, or left arrow
used to move one character to the left
3. j, or down arrow
used to move one line down.
4. k, or arrows on the
used to move a line to the top.
5. : 0 or 1-shift-G
to move to the first line
6. : $
to move to the last line
7. nG
to move to the line to the n
8. 0
to move to the beginning
9. $
to move to the end of the line
After can move freely in the vi editor we learn to do edit the text.
1. x
remove one character at the cursor position
2. X
delete characters to the left of the cursor
3. ss
delete one line at the cursor position
4. d [enter]
remove two barus, position the cursor on the line and the next line
5. d0
remove the line from the beginning until the position where the cursor is located
6. d $
remove from the position of the cursor to the last line.
Switching between the screen (scrolling)
1. ctrl-b
move one screen to the top of the (previous)
2. ctrl-d
move one screen to the bottom (after him)
3. ctrl-f
Decrease the one screen
4. ctrl-j
up half the screen.
Copy and paste
Some commands can be repeated several times by adding the amount of repetition in front of the command.
For example, if you want to copy and paste a few lines of direct use the following steps:
1. place the cursor position on the line, which will be copied.
2. example, if you want to copy 3 rows, use the command 3yy (press 3 followed by a number of key y 2x)
3. place the cursor position on the place that will be in insertkan and then press p.
The commands in vi.
1. U or u
to cancel the previous (Undo)
2. / Or?
command to search for a word used to use them with “word” or “the words” without the quotes, of course
3. / \
This command will only find the word out in which words such as the word ghost, a, and carpenters will be ignored.
4. : 1.7 s / balloon / car / g
to change the word balloon with the words car from the line to 1 to 7
Related Posts:
Tags: editor, Linux, notepad, vi, vim
12.Nov.08
Linux
You can leave a response, or trackback from your own site.
[...] must be based on the table dijalankannya crontab. Please note the difference between cron same crontab. Cron is a program or daemon, [...]