the filename to the line following the cursorShell Command Command:! Shell command runs shell commands in vimMultiple file editing instructionsVim filename1 filename2 ... Open multiple files at the same time in vim: Files lists all open files: N View Next file: N View Previous fileMulti-window editing instructions: SP filename also opens multiple vim windows to
9.Vim editor the enhanced version of the Vi editor supports multiple language scripts, file type plugins, text completion modes, and many other options. Command mode: For file navigation, cut and paste both simple commands. Undo recovery and other operations, also in this modeInsert mode: For general text compilation, substitution mode is a variant of the insert pattern.Ex mode : used to save, exit, and ope
Basic commands
: E filename
Open filename for edition
: W
Save file
: Q
Exit Vim
: q!
Quit without saving
: X
Write file (if changes has been made) and exit
: Sav filename
Saves file as filename
.
Repeats the last change made in normal mode
5.
Repea
Three modes of vim editing artifact:
Command mode
Insert mode
Last-line mode
$vim name +number Jump directly to the number line of the fileCommand mode, insert mode i : Insert before current cursor I : .... at the beginning of A : Insert after current cursor A : ..... At the end of your line o : Insert next line O: Previous line InsertCommand -mode
There are a plethora of commands in vim, and learning on demand is the only way out. Here is a summary of several commonly used cursor jump commands.Basic movement:H (toward left) J (down) K (UP) L (Small letter L, toward right)Move between rows:Quick jump to end of file: g (capital letter G)Quick jump to the first line of file: 1G (the number 1 plus write letter g)Skip quality Specify nth row: NG (number n
1. Customizing command settings": Command option Custom command action": Define a command": command! ... ": Redefine a Command (modify)":d Elcommand custom Commands": Deleting custom commands* Note 1: Custom commands must start with "uppercase" letters2. Custom command Options-parameters1) Description of the number of parameters-nargs=0 No parameters-nargs=1 a pa
the contents of these can be completely deleted or in the beginning and end of the two lines with the MA,MB command marked with: ' A, ' bd delete. 4) add some strings to the beginning or end of a line in the entire file or lines vi :3, $s/^/some string/insert some string:%s/$/some string/g in the first line of the file until the beginning of the last line, add some string:%s/at the end of each line of the file String1/string2/g replaces string1 into string2:3,7s/string1/string2/in the entire fi
Delete 4 lines at the beginning of the line where the cursor is located
P
Paste at the next line of the cursor
Yy
Copy a row
d$
Delete the character after the cursor is the end of the line
Last-line mode :
Q
Exit
Q!
Force exit
W
Save
Wq
Save and exit
wq!
Force Save and exit
Set Nonu
Do not display the number of rows
The command to edit the file on Mac always can't remember, leave a reference!!!If it is vim, then: ESC exits edit mode and enters the following command:: Wq after saving exit VI, if: wq! After forcing the store to exit (common): W Save but do not exit (common): w! If the file property is read-only, the archive is forced to write: Q leave VI (common): q! If you have modified the file, do not want to store, use! Do not store files for forced departures.
When switching windows, vim Automatic command is Exvim use of the shift+ arrow keys can only press once, it is more useful"Map ctrl-tab to switch windowNnoremap Nnoremap Nnoremap Nnoremap Windows version Exvim full package management plug-in, if there is no network connection,The configuration file. This is what VIMRC wrote."Load. Vimrc.plugins . Vimrc.plugins.localif exists (' G:exvim_custom_path ')Let vimrc_plugins_path = G:exvim_custom_path. ' /.v
One, string lookup 1. Using/And in Vim to find a string, the difference is that /string highlights the first string that matches the cursor after the carriage return, and the cursor moves to the first letter of the string; ? string highlights the first match before the cursor A string that returns the first letter of the string after the cursor moves to it. After carriage return, press N to go to the next matching string in the same direction, and p
edit filename1: N Enter edit filename2Six, multi-window editingVim filename1 Edit filename1: SP filename2 Sub-window edit filename2CTRL+W+J switching between two windowsCtrl+w+k switching between two windows:d iffthis Comparison of two files: VSP Split window switches to horizontal modeVII. Archiving and exit: W writes the edited document to disk: w! Force Write file: Wq writes the document to disk and exits vim: Q Quit
Two: Edit modeEnter insert modeI insert the first non-empty Gerian inserted at the cursor at the same lineA cursor at the next character at the last character of the line where the cursor is locatedo The line next to the cursor is inserted into the new rowO Insert a new row on the previous lineEnter replacement modeR replaces the character of the cursor onceR until ESC is pressedExit edit mode[ESC]Three: command-line modeSave and leave: W Write Data: w! Force write: Q Leave VI: q! Leave not sav
One, ModeThere are 3 modes of the VI Editor:Command mode、Input Mode、last-line mode。 It is important to master these three models:Command mode: VI starts after the default entry is the command mode, from this mode use the command can switch to the other two modes, while in any mode just click [ESC] Key to return to command mode.Input mode: Enter subtitles in command mode"I"You can edit the file into the input mode of VI. In this mode we can edit, modify, input and other editing work, in the last
buttonndd: Deletes the N-line down the cursor, omitting n means deleting the current line of the cursornyy: Copy the N-line down the cursor, omitting n indicates the current row of the replication cursorp,p: p To paste the copied data on the next line of the cursor, p instead, paste the copied data on the previous line of the cursoru: revert undo previous actionctrl+r: Redo Last Action. : A decimal point, which means repeating the previous commandcommand line set line number: Set nu: Display li
lineSearch command:Search for a specified stringIgnore case when searching: Set ICn searches for the next occurrence of the specified string:%s/old/new/g full text Replace specified string: N1,n2s/old/new/g replaces specified string within a certain rangeReplace and Cancel commands:R replaces the character at which the cursor is locatedR replaces the character at the beginning of the cursor and presses ESC to endU Cancel the previous actionSave and Exit Com
1,move command
: M 13
Move the line where the current cursor is located after 13 rows
: M 0
Drop the line where the current cursor is located before the first line
: M $
Drop the line where the current label is located after the last row
: 5,7 m 15
Move line 5,6,7 after line 15
: 5,7 m 0
Move line 5,6,7 to the front of the first line
: 5,7 M $
Move Line 5,6,7 after the last l
Introduction to VimVim (vimsual) is a universal full-screen editor in the Linux/unix series OS.Vim is divided into two states, the command state and the editing state, in the command state, the character system typed as a command, such as: Q for Exit, and the editing state is used to edit the text data. When you enter vim, the command state is entered first. In the command state, press "I" (insert) or "a" (add) can enter the editing state, in the edit
are much like forward and backward on the browser.M{A-Z} marks the location of the cursor, the local tag, only for the current file.M{A-Z} marks the location where the cursor is located, all marked. Reboot, the tag is still valid.' {A-Z} moves to the location of the tag.' {A-Z} moves to the beginning of the marker."Move to the last edited place. "Yes, but ' more finely cut. If you want to jump to an older location, you can press C-o and jump to the new location with C-i.' Move to the last place
Ctrl + F scroll down one screenCtrl + B scrolls up one screen/text find text, press N to find the next, press N to find the previous one.? text find text, reverse lookup, press N to find the next, press N to find the previous0 (number 0) move to the first character of the bank$ move to end of line 3$ move to line end below 3 linesGG moves to the file header.G (SHIFT + g) Move to end of fileX Delete Current characterDD Delete When moving forward10DD Delete 10 rows from the beginning of the curren
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.