How to Use Vim
One thing I have learned during web page design class is how to use vim.
How to Open and Close Vim
How to Open Vim
- Open the terminal.
- Navigate to the file you want to edit.
- Open the file by typing "vim" then the file name, like this:
vim file_name
.
- Hit Enter or Return
How to Close Vim
Start by clicking escape, then :. Next, you type one of the two following commands:
- q, This quits vim without saving.
- wq, This save and quits.
Some Basic Controls and Commands in Vim
- J
- Moves down one row
- K
- Moves up a row
- L
- Moves to the right when on a row with text
- H
- Moves to the left when on a row with text
- syntax on
- To turn on syntax mode which will color your code, first type escape then
: syntax on
- w
- To save, you can click escape then : and lastly w
What You Can do in Vim
You can do a lot in vim such as writing code. For example, if you wanted to write "Hello World" in html on your page you could write the following:
<!DOCTYPE html>
<html lang="en">
<head>
<title>A page that says "Hello World"</title>
</head>
<body>
<p>Hello World</p>
</body>
After publishing, the message should look like this:
Hello World