In VIM, how many edits and the mobile command MoveEditMoveh/I/j/kf/F are located in the same line? Search for the entire document gg/G move to the document start/end */# Search for wordzt (top) zb (buttom) under the current cursor) zz move the current row to the top/bottom/middle HM... in VIM, how many edits and the mobile command MoveEditMoveh/I/j/kf/F are located in the same line? Search for the entire do
Since 1970, VI and Vim have become one of the programmer's favorite text editors. 5 years ago, I wrote a question to ask myself "every programmer should know the 100 vim command" This is the previous article of the improved version, I hope you will like.Basis
: E filename openfilenamefor edition:w Save file:q Exit vim:q! Quit without saving:x Write file (if changes has been made) and Exit:sav filename save
Common basic commands in Linux-ls favoritesThese are frequently used and powerful commands in Linux, but although you may be using these commands every day, I believe you do not fully understand these commands. If so, then you will surely gain something after reading. Let's take a look at the LS command.
The LS command
case of the letter under the cursor
j------connects the current row to the previous line and deletes the resulting blank line
File Operations in VI:
zz------save changes to the current file and Exit VI
: wq-----saves changes to the current file and then exits VI (same as ZZ)
: w------save changes to the current file
: w!-----to save changes to the current file, if there is a file with the same name, rewrite him
: q------Exit VI. If there are unsaved changes, VI will issue a complaint and "refus
display(12) DOS and Linux break characters (file conversion)Dos2unix [-kn] file [NewFile]Unix2dos [-kn] file [NewFile]-K: Preserves the original mtime time format of the file-N: Preserves the original old file and outputs the converted content to the new file(13) Language encoding conversionIconv--list lists iconv supported language codesIconv-f Original code-t new code filename [-o new file]-f:from, followed by the original encoding format-t:to, followed by new encoding format-o file: Optional
In VIM, how many edits and the mobile command MoveEditMoveh/I/j/kf/F are located in the same line? Search for the entire document gg/G move to the document start/end */# search for the word zt (top) zb (buttom) under the current cursor) zz Move the current row to the top/bottom/middle h m l (high low middle) of the screen) move the cursor to the top/middle/Bottom of the screen ctrl + u/d ctrl + f/B forward/backward move half screen forward/backward mo
Vim is a very powerful text editor in Linux. Proficient in using vim editor can do more with less in making scripts and editing texts.
The vim editor has three modes:
Command mode
By default, when you use vim to edit text, you can directly enter the command mode. In the secondary mode, you can view the contents of
Advanced some of the editor, will contain the macro function, Vim is certainly not missing, the use of macros in Vim is very convenient: : QX starts recording macro and registers the result in register X Q Exit Record mode @x playing macro commands recorded in the X register To explain a little bit, when entering in normal mode: After QX, all your edits to the t
Method 2:Input in command line mode6,9 Co 12Copy the contents of lines 6th through 9th to the following line 12th.Method 3:Sometimes you don't want to struggle to see how many rows or large lines are copied, you can use labels insteadMove the cursor to the start line, enter the MAMove the cursor to the end line, enter MBMove the cursor to the pasted row, enter the MCThen: ' A, ' B Co ' c changes the co into m and cuts it.To delete multiple lines, you can use: 5, 9 deGG to top G to e
Tags: Linux common commandsExit Save: WqExit and force Save: wq!Force quit, do not save: q!Cursor moves to the last line of the file GCursor moves to the first line of the file GGMoves the cursor from the cursor position to the beginning of the current line ^ 0 homeMoves the cursor to the end of the current line from the cursor location $ endCancel the last action UDelete a line of DDDelete N Row ndd650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/15/578b5dcbe54ce8333568aab04025cd7f.p
Vim commands a lot, it is difficult to remember the whole, so combined with my usual practice, often to use the command has been marked with red body word. If there are any errors, please note.?three different statesCommand: Any input will be used as an edit command without appearing on the screen and any input will cause immediate reflectionInsert: Any input data is placed in the edit register, press ESC t
current and subsequent characters until you Press ESC.
Ncw or nCW: modify a specified number of charactersNCC: modifies a specified number of rows.
: R file reads the file content and inserts it into the current row.: Nr file reads the file content and inserts it after line nEsc back to command mode
X: Delete the current character
Dw: Delete the current word
DG: Delete the current row to the end of the file
Dd: Delete the current row.
Db: delete the word n before the cursor. md deletes n
Compilation Example: g++-o hello hello.cpp-std=c++11, where-std=c++11 represents support for c++111 new featuresCommand mode execution after ESC is pressedA after inserting a letterI insert the current cursor-------------------------------------------DD Delete When moving forwardYY copy when moving forward-------------------------------------------V SelectionD CutY copyP paste on top of current cursorP paste below the current cursorShift+p pasting before the current line-------------------------
1, when the VI is opened by default command mode, to enter the input mode, you need to press A or I key.Command mode:: Wq Save and exit: W only save does not eject: Q Do not save exit: q! Do not save forced exits: wq! Save and Force exit2 . FindIn command mode, enter/xxx, you can find the XXX3, Fast switch lineIn command mode, you can quickly switch to num lines by entering: num4, set the display line numberIn command mode, enter: Set Nu to display line numbersNote: Setting does not display line
Vim Common Commands Summary.-You can let us repeat the last Operation command y-Copy the command. It can be followed by a displacement, or an object selection. For example it's actually with C-The Cut command is very similar yaw-copy a word, including the preceding space Yiw-Copy a word that does not include the preceding space Y-copy a row of content y+k-copy cursor line followed by line t-Search command,
Vim Install yum install-y vimVim View basic information vim--versionVim Open and new file vim [filename]Vim operation after entering the fileNote: There are several modes of vim first1, shortcut key mode: Vim can only move the cur
Advanced some of the editor, will contain the macro function, Vim is certainly not missing, the use of macros in Vim is very convenient:: QX starts recording macro and registers the result in register XQ Exit Record mode@x playing macro commands recorded in the X registerTo explain a little bit, when entering in normal mode: After QX, all your edits to the text w
Advanced some of the editor, will contain the macro function, Vim is certainly not missing, the use of macros in Vim is very convenient:: QX starts recording macro and registers the result in register XQ Exit Record mode@x playing macro commands recorded in the X registerTo explain a little bit, when entering in normal mode: After QX, all your edits to the text w
Reference article: Http://www.oschina.net/news/43167/130-essential-vim-commands, some of which I thought need to be supplemented in a timely manner to supplement or modifySince 1970, VI and Vim have become one of the programmers ' favorite text editors. 5 years ago, I wrote a question called "100 vim
Reference: http://www.cnblogs.com/usergaojie/p/4583796.htmlVi:visual Interface Visual InterfaceVim:vi Improvedvi Enhanced VersionFull screen editor, modal editorVim mode:
Edit mode (Command mode)
Input mode
Last-line mode
Mode conversion:Edit--Input: I: In front of the character of the current cursor, switch to input mode; A: After the character of the current cursor, switch to input mode; O: At the bottom of the current cursor line, create a new row and switch to
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.