Define macros for scaffolding Python scripts
(fset 'py-script-scaffold "\C-[<#! /sr\C-?\C-?usr/bin/env python\C-j# -*- coding: utf-8 -:-\C-b\C-b\C-d*\C-e\C-jimport\C-a\C-k\"\"\"\C-j\C-e\C-j\C-jimport sys\C-jimport argparse\C-j\C-j\C-jdef main(argv=sys.argv[1\C-e\C-b\C-b\C-b\C-f:\C-e:\C-mparser = argparse.ArgumentParser(\C-e\C-j\C-iargs = parser.parse_args(argv\C-e\C-j\C-j\C-j\C-aif __name__ == ''\C-b\C-d\C-d__main__\C-e:\C-[b\C-[f\C-f\C-k:\C-mj\C-?main(\C-e\C-j")
Assign to F12 key
(define-key global-map [f12] 'py-script-scaffold)
Recommended Posts