Set TabStop=4set Numberset cul set CUC hi cursorcolumn ctermfg=3 ctermbg=2function insertpythoncomment () exe'Normal'.1.'G' Let Line= Getline ('.') ifLine =~'^#!. *$'|| Line =~'^#.*coding:.*$' returnendif normal O call Setline ('.','#!/usr/bin/env python') Normal o call Setline ('.','#-*-Coding:utf-8-*-') Normal o call Setline ('.',' ') Normal o call Setline ('.','# Author:'. G:python_author) Normal o call Setline ('.','# e-mail:'. G:python_email) Normal o call Setline ('.','# Date:'. Strftime ("%y/%m/%d%h:%m:%s")) Normal o call Setline ('.','# Desc:') Normal o call Setline ('.',' ') Normal o call cursor (7, 17) endfunctionfunction Insertcommentwhenopen ()ifA:lastline = = 1 &&!getline ('.') call Insertpythoncomment () end Endfuncau FileType python:%Call Insertcommentwhenopen () au FileType python map<F4>: Call Insertpythoncomment () <cr>Let g:python_author='Zhibo.wang'Let g:python_email='[email protected]'
Vim. VIMRC