Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

7.2bash script options and combination condition testing

Shulou Source: shulou.com Published: 2022-06-03 06:20:06 10月02日 Update

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

Tags: File toggle content multiple up and down command file name horizontal arrow highlight advanced left and right bottom cursor size character mentor manual text mode Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Shulou Information MySQL Huawei