Document Templates: Speed up creation of new files

Not sure a lot of people know about this feature, but it's possible to create templates for documents that you're often creating.

For instance I have a prototype "Python Program File" py_run.py with the following code:

#! /usr/bin/env python

import os, sys, pickle, random, glob, gzip
import argparse as ap



if __name__ == '__main__':

    p = ap.ArgumentParser()

    args = p.parse_args()

The idea is to store the models of files into the Template directory that resides in your home folder, and it then becomes available as an option from the right click context menu in caja "Create Document" listing.

This is really handy for me because if I set the mode executable on the file inside the ~/Template folder, then the new file created will inherit the executable mode (as well as, of course, all the code inside)

Note: the directory is localized so if you've installed Ubuntu MATE in French locale for instance it will be named "~/Modèles".

6 Likes

I didn't catch the relation of the Templates directory and the right click until I read your post.
Very useful, thank you!
now I understand why on the right click my templates appear when I put some templates in this directory

I will add, you can even organize your templates with sub-directories which make the right click less messy when you have a long list like the screenshot below shows it, which is easier to access to "Empty File"

2 Likes