Linux 4 Vim

Source: Internet
Author: User
Www.vim.org command: Set nu to use VI more quickly, we need to master several sets of commands {#1, [INSERT command] A, A, I, I, O, O #2, [positioning command] H, J, K, L, $, 0, H, M, L: Set nu to set the row number: setnonu cancel the number Gg to the first line G to the last line ng to the N line: N to the N line #3, [DELETE command] X, NX, DD, NDD, DG [Delete the cursor to the end of the file], D,: N1, n2d [Delete the row in the specified range] #4, [copy and cut command] YY, y copy the current row nyy, NY copies n rows of the current row dd [CUT], NDD [CUT n rows], p, p [paste in the row where the current cursor is located or on the line] #5, [Replace and cancel command] Replace r with the character where the cursor is located. Replace r with the character from where the cursor is located, and Press ESC to end u to cancel the previous operation #6, [search and replace command]/string by N is the next From front to back, N from back to front: % S/old/new/g Replace the specified string: N1, N2s/old/new/g in a certain range!: N1, N2s/old/new/C ask and replace: It is case insensitive when searching for set IC!: Set noic #7, [Save and exit command] [ZZ most common] W filename save as specified file: WQ! Force save and exit. Only the file owner or administrator root can do this. #8. [another interesting command in VI]: R! Command import command execution result to current VI Execute Command in VI :! Command definition shortcut key: Map shortcut key trigger command example: Map ^ p I # <ESC> ^ P = Ctrl + V + P: Map ^ B 0x continuous line comment: N1, n2s/^/#/g consecutive rows plus # Note: remove the # At the beginning of N2s/^ # // G! ^ Indicates the beginning of a row: N1, N2s/^/\/g Add/:/# // G at 4 ~ 8 lines, replace # With null, is to remove # Replace: AB sammail samlee@lampbrother.net automatic change, very good! Insert a-> B [change to B]: unab sammail samlee@lampbrother.net #9, VI configuration file ~ /. Vimrc ~ Home Directory root/root zhangsan/home/zhangsan #10. Li Ming believes that VI is easier to use when modifying the configuration file and writing shell scripts! Other options are not required! He tends to use graphical interfaces!

}

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.