记录一下
- map <F11> :! python -i % <CR>
- map <F4> ms:call TitleDet()<cr>'s
-
- function AddTitle()
- call append(0,"#!/usr/bin/env python")
- call append(1,"# coding=utf8")
- call append(2,"# Filename: ".expand("%:t"))
- call append(3,"# Last modified: ".strftime("%Y-%m-%d %H:%M"))
- call append(4,"# Author: itnihao")
- call append(5,"# Mail: itnihao@qq.com")
- call append(6,"# Description: ")
- call append(7,"")
- echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
- endf
-
- function TitleDet()
- let n=1
- "默认为添加
- while n < 10
- let line = getline(n)
- if line =~ '^\#\s*\S*Last\smodified:\S*.*$'
- call UpdateTitle()
- return
- endif
- let n = n + 1
- endwhile
- call AddTitle()
- endfunction
本文转自it你好 51CTO博客,原文链接:http://blog.51cto.com/itnihao/1179311,如需转载请自行联系原作者