1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 17:28:01 +00:00

Importing initial files after reorganizing stuff.

This commit is contained in:
Robby Russell 2009-08-28 11:14:17 -07:00
parent e20401e04e
commit 5da20b9ddd
12 changed files with 259 additions and 0 deletions

8
README.textile Normal file
View File

@ -0,0 +1,8 @@
h2. Setup
# Clone the repository to ~/zsh
# Symlink the zsh config with: @ln -s ~/zsh/zshrc .zshrc@
# Reload zsh (open a new terminal)

44
aliases.zsh Normal file
View File

@ -0,0 +1,44 @@
alias c='cd'
alias pu='pushd'
alias po='popd'
alias sc='ruby script/console'
alias ss='ruby script/server'
alias mr='mate CHANGELOG app config db lib public script spec test'
alias .='pwd'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
alias _='sudo'
alias ss='setsid'
alias g='grep -in'
alias s='svn'
alias e='mate'
alias history='fc -l 1'
# Git aliases
alias utb='tar jxvf'
alias utz='tar zxvf'
alias ls='ls -GF'
alias ll='ls -al'
alias sgem='sudo gem'
alias rfind='find . -name *.rb | xargs grep -n'
alias xenon='ssh rrussell@xenon.planetargon.com'
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey -s '\e.' "..\n"

4
colors.zsh Normal file
View File

@ -0,0 +1,4 @@
autoload colors; colors;
unset LSCOLORS
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'

27
completion.zsh Normal file
View File

@ -0,0 +1,27 @@
setopt noautomenu
setopt COMPLETE_IN_WORD
setopt ALWAYS_TO_END
unsetopt flowcontrol
WORDCHARS=''
autoload -U compinit
compinit
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
unsetopt MENU_COMPLETE
setopt AUTO_MENU
bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu yes select
# zstyle ':completion:*:*:*:*:processes' force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`

26
functions.zsh Normal file
View File

@ -0,0 +1,26 @@
function title {
if [[ $TERM == "screen" ]]; then
# Use these two for GNU Screen:
print -nR $'\033k'$1$'\033'\\\
print -nR $'\033]0;'$2$'\a'
elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
# Use this one instead for XTerms:
print -nR $'\033]0;'$*$'\a'
fi
}
function precmd {
title zsh "$PWD"
}
function preexec {
emulate -L zsh
local -a cmd; cmd=(${(z)1})
title $cmd[1]:t "$cmd[2,-1]"
}
function remote_console() {
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
}

19
git.zsh Normal file
View File

@ -0,0 +1,19 @@
# get the name of the branch we are on
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=${ref#refs/heads/}
if [[ -d .git ]]; then
CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
else
CURRENT_BRANCH=''
fi
#echo "%{$fg[red]%}git:(%{$fg[green]$CURRENT_BRANCH%{$fg[red])"
echo $CURRENT_BRANCH
}
parse_git_dirty () {
[[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ "
}

6
grep.zsh Normal file
View File

@ -0,0 +1,6 @@
#
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'

15
history.zsh Normal file
View File

@ -0,0 +1,15 @@
# History stuff.
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
## Command history configuration
#
HISTFILE=$ZSH/log/.zsh_history
HISTSIZE=2500
SAVEHIST=2500
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data

5
projects.zsh-example Normal file
View File

@ -0,0 +1,5 @@
# Add yourself some shortcuts to projects you often work on
# Example:
#
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
#

29
prompt.zsh Normal file
View File

@ -0,0 +1,29 @@
bindkey -e
# Directory stuff.
setopt AUTO_NAME_DIRS
# Speed stuff.
#setopt NO_BEEP
setopt AUTO_CD
setopt MULTIOS
setopt CDABLEVARS
bindkey -e
if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
fi
PS1="%n@%m:%~%# "
# Setup the prompt with pretty colors
setopt prompt_subst
export LSCOLORS="Gxfxcxdxbxegedabagacad"
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'

42
rake_completion.zsh Normal file
View File

@ -0,0 +1,42 @@
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks ]; then return 0;
else
accurate=$(stat -f%m .rake_tasks)
changed=$(stat -f%m Rakefile)
return $(expr $accurate '>=' $changed)
fi
}
_rake () {
if [ -f Rakefile ]; then
if _rake_does_task_list_need_generating; then
echo "\nGenerating .rake_tasks..." > /dev/stderr
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
fi
compadd `cat .rake_tasks`
fi
}
compdef _rake rake
function _cap_does_task_list_need_generating () {
if [ ! -f .cap_tasks ]; then return 0;
else
accurate=$(stat -f%m .cap_tasks)
changed=$(stat -f%m config/deploy.rb)
return $(expr $accurate '>=' $changed)
fi
}
function _cap () {
if [ -f config/deploy.rb ]; then
if _cap_does_task_list_need_generating; then
echo "\nGenerating .cap_tasks..." > /dev/stderr
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
> .cap_tasks
fi
compadd `cat .cap_tasks`
fi
}
compdef _cap cap

34
zshrc Normal file
View File

@ -0,0 +1,34 @@
export EDITOR=/opt/local/bin/joe
export PAGER=less
export ZSH=$HOME/zsh
export LC_CTYPE=en_US.UTF-8
# TODO: Refactor this sometimes soon...
source $ZSH/colors.zsh
source $ZSH/aliases.zsh
source $ZSH/completion.zsh
source $ZSH/rake_completion.zsh
source $ZSH/functions.zsh
source $ZSH/git.zsh
source $ZSH/history.zsh
source $ZSH/grep.zsh
source $ZSH/prompt.zsh
# Uncomment if you have a projects.zsh file
# source $ZSH/projects.zsh
# Directory stuff.
setopt AUTO_NAME_DIRS
# Speed stuff.
#setopt NO_BEEP
setopt AUTO_CD
setopt MULTIOS
setopt CDABLEVARS
# Customize to your needs...
export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin