# VI Editor

## What is VI Editor

The vi editor is a text editor under Unix and Linux architecture. It can be challenging to learn and use it. After you become familiar with its commands, it will be your powerful and efficient tool to work on the OpenWrt-based routers and Linux operation system.

The OutdoorRouter's SSH terminal supports VI editor in comand-line mode. You can use the VI editor to search and edit most files after having the file path.&#x20;

For a file named example.php, the command to open it with VI editor under SSH terminal will be&#x20;

```html
vi example.php
```

## Basic Commands

Here are some basic commands for operating the VI editor under an SSH terminal.

* `h`, `j`, `k`, `l`: Move the cursor left, down, up, and right, respectively.
* `i`: Enter Insert mode before the cursor.
* `a`: Enter Insert mode after the cursor.
* `dd`: Delete a line.
* `yy`: Yank (copy) a line.
* `p`: Paste the contents of the buffer after the cursor.
* `:w`: Write (save) the file.
* `:q`: Quit the editor.
* `:wq` or `ZZ`: Write and quit.
* `:q!`: Quit without saving changes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://how.router.works/dev/ssh/vi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
