Created
September 4, 2009 06:13
-
-
Save asenchi/180762 to your computer and use it in GitHub Desktop.
Vim abbreviations for Django template tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Inspired by: http://www.codekoala.com/blog/2009/even-more-new-vim-fun/ | |
" In order to be not pollute the namespace, I've added a dj for | |
" all django snippets. Here's the list so far: | |
" content blocks | |
" usage: content djbl<space> | |
ab djbl <Esc>bi{% block <Esc>ea %}{% endblock %}<Esc>h%i | |
" cycle | |
" usage: variable djcy<space>a | |
ab djcy <Esc>bi{% cycle '' '' as <Esc>ea %}<Esc>h%2w | |
" firstof | |
ab djfo <Esc>i{% firstof %}<Esc>3ha | |
" filter | |
ab djfi <Esc>i{% filter %}<CR>{% endfilter %}<Esc>kh%2Ea | |
" ifchanged | |
ab djifchg <Esc>i{% ifchanged %}{% endifchanged %}<Esc>h%i | |
" ifequal | |
ab djifeql <Esc>i{% ifequal %}{% endifequal %}<Esc>h2%2Ea | |
" ifnotequal | |
ab djifneql <Esc>i{% ifnotequal %}{% endifnotequal %}<Esc>h2%2Ea | |
" include | |
" usage: "testing.html" djinc | |
ab djinc <Esc>^i{% include <Esc>$a %}<Esc> | |
" extends | |
ab djext <Esc>^i{% extends <Esc>$a %}<Esc> | |
" spaceless | |
ab djspaceless <Esc>i{% spaceless %}<CR>{% endspaceless %}<Esc>h%i | |
" ssi | |
ab djssi <Esc>i{% ssi %}<Esc>2hi | |
" url | |
ab djurl <Esc>i{% url %}<Esc>2hi | |
" load | |
ab djload <Esc>i{% load %}<Esc>2hi | |
" Will comment more when I get the time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment