function InsertPythonHeader() let l1 = getline(1) let l2 = getline(2) if match('\#!/', l1) == 0 exec 1 normal O call setline(1,'#!/usr/bin/env python') endif if match("\#", l2) == 0 && (match("-", l2) != 2 ¦¦ (match("code", l2) != 2)) exec 2 normal O call setline(2,'#-*- coding:utf-8 -*-') endif endfunction au FileType python call InsertPythonHeader() #//python/5324