1. Install vim with this command:
sudo apt-get install vim
2. Edit an HTML file with the commands below (Please ensure that Apache HTTP server has been installed.):
cd /var/www
sudo vim test.html
3. Type i or a or o to enter the insert mode.
4. Edit these:
<html>
<title>My Title</title>
<body>
<P>Edited by Vim.
</body>
</html>
5. Quit the insert mode with the Esc key.
6. Exit the vim editor and save the file with this command:
:wq
If you want to quit without saving:
:q!
Note: Hitting the Esc key to quit the insert mode is required before typing the : commands to exit vim.
7. Open the file from a remote browser:
Basic vim commands:
highlight one line - V
highlight area - v
copy - y
paste - p
undo - u
redo - Ctrl + r
search - /
Reference:
Editor War (Wikipedia)
如何使用vim文字編輯器(Chinese Version of this post)
No comments:
Post a Comment