Perform basic file edits using an editor
From Mintarc Forge
vi/vim - Visual editor
Mode switching: i: Enter insert mode at cursor o: Open new line below cursor and enter insert mode a: Enter insert mode after cursor ESC: Return to command mode
Navigation: h: Move left j: Move down k: Move up l: Move right
Saving and exiting: ZZ: Save and exit
- w!: Force save
- q!: Force quit without saving
- e!: Reload file, discarding changes
Editing: c: Change (delete and enter insert mode) d: Delete p: Paste after cursor y: Yank (copy) dd: Delete entire line yy: Yank entire line
Searching: /pattern: Search forward for pattern ?pattern: Search backward for pattern n: Move to next search result N: Move to previous search result
Switching editors:
EDITOR environment variable sets the default editor Example: export EDITOR=nano
nano - Simple text editor
Example: nano file.txt
emacs - Extensible text editor
Example: emacs file.txt