VIM: File Editor Command Line On Linux - Dai Pho Web & Hosting
Có thể bạn quan tâm
VIM is a free text editor, open-source in Unix-like/Linux command line. The main purpose of an editor is to create, add, or modify text for a file.
Open file
Syntax
vi [tùy_chọn] [filename]Adding, Changing, and Deleting Text
Note: You cannot go back more than one step.
The following commands allow you to insert and add text. Each of these commands puts the vi editor into insert mode; thus, the <Esc> key must be pressed to terminate the entry of text and to put the vi editor back into command mode.

| * | i | insert text before cursor, until <Esc> hit |
|---|---|---|
| I | insert text at beginning of current line, until <Esc> hit | |
| * | a | append text after cursor, until <Esc> hit |
| A | append text to end of current line, until <Esc> hit | |
| * | o | open and put text in a new line below current line, until <Esc> hit |
| * | O | open and put text in a new line above current line, until <Esc> hit |
Saving Files
Usually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file.
Note: The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the <Return> (or <Enter>) key.

| * | :x | quit vi, writing out modified file to file named in original invocation |
|---|---|---|
| :wq | quit vi, writing out modified file to file named in original invocation | |
| :q | quit (or exit) vi | |
| * | :q! | quit vi even though latest changes have not been saved for this vi call |
Searching Text
A common occurrence in text editing is to replace one word or phase by another. To locate instances of particular sets of characters (or strings), use the following commands. 
| /string | search forward for occurrence of string in text |
|---|---|
| ?string | search backward for occurrence of string in text |
| n | move to next occurrence of search string |
| N | move to next occurrence of search string in opposite direction |
Từ khóa » Câu Lệnh Vim Trong Linux
-
Moving File
-
Cơ Bản Về Vim Cho Người Mới Bắt đầu - Viblo
-
Cách Sử Dụng Trình Biên Soạn Vim
-
Cách Sử Dụng Vim Trong Linux? Lệnh Vim Trong Linux? - Blog KDATA
-
Làm Quen VIM Trong 5 Phút - Kipalog
-
Dùng Vim Cơ Bản Tới Nâng Cao - ItplusX
-
Soạn Thảo File Trong Linux Với Vim Và Nano
-
Hướng Dẫn Sử Dụng VI - Trung Tâm Hỗ Trợ Kỹ Thuật | MATBAO.NET
-
Các Lệnh Linux Cơ Bản (Phần 8 – Vim) - Chia Sẻ Tech
-
Hiển Thị Số Dòng Trong Vi / Vim Linux - Học VPS
-
[Vim Cơ Bản] Bài 2. Di Chuyển Con Trỏ Trong Vim | TechHay Blog
-
Cách Sử Dụng Vim để Chỉnh Sửa Nâng Cao Văn Bản Thuần Túy Hoặc ...
-
Một Số Thủ Thuật Sử Dụng VIM Editor - VinaHost
-
Hướng Dẫn Cài Đặt Vim - Editor Thần Thánh (P1) - CodeLearn