Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

7.2bash script options and combination condition testing

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

7.2

Use vim to edit multiple files

Vim FILE1 FILE2 FILE3

: next switches to the next file

Prev switches to the previous file

Last switches to the last file

First switches to the first file

Quit

Qa exits all

17. Display a file on a split screen

Ctrl+w,s: horizontal split window Ctrl+w, up and down arrow

Ctrl+w,v: split window vertically

Toggle the cursor between windows:

Ctrl+w,ARROW (up, down, left and right arrow)

Qa closes all windows

18. Display multiple files in separate windows

Vim-o horizontal delimited display of multiple files

-O vertically separated display

Save part of the current file as another file

Use the w command in the last line mode

W save as current file

: ADDR1,ADDR2w / path/to/somewhere

Twenty, populate the contents of another file in the current file

: r / path/to/somefile

21, interact with shell

:! COMMAND

Enter the command, enter, read, enter, and return to vim

22, advanced topics

1 display or cancel the display of line numbers

: set number

: set nu

: set nonu

2 shows that characters are ignored or case-sensitive

: set ignorecase

: set ic

: set noignorecase

3 set automatic indentation

Set autoindent

: set ai

: set noai

4. Highlight or cancel the found text

Set hlsearch

Set nohlsearch

5 syntax highlighting

Syntax on

Syntax off

23, configuration file

/ etc/vimrc

~ / .vimrc

Set up ~ / .vimrc under your own home directory

There is one under root.

Vimtutor vim instructor

If vim exits with abnormal operation, there will be .swp with abnormal exit file name.

Vim-r inittab restore, manually delete .swp

Rm-f file name. Swp

Exercise: change the

Replace ftp://instructor.example.com/pub with

Http://172.16.0.1/yum

% s/ftp:\ /\ / instructor\ .example\ .com\ / pub/http:\ / / 172.16\ .0\ .1\ / yum/gi

% s @ ftp://instructor\.example\.com/pub@http://172.16.0.1/yum@g

The contents of the document are as follows:

# repos on instructor for cla***oom use

# Main rhel5 server

[base]

Name=Instructor VT Repository

Baseurl= ftp://172.16.0.1/pub/Server

Gpgcheck=0

# The one is needed for xen packages

[VT]

Name=Instructor VT Repository

Baseurl= ftp://172.16.0.1/pub/VT

Gpgcheck=0

# This one is needed for clustering packages

[Cluster]

Name=Instructor Cluster Repository

Baseurl= ftp://172.16.0.1/pub/Cluster

Gpgcheck=0

# This one is needed for cluster storage (GFS,iSCSI target,etc...) Packages

[ClusterStorage]

Name=Instructor ClusterStorage Repository

Baseurl= ftp://172.16.0.1/pub/ClusterStorage

Gpgcheck=0

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report