Vi Text Editor
Vi is an old but popular text editor for Linux and other Unix systems. It works differently than most modern text editors. Instead of just typing directly, Vi has different “modes” for different tasks. One mode is for moving the cursor around and making edits. Another mode is for inserting new text. There are also modes for running commands. While Vi can be tricky to learn at first with all its modes and keyboard shortcuts, many experienced programmers love using Vi because it allows them to edit files very quickly and efficiently without using a mouse or menus once they get the hang of it. Vi is extremely lightweight and available on virtually every Unix system, making it a reliable choice.
- First go to normal mode by hitting Esc key
- To cut/delete text, go to normal mode, move cursor and type “dd” to delete a line or “d” plus movement keys to delete text
- To copy text, go to normal mode, move cursor to start of text to copy, type “y” plus movement keys (e.g. “yw” to copy a word)
- To paste, go to normal mode, move cursor to paste location, and type “p” to paste after cursor or “P” to paste before cursor
- Go to normal mode by hitting Esc key
- To delete a range of lines, type “x,yd” where x is the line number to start and y is the line number to end
- E.g. “5,8d” will delete lines 5 through 8
- First make sure you are in normal mode by hitting Esc key
- From normal mode, hit “i” to enter insert mode to start editing at the cursor
- Or hit “a” to enter insert mode after the cursor
- Or hit “o” to start a new line below in insert mode
- First go to normal mode by hitting Esc key
- To save, hit Esc to ensure normal mode, then type “:w” and hit Enter
- To quit, type “:q” and hit Enter
- To quit without saving, type “:q!” (adds ! to force without saving)
- Go to normal mode first by hitting Esc key
- Use h,j,k,l keys to move cursor left, down, up, right
- Or use arrow keys
- Word movement with w (next word) or b (prev word)
- Go to start/end of lines with 0 or $
- Ensure you are in normal mode by hitting Esc first
- To search, hit “/” then type the pattern to find, hit Enter
- To substitute/replace, type “:s/pattern/replacement”
- Use “:s/pattern/replacement/g” to replace all
- Go to normal mode by hitting Esc key
- To undo, hit “u” in normal mode
- To redo after undo, hit Ctrl+R
- If file is open, hit Esc to go to normal mode first
- Type “:q!” (colon, q, !, then Enter) to quit without saving
Linux Text Editors
For Linux users, text editors are essential tools that play a crucial role in various tasks, from coding and writing to system administration and configuration management. Linux offers a wide range of text editors, catering to different preferences and use cases. In this article, we will delve into the world of Linux text editors, exploring their features, strengths, and popular choices among the community.
Mostly Used Text Editors in Linux
- Vi Text Editor
- Vim Editor
- Nano Editor
- Kate Editor
- Sublime Editor
- Atom Editor
- Emacs Editor