A lot more refactoring including ZSH prompt improvements and making the `m` function more intelligent

pull/2/head
Bodaniel Jeanes 2010-06-27 01:12:01 +10:00
parent a92246f078
commit 3bad87fac8
10 changed files with 64 additions and 27 deletions

7
README
View File

@ -1,4 +1,9 @@
Copyright (c) 2008-2009 Bodaniel Jeanes
# TODO
* Make ZSH/Bash PATH dynamically figured out (via globbing) like fish
Copyright (c) 2008-2010 Bodaniel Jeanes
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,4 +1,4 @@
alias gem='sudo gem' # sick of always forgetting sudo
alias gi='sudo gem install'
alias ls='ls -FG'
alias ll='ls -lah'
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
@ -7,10 +7,11 @@ alias g='grep -i' #case insensitive grep
alias h='history|g'
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
alias top='top -o cpu'
alias m='mate .'
alias o='open .'
alias et="m"
alias sprof="reload"
alias home='cd ~' # the tilda is too hard to reach
alias systail='tail -f -n0 /var/log/system.log'
alias aptail='tail -f -n0 /var/log/apache*/*log'
@ -19,8 +20,6 @@ alias b='cd -'
alias c='clear' # shortcut to clear your terminal
alias sprof='source ~/.bash_profile'
# useful command to find what you should be aliasing:
alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
@ -28,9 +27,7 @@ alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}'
alias log='tail -f -0 ./log/*.log'
alias ss='ruby ./script/server'
alias sc='ruby ./script/console'
alias cdm='cap deploy deploy:migrate'
alias model='script/generate model'
alias controller='script/generate controller'
alias gen='script/generate'
alias migration='script/generate migration'
alias migrate='rake db:migrate'
alias rollback='rake db:rollback'
@ -45,6 +42,17 @@ alias netstat="sudo lsof -i -P"
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
function f() { find * -name $1; }
function p() {
cd $* && m
}
function m() {
if [ -n "$*" ]; then
files=$*
else
files=.
fi
mate -l1 $files 2>/dev/null
}
function extract() {
if [ -f $1 ] ; then
@ -78,7 +86,6 @@ if [ $system_name = 'Darwin' ]; then
}
alias ls='ls -G'
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
alias m='mate .'
alias et="m"
alias o='open .'
alias eprof="mate ~/.config"

View File

@ -1,10 +1,14 @@
export CURRENT_SHELL=`which bash`
export DOT_FILES=$HOME/.config
source $DOT_FILES/bash/common # All things that are both ZSH and Bash compatible
source $DOT_FILES/git/git-completion
# All things that are both ZSH and Bash compatible
source $DOT_FILES/bash/common
source $DOT_FILES/bash/save-directory
source $DOT_FILES/git/git-completion
alias reload="source ~/.bashrc"
export PS1="\w ♪ "
if [ $system_name == 'Darwin' ]; then
source $DOT_FILES/bash/terminal

View File

@ -1,3 +1,6 @@
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin
export CDPATH=".:~"
system_name=`uname -s` # Sets 'Darwin' or 'Linux' etc
# Common functionality between Zsh and Bash
@ -5,4 +8,6 @@ source $DOT_FILES/bash/exports
source $DOT_FILES/git/gitrc
source $DOT_FILES/bash/aliases
export VCPROMPT=~/.config/misc/vcprompt.py
if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi

View File

@ -2,7 +2,7 @@ if [ $system_name = 'Darwin' ]; then
export EDITOR='mate -w'
export PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/:$PATH"
export PATH="/Library/PostgreSQL8/bin/:$PATH"
export CDPATH='.:~:~/Projecs:~/Sites'
export CDPATH="$CDPATH:~/Code/*:~/Sites/*"
export GEM_OPEN_EDITOR='mate'
else
export EDITOR='nano -w'

View File

@ -1,5 +1,7 @@
# from http://www.pixelbeat.org/settings/.inputrc
set meta-flag on
set input-meta on
set output-meta on
set convert-meta off
# By default up/down are bound to previous-history
# and next-history respectively. The following does the
@ -12,7 +14,7 @@
#
"\e[B": history-search-forward
"\e[A": history-search-backward
$if Bash
# F10 toggles mc on and off
# Note Ctrl-o toggles panes on and off in mc

View File

@ -1 +1,2 @@
alias reload="source ~/.zshrc"
setopt extendedglob

View File

@ -1,6 +1,6 @@
export ZSH=$HOME/.oh-my-zsh
export ZSH_THEME="risto"
plugins=(rails git textmate ruby osx)
plugins=(rails git ruby osx)
if [ -d "$ZSH" ]; then
source $ZSH/oh-my-zsh.sh
@ -8,8 +8,4 @@ else
echo "Cloning Oh My Zsh..."
/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git "$ZSH"
source $ZSH/oh-my-zsh.sh
fi
fi

View File

@ -1,6 +1,17 @@
PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ %{$reset_color%}%(!.#.$) '
function prompt_color() {
if [ "$(whoami)" = "root" ]; then
echo "red"
else
echo "green"
fi
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_VCS_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_VCS_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_VCS_PROMPT_FORMAT="${ZSH_THEME_VCS_PROMPT_PREFIX}%b:%h${ZSH_THEME_VCS_PROMPT_SUFFIX}"
RPROMPT='$(~/.config/misc/vcprompt.py -f "${ZSH_THEME_GIT_PROMPT_PREFIX}%b:%h${ZSH_THEME_GIT_PROMPT_SUFFIX}")'
# Prompts
# PS1='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ %{$reset_color%}%(!.#.$) '
PS1='%~ %{$fg[$(prompt_color)]%}♪%{$reset_color%} '
RPS1='$(${VCPROMPT} -f ${ZSH_THEME_VCS_PROMPT_FORMAT})'

View File

@ -1,8 +1,14 @@
export DOT_FILES=$HOME/.config
export CURRENT_SHELL=`which zsh`
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin
# Include some ZSH-compatible config from bash (such as aliases, etc)
source $DOT_FILES/bash/common
# Install and load oh-my-zsh
source $DOT_FILES/zsh/oh-my-zsh
# Extra ZSH configuration
source $DOT_FILES/zsh/config
# My custom theme
source $DOT_FILES/zsh/theme
source $DOT_FILES/bash/common