The use and practice of Day17-vim (II.)

Source: Internet
Author: User

Edit mode for 5.5:vim:

Edit mode: (enter the following command into edit mode): You can edit the contents of the file:

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/08/b01374da517f171ab6363e90608fab99.png-wh_500x0-wm_3 -wmp_4-s_2416377663.png "title=" Vim4.png "alt=" B01374da517f171ab6363e90608fab99.png-wh_ "style=" padding:0px; Margin:0px;vertical-align:top;border:none; "/>

Command mode: (Press ESC to enter command mode),

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/08/7a1958a9ea87bd06120382c0d47b53e4.png-wh_500x0-wm_3 -wmp_4-s_277456583.png "title=" Vim5.png "alt=" 7a1958a9ea87bd06120382c0d47b53e4.png-wh_ "style=" Padding:0px;margin : 0px;vertical-align:top;border:none; "/>

Supplemental Command: in command mode

: Hi: Highlights are displayed:

: Nohi: The highlight is not displayed:

"X": Save exit, and Wq the difference is that when entering a file is not edited, the use of this command does not change the file's atime.

Command mode Replace command: We replace the size letter A with a lowercase letter a

[Email protected] ~]# cat 1.txt #输入文件的内容

Aaaaaaaaaaaaa

Aaaabbbbbbcc

Dddaacccacc

[Email protected] ~]# vim 1.txt

: 1, $s/a/a/g #用vim进入后 and then replaced with this command, the output is as follows:

[Email protected] ~]# cat 1.txt

Aaaaaaaaaaaaa

Aaaabbbbbbcc

Dddaacccacc

There are three alternative formats, depending on the situation:

[Email protected] Text original content @ Replace content @g

s# text original content # replace content #g

s/text original content/replace content/g

Vim's Practice:

Responsible for/etc/passwd to the desktop:

#cp/etc/passwd./1.txt

Move up or down 10 characters to the left and right:

10k 10j 10h 10l

Move the cursor to line 49:49G

Move to the last line of text:

G

Move to the first line of text:

Gg

Number of root occurrences in the search file:

/root Press N to select the next:

Restore previous action: U

Replace the root of the entire file with Toor.

1, $s/root/root/g










This article is from the "_de blog" blog, be sure to keep this source http://yuanhaohao.blog.51cto.com/7714752/1980140

The use and practice of Day17-vim (II.)

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.