问题
I'd like to have some boilerplate info about license, author, etc. at the top of every new file I create, but I can't find the correct boxes to tick.
Basically, I want to create a new file, and have it already populated (at the top) with
'''
author: Me
license: something
copyright: something
'''
Is this even possible?
回答1:
Go to Windows -> Preferences -> PyDev -> Editor -> Templates
Create a new template:
- Fill the name with
<Empty>
- choose
Editor
- enable
Automatically insert
- Add a description (optionally)
- Copy your template in the pattern
- you might want to use some variables like
${year}
and${cursor}
at the end.
- you might want to use some variables like
To add your template on the file:
Just press Ctrl+Space
on an empty line or after a whitespace and select <Empty>
and it should add your template on your file.
Note:
You can create as many <Empty>
templates as you want, <Empty>
templates won't show up when you've called the code completion after entering some letters.
来源:https://stackoverflow.com/questions/14220295/how-do-i-make-a-file-template-for-pydev