[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

How to comment out multiple lines at once in vim

My name is Ito and I am an infrastructure engineer.
If you want to edit files on Linux, you probably use "Vim".

When editing a configuration file, you
may want to comment out multiple lines at once when commenting out unnecessary settings.

This time I would like to introduce the method.

Use rectangular selection mode

For operations on multiple lines, use "Short selection mode".

After opening the file with vim, enter the command below.

ctrl+v

Enter "Rectangle Visual Mode".
Select the line you want to comment out with your cursor.

I (shift + i)

"Insert mode".

Enter the character to comment out (such as "#")

Esc

Exit insert mode.

I summarized it in GIF.
uGl98JLL61

What do you think?
The comment out character has been inserted at the beginning!

Let's do our best to master Vim.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
3,402
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

The person who wrote this article

About the author