Skip to content

Instantly share code, notes, and snippets.

@aliev
Last active September 10, 2015 16:51
Show Gist options
  • Save aliev/0accb875ea7cd05aaf98 to your computer and use it in GitHub Desktop.
Save aliev/0accb875ea7cd05aaf98 to your computer and use it in GitHub Desktop.
Django project specific options for Vim
"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