In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about what is the solution to the random indentation of the code format of vim from the online copy. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Sometimes when you copy and paste the code from the editor into vim, the format of the code is completely out of order. The reason for this is that vim turns on smartindent (Smart reduction) or autoindent (automatic alignment) mode. To maintain the format of the code, you can stop the above two modes before pasting, the command is:
Set nosmartindentset noautoindent
The above command is to type a colon (:) in vim's read mode, and then execute it separately. It's really troublesome to do so many things for a paste. However, there is an easier way to start paste mode with the command, that is:
Turn on set paste and close set nopaste or set paste!
Since the paste mode and the above smartindent and autoindent modes are mutually exclusive, and smartindent is indispensable, use one of the two commands above to turn off paste mode after pasting.
You can also quickly switch by binding custom shortcuts, such as adding subordinate configurations to .vimrc
Method 1:set pastetoggle= way 2::map: set paste:map: set nopaste
Note: mode 1 can be used in both read and edit modes, switching paste mode on and off; mode 2 is used in read mode, and pressing the corresponding shortcut key is equivalent to executing the command defined later.
After reading the above, do you have any further understanding of the solution to the code format indentation that vim copy down from the Internet? If you want to know more knowledge or related content, please follow the industry information channel, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.