Perform basic file edits using an editor: Difference between revisions
From Mintarc Forge
Created page with "== 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)..." |
(No difference)
|
Latest revision as of 08:04, 20 February 2025
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