Journal PDF's Journal: vi Reference
vi is a simple screen-oriented text editor from UNIX. Many clones of vi exist throughout the software world. It is difficult to learn how to use vi because it behaves differently from most other text editors. However, once you learn how to use vi, it is an extremely efficient text editor, and so you'll have vi x.txt ingrained in your frequently-used-commands muscle memory.
Here is how I typically use vi:
- To create a new file or read an existing file, vi x.txt, where x.txt is the filename to edit.
- vi starts out in command mode. With an existing file, use the arrow
keys, Page Up/Page Down, HJKL, or ^f ^b ^d ^u to navigate. Or use the old
ex commands -- for example,
- To start typing text, pressing i or Insert switches to insert mode. Type away and press Esc when done to switch back to command mode. Backspace works unless terminal settings are haywire. Backspace at the beginning of a line probably doesn't do anything... it's the vi way. Delete may not work properly, if at all. You may need to experiment with it. Otherwise, switch to command mode and press x to do a forward delete.
- To yank out an entire line, press dd.
- Cut and paste with mouse. Or, see how to do it properly and also more good esoteric vi commands with this vi cheat sheet.
- To quit:
vi Reference More Login
vi Reference
Slashdot Top Deals