# Debian Text Editors Debian provides several text editors with different learning curves and capabilities. ## nano Beginner-friendly, simple modal editor. Starts in edit mode: ```bash nano file.txt ``` Common commands (Ctrl prefix): - `Ctrl+X` — exit - `Ctrl+O` — save - `Ctrl+W` — search - `Ctrl+U` — undo - `Ctrl+V` — next page Quick, non-destructive, forgiving. Good for quick edits and scripts. ## vi/vim Powerful but steep learning curve. Three modes: - **Normal** (default) — navigation and commands - **Insert** (press `i`) — edit text - **Command** (`:`) — file/search commands Basic workflow: ```bash vim file.txt i # enter insert mode [edit text] Esc # back to normal :wq # save and quit :q! # quit without saving ``` Useful normal mode commands: - `dd` — delete line - `yy` — copy line - `p` — paste - `/pattern` — search - `:%s/old/new/g` — replace all Vim has syntax highlighting, text objects, macros, and extensive customization. ## emacs Extensible, powerful, but also steep. Heavy Ctrl usage. Start: ```bash emacs file.txt ``` Commands: - `Ctrl+X Ctrl+C` — exit - `Ctrl+X Ctrl+S` — save - `Ctrl+S` — search - `Ctrl+_` — undo Less common on systems without X11; vim is usually available everywhere. ## ed Minimal line editor, rarely needed: ```bash ed file.txt ``` Useful only when nothing else available (embedded systems, minimal recovery). ## Choosing an Editor Set default editor: ```bash export EDITOR=vim export EDITOR=nano ``` Used by `crontab -e`, `visudo`, and many tools. Pick one and learn it: - Quick edits → `nano` - Programming → `vim` - Extensive config → `emacs` For shell scripts: vim with syntax highlighting makes debugging easier. For one-liners: nano is faster.