Last active
September 10, 2015 16:51
-
-
Save aliev/0accb875ea7cd05aaf98 to your computer and use it in GitHub Desktop.
Django project specific options for Vim
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
"let g:django_settings_module=".settings." | |
let $PYTHONPATH="" | |
if !exists("g:django_settings_module") | |
let $DJANGO_SETTINGS_MODULE = printf("%s.settings", split(getcwd(), '/')[-1:][0]) | |
else | |
let $DJANGO_SETTINGS_MODULE = g:django_settings_module | |
endif | |
fu! DjangoRun(args) | |
:VimuxInterruptRunner | |
:VimuxRunCommand "export DJANGO_SETTINGS_MODULE=" . $DJANGO_SETTINGS_MODULE | |
:VimuxRunCommand "export PYTHONPATH=" . $PYTHONPATH | |
if a:args == "shell" | |
:VimuxInspectRunner | |
endif | |
:VimuxRunCommand $VIRTUAL_ENV . "/bin/django-admin " . a:args | |
endfu | |
command! -nargs=1 Django :call DjangoRun(<f-args>) | |
if has("autocmd") | |
au FileType htmldjango set omnifunc=htmldjangocomplete#CompleteDjango | |
endif | |
" vim:ts=2:sw=2:ft=vim: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment