diff --git a/.gitignore b/.gitignore index 428a817..a2a863f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ zsh/cache/ +vim/view/ diff --git a/codetemplates/django_project/.env b/codetemplates/django/basic/.env similarity index 100% rename from codetemplates/django_project/.env rename to codetemplates/django/basic/.env diff --git a/codetemplates/django_project/Makefile b/codetemplates/django/basic/Makefile similarity index 100% rename from codetemplates/django_project/Makefile rename to codetemplates/django/basic/Makefile diff --git a/codetemplates/django_project/Procfile b/codetemplates/django/basic/Procfile similarity index 100% rename from codetemplates/django_project/Procfile rename to codetemplates/django/basic/Procfile diff --git a/codetemplates/django_project/manage.py b/codetemplates/django/basic/manage.py similarity index 100% rename from codetemplates/django_project/manage.py rename to codetemplates/django/basic/manage.py diff --git a/codetemplates/django_project/project_name/__init__.py b/codetemplates/django/basic/project_name/__init__.py similarity index 100% rename from codetemplates/django_project/project_name/__init__.py rename to codetemplates/django/basic/project_name/__init__.py diff --git a/codetemplates/django_project/project_name/models.py b/codetemplates/django/basic/project_name/models.py similarity index 100% rename from codetemplates/django_project/project_name/models.py rename to codetemplates/django/basic/project_name/models.py diff --git a/codetemplates/django_project/project_name/tests.py b/codetemplates/django/basic/project_name/tests.py similarity index 100% rename from codetemplates/django_project/project_name/tests.py rename to codetemplates/django/basic/project_name/tests.py diff --git a/codetemplates/django_project/project_name/views.py b/codetemplates/django/basic/project_name/views.py similarity index 100% rename from codetemplates/django_project/project_name/views.py rename to codetemplates/django/basic/project_name/views.py diff --git a/codetemplates/django/basic/requirements.txt b/codetemplates/django/basic/requirements.txt new file mode 100644 index 0000000..482b7d3 --- /dev/null +++ b/codetemplates/django/basic/requirements.txt @@ -0,0 +1,3 @@ +Django==1.4.1 +dj-database-url==0.2.1 +virtualenv==1.7.2 diff --git a/codetemplates/django_project/settings.py b/codetemplates/django/basic/settings.py similarity index 100% rename from codetemplates/django_project/settings.py rename to codetemplates/django/basic/settings.py diff --git a/codetemplates/django_project/urls.py b/codetemplates/django/basic/urls.py similarity index 100% rename from codetemplates/django_project/urls.py rename to codetemplates/django/basic/urls.py diff --git a/codetemplates/django_project/codetemplates b/codetemplates/django_project/codetemplates deleted file mode 100644 index d712735..0000000 --- a/codetemplates/django_project/codetemplates +++ /dev/null @@ -1,3 +0,0 @@ -DATABASE_URL=sqlite://localhost/local.db -SECRET_KEY={{ secret_key }} -DEBUG=True diff --git a/setup.sh b/setup.sh index 5d0616b..6d97033 100755 --- a/setup.sh +++ b/setup.sh @@ -13,7 +13,7 @@ vimbundles=( \ command-t "https://github.com/wincent/Command-T.git" \ gundo "https://github.com/sjl/gundo.vim.git" \ repeat "https://github.com/tpope/vim-repeat" \ - snipmate "https://github.com/msanders/snipmate.vim.git" \ + snipmate "https://github.com/garbas/vim-snipmate.git" \ solarized "https://github.com/altercation/vim-colors-solarized.git" \ speeddating "https://github.com/tpope/vim-speeddating.git" \ surround "https://github.com/tpope/vim-surround.git" \ diff --git a/tmux.conf b/tmux.conf index ea7f260..6b440ce 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,4 +1,4 @@ -set-option -g prefix C-b +set-option -g prefix C-f set-option -g exit-unattached off set-option -g default-terminal "screen-256color" set-option -g set-titles off diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 602ac78..125477e 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -2,3 +2,6 @@ setlocal shiftwidth=2 setlocal softtabstop=2 setlocal listchars-=tab:▸\ +setlocal nowrap +setlocal tw=0 +setlocal colorcolumn=100 diff --git a/vim/after/ftplugin/htmldjango.html b/vim/after/ftplugin/htmldjango.vim similarity index 100% rename from vim/after/ftplugin/htmldjango.html rename to vim/after/ftplugin/htmldjango.vim diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim index e783518..bb2f799 100644 --- a/vim/after/ftplugin/python.vim +++ b/vim/after/ftplugin/python.vim @@ -1,6 +1,10 @@ +setlocal shiftwidth=4 +setlocal softtabstop=4 setlocal expandtab +setlocal textwidth=100 +setlocal colorcolumn=100 + "setlocal foldnestmax=3 "setlocal fdm=indent -setlocal textwidth=80 setlocal makeprg="pylint -f parseable %" diff --git a/zsh/func/makers/mkdjango b/zsh/func/makers/mkdjango new file mode 100644 index 0000000..5b6ce87 --- /dev/null +++ b/zsh/func/makers/mkdjango @@ -0,0 +1,51 @@ +#!/bin/zsh +# Create a Django project using a template in .dotfiles/codetemplates/django +# Eryn Wells + + +local funcname=$0 + + +_usage() { + print_info "Usage: $funcname template_name project_name [optional destination directory]" +} + +if [[ ${#@} -lt 2 ]]; then + print_error "Need moar arguments" 1>&2 + _usage + return -1 +fi + + +local tname=$1 +local tdir="$HOME/.codetemplates/django/$tname" +local pname=$2 +local dest=$3 + +if [[ ! -d "$tdir" ]]; then + print_error "Invalid template name: $tname" 1>&2 + return -2 +fi + + +print_info "Making Django project '$pname' with template '$tname'" +if [[ -n "$dest" && ! -d "$dest" ]]; then + print_info_sub "Destination directory given but does not exist; creating $dest" + mkdir -p "$dest" +fi + +# Determine what files might not be rendered by django-admin.py +local names=() +for f in `find "$tdir"`; do + # Pick up all dotfiles + if [[ -e "$f" && "`basename $f`" =~ "^\." ]]; then + names+=($f) + fi +done + +print_info_sub "Calling django-admin.py" +django-admin.py startproject --template="$tdir" --name=${(j.,.)names} $pname $dest +exitcode=$? + +unfunction _usage +return $exitcode diff --git a/zshrc b/zshrc index 1d2fedc..8fe4d89 100644 --- a/zshrc +++ b/zshrc @@ -201,14 +201,14 @@ done # ad nauseum) function up { if [[ -z $1 ]]; then - pushd .. + cd .. else local updir='' for (( i=0; $i < $1; i++ )) do updir="../$updir" done - pushd $updir + cd $updir fi }