An Emacs major mode for editing Template Toolkit files.
- Syntax highlighting for Template Toolkit directives (
[% ... %]) - Highlights TT keywords (
IF,FOREACH,INCLUDE,BLOCK, etc.) - Highlights variable names, constants, and comments within TT tags
- Automatically activates for files with a
.ttextension
tt-mode is available on MELPA. If you have
MELPA configured as a package source, you can install it with:
M-x package-install RET tt-mode RET
- Download
tt-mode.elfrom the GitHub repository. - Place it somewhere on your Emacs
load-path. - Add the following to your
.emacsorinit.el:
(autoload 'tt-mode "tt-mode")
(add-to-list 'auto-mode-alist '("\\.tt\\'" . tt-mode))Once installed, tt-mode will be activated automatically when you open a
file with a .tt extension. You can also activate it manually with:
M-x tt-mode
| Element | Face |
|---|---|
[% and %] delimiters |
font-lock-builtin-face |
| Content inside TT tags | font-lock-variable-name-face |
TT keywords (IF, FOREACH, etc.) |
font-lock-keyword-face |
| Simple variable expressions | font-lock-constant-face |
Comments ([%# ... %] and inline #) |
font-lock-comment-face |
This started as an afternoon of Emacs Lisp hacking in 2002. There are, no doubt, many improvements that can be made. Contributions are very welcome!
To contribute:
- Fork the GitHub repository
- Make your changes
- Submit a pull request
If you have suggestions but don't want to write code, please open an issue.
This code is made available under the GPL. Usual caveats apply.