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

Example of how vi and vim modify tab to 4 space methods

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Preface

This article mainly introduces the relevant contents about vi and vim changing tab to 4 spaces, which are shared for your reference and study. I won't say much below. Let's take a look at the detailed introduction.

The methods are as follows:

Configuration file location: / etc/virc and / etc/vimrc

If you want to add comments to the configuration file, you can't use #, use "

"add by school1024.comset ts=4set softtabstop=4set shiftwidth=4set expandtabset autoindentts is an acronym for tabstop. Set the width of TAB to 4 spaces. Softtabstop indicates that the length of indentation is retracted when you press the backspace key while editing mode, especially when using expandtab. Shiftwidth represents the length of each level of indentation, which is generally set to the same as softtabstop. Expandtab represents indentation with spaces, while noexpandtab uses tabs to represent an indentation. Autoindent indents automatically

You can swap spaces and TAB for previous files with the following command

Replace TAB with spaces

: set ts=4:set expandtab:%retab!

Replace the space with TAB

: set ts=4:set noexpandtab:%retab!

Add! Is used to deal with the TAB after non-white space characters, that is, all TAB, if you do not add!, only deal with the first line of the TAB.

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

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

Servers

Wechat

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

12
Report