vi Command Generator
Generate vi commands to edit files in the visual editor
Getting Started with vi
## What is vi?
`vi` is the classic screen-oriented text editor found on virtually every Unix system. It is modal (separate insert and command modes) and runs entirely inside the terminal, making it ideal for editing config files over SSH or on minimal servers where no GUI is available.
## How to Use
1. **Set Options**: Pick flags such as read-only mode or a startup Ex command. 2. **Specify File**: Enter the path of the file to open (omit to start with an empty buffer). 3. **Copy & Run**: Paste the generated command into your terminal.
Inside vi: press `i` to insert text, `Esc` to return to command mode, then `:wq` to save and quit (or `:q!` to discard changes).
Common Options
### `-R` Read-only mode Open the file as read-only so accidental edits cannot be saved over the original. Useful for inspecting system files like `/etc/hosts`.
### `-r` Recovery Recover unsaved swap files after a crash or dropped SSH session. Run `vi -r` alone to list recoverable files.
### `-c COMMAND` Run Ex command Execute the given Ex command after the file loads, e.g. `-c ':set number'` to enable line numbers on open.
### `-s` Silent batch mode Run quietly for scripting (read commands from stdin, no prompts). Combine with `-c` to automate edits.
### `-w` Disable SIGHUP Turn off the hangup signal so the editor survives a closed terminal — helpful for long editing sessions.
▶How do I recover a file after a crash?
▶How do I open a file with line numbers already on?
▶What is the difference between vi and vim?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee