Introduction to Terminal Editors: Basic Operations of Ubuntu vi/vim
In the Ubuntu system, vi/vim is an efficient terminal-based text editing tool with powerful functionality and no need for a graphical interface. To open a file, use `vim filename`. Common exit commands include `:wq` (save and exit, most frequently used), `:q` (if no changes were made), and `:q!` (force quit without saving changes). The core consists of three modes: In command mode (default), use `h/j/k/l` to move the cursor, `x/dd` to delete, `yy` to copy, and `u` to undo. Insert mode is entered by pressing `i/a/o`, and `Esc` returns to command mode. In bottom-line mode (accessed by pressing `:`), commands like `w` (save), `:/keyword` (search), and `:set nu` (display line numbers) can be executed. Quick practice: `vim test.txt` to create a new file, use `i` to insert text, `dd` to delete an incorrect line, `yy` + `p` to copy and paste, and finally `:wq` to save. Beginner tips: `u` for undo, `[number]G` to jump to a specific line, `vim -R` for read-only mode, and note that vim is an enhanced version of vi. Mastering mode switching and frequently used operations (`i`, `dd`, `p`, `wq`) allows for rapid proficiency.
Read More