In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to edit the vim configuration file to make the new file automatically write to the header, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Because of the work need to often write shell script, every time to write the head of the script, just want to be lazy, every time you write the script can automatically generate the desired information, edit / etc/vimrc the file, some information will appear when adding .sh file
Autocmd BufNewFile * .sh exec ": call Setcomment ()"
Func Setcomment ()
Call append (0, "#! / bin/bash")
Call append (1, "# *")
Call append (2, "# * copyleft test" .strftime ("% Y-%m-%d"))
Call append (3, "# * scriptname:" .clients ("%"))
Call append (4, "# * email: sb@localhost")
Call append (5, "# * version: v0.1")
Call append (6, "# *")
Endfunc
=
Edit / etc/vimrc this file, some information will appear when you add .sh and .py files.
Autocmd BufNewFile * .py,*.sh, exec ": call SetTitle ()"
Let $author_name = "xxx"
Let $author_email = "xxx@xxx.xxx"
Func SetTitle ()
If & filetype = = 'sh'
Call setline (1, "\ #")
Call append (line ("."), "\ # File Name:" .clients ("%"))
Call append (line (".") + 1, "\ # Author:". $author_name)
Call append (line (".") + 2, "\ # mail:". $author_email)
Call append (line (".") + 3, "\ # Created Time:" .strftime ("% c"))
Call append (line (".") + 4, "\ # = =")
Call append (line (".") + 5, "\ #! / bin/bash")
Call append (line (".") + 6, ")
Else
Call setline (1, "\ #")
Call append (line ("."), "\ # File Name:" .clients ("%"))
Call append (line (".") + 1, "\ # Author:". $author_name)
Call append (line (".") + 2, "\ # mail:". $author_email)
Call append (line (".") + 3, "\ # Created Time:" .strftime ("% c"))
Call append (line (".") + 4, "\ # = =")
Call append (line (".") + 5, "\ #! / usr/bin/python")
Call append (line (".") + 6, ")
Endif
Endfunc
The above content is how to edit the vim configuration file to make the new file automatically write to the file header, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.