Reference Address: Https://github.com/ma6174/vim
VIM&NBSP;/ETC/VIMRC " Below is the Add F4 hotkey to automatically add the file header note Information Map <f4> ms:call addauthor () <cr> ' Sfunction addauthor () let n=1 while n < 11 let line = getline (n) if line=~ ' [#]*\s*\*\s*\s*last\s*modified\s*:\s*\s*.*$ ' call updatetitle () return endif let n = n + 1 endwhile if &filetype == ' sh ' call addtitleforshell () elseif &filetype == ' Python ' call addtitleforpython () else &NBSP;&NBSP;&NBSP;&NBSP;CALL&NBSP;ADDTITLEFORC () endifendfunction "" add Comment for pythonfunction addtitleforpython () call append (0, "#!/ Usr/bin/env python ") call append (1," #coding: Utf-8 ") Call append (2, "") call append (3, "# ************************************* ") call append (4," # * author : fujinzhou ") call append (5," # * Email : [email protected] ") call append (6, "# * create time : ". Strftime ("%Y-%m-%d %H: %M ")) call append (7," # * last modified : ". Strftime ("%Y-% M-%d %h:%m ")) call append (8, "# * filename : ". Expand ("%:t ")) call append (9," # * description : ") call append ("# **********************************************************") echohl WarningMsg | echo "Successful in adding the copyright. " | echohl noneendfunction "" add conment for shellfunction Addtitleforshell () call append (0, "#!/bin/bash") call Append (1, "# **********************************************************") call append (2, "# * author : fujinzhou") call append (3, "# * email : [email proTected] call append (4, "# * create time : "). Strftime ("%y-%m-%d %h:%m")) call append (5, "# * last modified : ". Strftime ("%y-%m-%d %h:%m ")) call append (6," # * filename : ". Expand ("%:t ")) call append (7, "# * description : ") call append (8, "# ****** ") endfunction
This article from "Do not abandon!" Do not give up "blog, be sure to keep this source http://thedream.blog.51cto.com/6427769/1873060
VIM Personalization---Add comment header information to the script file