How do I make a file template for PyDev?

时光怂恿深爱的人放手 提交于 2019-12-09 18:55:04

问题


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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!