Using Vi, The Unix Visual Editor - University Of Washington
Có thể bạn quan tâm
vi is Found on Nearly Every Unix Computer
- vi is the standard Unix editor
- Other documents on vi:
- How To Use The vi Editor
- Vi Reference
- Mastering the VI editor - University of Hawaii at Manoa
- Vi Lovers Home Page
- Visual Editor (vi): A Tutorial - University of Southwestern Louisiana
vi is Powerful and Fast
- Your terminal displays a section of the file you are editing
- vi can do anything you want
- You don't need to remove your fingers from the standard typing keys-the keys themselves give commands to vi
vi Stays Out of Your Way
- vi has no menus
- vi commands are short
Open a file with vi. Type: vi myfile.txt
- If myfile.txt does not exist, a screen will appear with just a cursor at the top followed by tildes (~) in the first column.
- If myfile.txt does exist, the first few line of the file will appear.
- The status line at the bottom of your screen shows error messages and provides information and feedback, including the name of the file.
Command Mode
- Command mode is the mode you are in when you start (default mode)
- Command mode is the mode in which commands are given to move around in the file, to make changes, and to leave the file
- Commands are case sensitive: j not the same as J
- Most commands do not appear on the screen as you type them. Some commands will appear on the last line: : / ?
Insert (or Text) Mode
- The mode in which text is created. (You must press <Return> at the end of each line unless you've set wrap margin.)
- There is more than one way to get into insert mode but only one way to leave: return to command mode by pressing <Esc>
When in doubt about which mode you are in, press <Esc>
NOTE: Many vi commands can take a leading count (e. g., 6k, 7e).
Displaying Line Numbers
From Command Mode :set nu Display line numbers :set nonu Hide line numbersSetting Right Margin
From Command Mode :set wm=number Set Wrap Margin number of spaces from right edge of screen :set wm=10 Set Wrap Margin 10 spaces from right edge of screen :set wm=0 Turn off Wrap Margin- To exit you must be in command mode-press <Esc> if you are not in command mode
- You must press <Return> after commands that begin with a : (colon)
A Basic vi Session
- To enter vi, type: vi filename <Return>
- To enter insert mode, type: i
- Type in the text: This is easy.
- To leave insert mode and return to command mode, press: <Esc>
- In command mode, save changes and exit vi by typing: :wq <Return>
You are back at the Unix prompt.
Từ khóa » Vi In Linux Terminal
-
An Introduction To The Vi Editor | Enable Sysadmin - Red Hat
-
Hướng Dẫn Sử Dụng Cơ Bản Lệnh Vi Editor Trên Linux - VinaSupport
-
VI Editor With Commands In Linux/Unix Tutorial - Guru99
-
Tìm Hiểu Về ứng Dụng Vi Trong Linux
-
Basic Vi Commands - Colorado State University
-
A Beginner's Guide To Editing Text Files With Vi - How-To Geek
-
How To Use The VI Editor In Linux
-
Unix/Linux - The Vi Editor Tutorial - Tutorialspoint
-
Linux Vi Command Help And Examples - Computer Hope
-
How To: Vi / Vim Save And Quit The Editor Command - NixCraft
-
How To Save A File In Vi / Vim Text Editor - NixCraft
-
The Vi Editor
-
Basic Vi Commands
-
VI EDITOR BASICS IN LINUX / UNIX - YouTube