Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gebner/oh-my-zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed Jul 28, 2011
2 parents ae1cbd9 + dee8171 commit 85d2a6f
Show file tree
Hide file tree
Showing 25 changed files with 1,288 additions and 114 deletions.
1 change: 0 additions & 1 deletion lib/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ alias sl=ls # often screw this up

alias afind='ack-grep -il'

alias x=extract
35 changes: 0 additions & 35 deletions lib/functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,3 @@ function take() {
cd $1
}

function extract() {
unset REMOVE_ARCHIVE

if test "$1" = "-r"; then
REMOVE=1
shift
fi
if [[ -f $1 ]]; then
case $1 in
*.tar.bz2) tar xvjf $1;;
*.tar.gz) tar xvzf $1;;
*.tar.xz) tar xvJf $1;;
*.tar.lzma) tar --lzma -xvf $1;;
*.bz2) bunzip $1;;
*.rar) unrar x $1;;
*.gz) gunzip $1;;
*.tar) tar xvf $1;;
*.tbz2) tar xvjf $1;;
*.tgz) tar xvzf $1;;
*.zip) unzip $1;;
*.Z) uncompress $1;;
*.7z) 7z x $1;;
*) echo "'$1' cannot be extracted via >extract<";;
esac

if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
echo removing "$1";
/bin/rm "$1";
fi

else
echo "'$1' is not a valid file"
fi
}

1 change: 1 addition & 0 deletions lib/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bindkey ' ' magic-space # also do history expansion on space
bindkey '^[[Z' reverse-menu-complete

# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey '^?' backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
Expand Down
2 changes: 1 addition & 1 deletion lib/misc.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ setopt long_list_jobs

## pager
export PAGER=less
export LC_CTYPE=en_US.UTF-8
export LC_CTYPE=$LANG
8 changes: 8 additions & 0 deletions lib/spectrum.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done

# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
print -P -- "$code: %F{$code}Test%f"
done
}

42 changes: 25 additions & 17 deletions plugins/archlinux/archlinux.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
# Archlinux zsh aliases and functions for zsh

# Aliases ###################################################################
# Archlinux zsh aliases and functions
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

# Look for yaourt, and add some useful functions if we have it.
if [[ -x `which yaourt` ]]; then
upgrade () {
yaourt -Syu -C
yaourt -Syu
}
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
alias yain='sudo yaourt -S' # Install specific package(s) from the repositories
alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file
alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias yarem='sudo yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias yarep='yaourt -Si' # Display information about a given package in the repositories
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
alias yain='yaourt -S' # Install specific package(s) from the repositories
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias yarep='yaourt -Si' # Display information about a given package in the repositories
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
# Additional yaourt alias examples
alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package
alias yamir='sudo yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
if [[ -x `which abs` ]]; then
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
else
alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
fi
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
else
upgrade() {
sudo pacman -Syu
Expand All @@ -38,7 +42,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
alias pacloc='pacman -Qi' # Display information about a given package in the local database
alias paclocs='pacman -Qs' # Search for package(s) in the local database
# Additional pacman alias examples
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
if [[ -x `which abs` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
else
alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
fi
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist

Expand Down
1 change: 1 addition & 0 deletions plugins/bundler/bundler.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ alias be="bundle exec"
alias bi="bundle install"
alias bl="bundle list"
alias bu="bundle update"
alias bp="bundle package"

# The following is based on https://github.com/gma/bundler-exec

Expand Down
222 changes: 222 additions & 0 deletions plugins/django/django.plugin.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
#compdef manage.py

typeset -ga nul_args
nul_args=(
'--settings=-[the Python path to a settings module.]:file:_files'
'--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
'--traceback[print traceback on exception.]'
"--version[show program's version number and exit.]"
{-h,--help}'[show this help message and exit.]'
)

_managepy-adminindex(){
_arguments -s : \
$nul_args \
'*::directory:_directories' && ret=0
}

_managepy-createcachetable(){
_arguments -s : \
$nul_args && ret=0
}

_managepy-dbshell(){
_arguments -s : \
$nul_args && ret=0
}

_managepy-diffsettings(){
_arguments -s : \
$nul_args && ret=0
}

_managepy-dumpdata(){
_arguments -s : \
'--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
'--indent=-[specifies the indent level to use when pretty-printing output.]:' \
$nul_args \
'*::appname:_applist' && ret=0
}

_managepy-flush(){
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
$nul_args && ret=0
}

_managepy-help(){
_arguments -s : \
'*:command:_managepy_cmds' \
$nul_args && ret=0
}

_managepy_cmds(){
local line
local -a cmd
_call_program help-command ./manage.py help \
|& sed -n '/^ /s/[(), ]/ /gp' \
| while read -A line; do cmd=($line $cmd) done
_describe -t managepy-command 'manage.py command' cmd
}

_managepy-inspectdb(){
_arguments -s : \
$nul_args && ret=0
}

_managepy-loaddata(){
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'*::file:_files' \
$nul_args && ret=0
}

_managepy-reset(){
_arguments -s : \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
'*::appname:_applist' \
$nul_args && ret=0
}

_managepy-runfcgi(){
local state

local fcgi_opts
fcgi_opts=(
'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
'host[hostname to listen on..]:'
'port[port to listen on.]:'
'socket[UNIX socket to listen on.]::file:_files'
'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
'maxspare[max number of spare processes / threads.]:'
'minspare[min number of spare processes / threads.]:'
'maxchildren[hard limit number of processes / threads.]:'
'daemonize[whether to detach from terminal.]:boolean:(False True)'
'pidfile[write the spawned process-id to this file.]:file:_files'
'workdir[change to this directory when daemonizing.]:directory:_files'
'outlog[write stdout to this file.]:file:_files'
'errlog[write stderr to this file.]:file:_files'
)

_arguments -s : \
$nul_args \
'*: :_values "FCGI Setting" $fcgi_opts' && ret=0
}

_managepy-runserver(){
_arguments -s : \
'--noreload[tells Django to NOT use the auto-reloader.]' \
'--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \
$nul_args && ret=0
}

_managepy-shell(){
_arguments -s : \
'--plain[tells Django to use plain Python, not IPython.]' \
$nul_args && ret=0
}

_managepy-sql(){}
_managepy-sqlall(){}
_managepy-sqlclear(){}
_managepy-sqlcustom(){}
_managepy-sqlflush(){}
_managepy-sqlindexes(){}
_managepy-sqlinitialdata(){}
_managepy-sqlreset(){}
_managepy-sqlsequencereset(){}
_managepy-startapp(){}

_managepy-syncdb() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
$nul_args && ret=0
}

_managepy-test() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
'*::appname:_applist' \
$nul_args && ret=0
}

_managepy-testserver() {
_arguments -s : \
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
'--addrport=-[port number or ipaddr:port to run the server on.]' \
'*::fixture:_files' \
$nul_args && ret=0
}

_managepy-validate() {
_arguments -s : \
$nul_args && ret=0
}

_managepy-commands() {
local -a commands

commands=(
'adminindex:prints the admin-index template snippet for the given app name(s).'
'createcachetable:creates the table needed to use the SQL cache backend.'
'dbshell:runs the command-line client for the current DATABASE_ENGINE.'
"diffsettings:displays differences between the current settings.py and Django's default settings."
'dumpdata:Output the contents of the database as a fixture of the given format.'
'flush:Executes ``sqlflush`` on the current database.'
'help:manage.py help.'
'inspectdb:Introspects the database tables in the given database and outputs a Django model module.'
'loaddata:Installs the named fixture(s) in the database.'
'reset:Executes ``sqlreset`` for the given app(s) in the current database.'
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
'runserver:Starts a lightweight Web server for development.'
'shell:Runs a Python interactive interpreter.'
'sql:Prints the CREATE TABLE SQL statements for the given app name(s).'
'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).'
'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.'
'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).'
"sqlinitialdata:RENAMED: see 'sqlcustom'"
'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).'
'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
"startapp:Creates a Django app directory structure for the given app name in this project's directory."
"syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.'
'testserver:Runs a development server with data from the given fixture(s).'
'validate:Validates all installed models.'
)

_describe -t commands 'manage.py command' commands && ret=0
}

_applist() {
local line
local -a apps
_call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\
bn=op.basename(op.abspath(op.curdir));[sys\\
.stdout.write(str(re.sub(r'^%s\.(.*?)$' %
bn, r'\1', i)) + '\n') for i in django.conf.settings.\\
INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \
| while read -A line; do apps=($line $apps) done
_values 'Application' $apps && ret=0
}

_managepy() {
local curcontext=$curcontext ret=1

if ((CURRENT == 2)); then
_managepy-commands
else
shift words
(( CURRENT -- ))
curcontext="${curcontext%:*:*}:managepy-$words[1]:"
_call_function ret _managepy-$words[1]
fi
}

compdef _managepy manage.py
compdef _managepy django
8 changes: 8 additions & 0 deletions plugins/extract/_extract
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#compdef extract
#autoload

_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0


Loading

0 comments on commit 85d2a6f

Please sign in to comment.