mirror of https://github.com/bjeanes/dotfiles.git
A lot more refactoring including ZSH prompt improvements and making the `m` function more intelligent
parent
a92246f078
commit
3bad87fac8
7
README
7
README
|
@ -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
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|
23
bash/aliases
23
bash/aliases
|
@ -1,4 +1,4 @@
|
||||||
alias gem='sudo gem' # sick of always forgetting sudo
|
alias gi='sudo gem install'
|
||||||
alias ls='ls -FG'
|
alias ls='ls -FG'
|
||||||
alias ll='ls -lah'
|
alias ll='ls -lah'
|
||||||
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
|
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 h='history|g'
|
||||||
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
|
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
|
||||||
alias top='top -o cpu'
|
alias top='top -o cpu'
|
||||||
alias m='mate .'
|
|
||||||
alias o='open .'
|
alias o='open .'
|
||||||
alias et="m"
|
alias et="m"
|
||||||
|
|
||||||
|
alias sprof="reload"
|
||||||
|
|
||||||
alias home='cd ~' # the tilda is too hard to reach
|
alias home='cd ~' # the tilda is too hard to reach
|
||||||
alias systail='tail -f -n0 /var/log/system.log'
|
alias systail='tail -f -n0 /var/log/system.log'
|
||||||
alias aptail='tail -f -n0 /var/log/apache*/*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 c='clear' # shortcut to clear your terminal
|
||||||
|
|
||||||
alias sprof='source ~/.bash_profile'
|
|
||||||
|
|
||||||
# useful command to find what you should be aliasing:
|
# 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"
|
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 log='tail -f -0 ./log/*.log'
|
||||||
alias ss='ruby ./script/server'
|
alias ss='ruby ./script/server'
|
||||||
alias sc='ruby ./script/console'
|
alias sc='ruby ./script/console'
|
||||||
alias cdm='cap deploy deploy:migrate'
|
alias gen='script/generate'
|
||||||
alias model='script/generate model'
|
|
||||||
alias controller='script/generate controller'
|
|
||||||
alias migration='script/generate migration'
|
alias migration='script/generate migration'
|
||||||
alias migrate='rake db:migrate'
|
alias migrate='rake db:migrate'
|
||||||
alias rollback='rake db:rollback'
|
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
|
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
||||||
|
|
||||||
function f() { find * -name $1; }
|
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() {
|
function extract() {
|
||||||
if [ -f $1 ] ; then
|
if [ -f $1 ] ; then
|
||||||
|
@ -78,7 +86,6 @@ if [ $system_name = 'Darwin' ]; then
|
||||||
}
|
}
|
||||||
alias ls='ls -G'
|
alias ls='ls -G'
|
||||||
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
|
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
|
||||||
alias m='mate .'
|
|
||||||
alias et="m"
|
alias et="m"
|
||||||
alias o='open .'
|
alias o='open .'
|
||||||
alias eprof="mate ~/.config"
|
alias eprof="mate ~/.config"
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
export CURRENT_SHELL=`which bash`
|
export CURRENT_SHELL=`which bash`
|
||||||
export DOT_FILES=$HOME/.config
|
export DOT_FILES=$HOME/.config
|
||||||
|
|
||||||
source $DOT_FILES/bash/common # All things that are both ZSH and Bash compatible
|
# All things that are both ZSH and Bash compatible
|
||||||
source $DOT_FILES/git/git-completion
|
source $DOT_FILES/bash/common
|
||||||
source $DOT_FILES/bash/save-directory
|
source $DOT_FILES/bash/save-directory
|
||||||
|
source $DOT_FILES/git/git-completion
|
||||||
|
|
||||||
|
alias reload="source ~/.bashrc"
|
||||||
|
|
||||||
|
export PS1="\w ♪ "
|
||||||
|
|
||||||
if [ $system_name == 'Darwin' ]; then
|
if [ $system_name == 'Darwin' ]; then
|
||||||
source $DOT_FILES/bash/terminal
|
source $DOT_FILES/bash/terminal
|
||||||
|
|
|
@ -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
|
system_name=`uname -s` # Sets 'Darwin' or 'Linux' etc
|
||||||
|
|
||||||
# Common functionality between Zsh and Bash
|
# Common functionality between Zsh and Bash
|
||||||
|
@ -5,4 +8,6 @@ source $DOT_FILES/bash/exports
|
||||||
source $DOT_FILES/git/gitrc
|
source $DOT_FILES/git/gitrc
|
||||||
source $DOT_FILES/bash/aliases
|
source $DOT_FILES/bash/aliases
|
||||||
|
|
||||||
|
export VCPROMPT=~/.config/misc/vcprompt.py
|
||||||
|
|
||||||
if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi
|
if [ -f ~/.rvm/bin/rvm ] ; then source ~/.rvm/bin/rvm ; fi
|
||||||
|
|
|
@ -2,7 +2,7 @@ if [ $system_name = 'Darwin' ]; then
|
||||||
export EDITOR='mate -w'
|
export EDITOR='mate -w'
|
||||||
export PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/:$PATH"
|
export PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/:$PATH"
|
||||||
export PATH="/Library/PostgreSQL8/bin/:$PATH"
|
export PATH="/Library/PostgreSQL8/bin/:$PATH"
|
||||||
export CDPATH='.:~:~/Projecs:~/Sites'
|
export CDPATH="$CDPATH:~/Code/*:~/Sites/*"
|
||||||
export GEM_OPEN_EDITOR='mate'
|
export GEM_OPEN_EDITOR='mate'
|
||||||
else
|
else
|
||||||
export EDITOR='nano -w'
|
export EDITOR='nano -w'
|
||||||
|
|
|
@ -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
|
# By default up/down are bound to previous-history
|
||||||
# and next-history respectively. The following does the
|
# and next-history respectively. The following does the
|
||||||
|
@ -12,7 +14,7 @@
|
||||||
#
|
#
|
||||||
"\e[B": history-search-forward
|
"\e[B": history-search-forward
|
||||||
"\e[A": history-search-backward
|
"\e[A": history-search-backward
|
||||||
|
|
||||||
$if Bash
|
$if Bash
|
||||||
# F10 toggles mc on and off
|
# F10 toggles mc on and off
|
||||||
# Note Ctrl-o toggles panes on and off in mc
|
# Note Ctrl-o toggles panes on and off in mc
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
alias reload="source ~/.zshrc"
|
||||||
setopt extendedglob
|
setopt extendedglob
|
|
@ -1,6 +1,6 @@
|
||||||
export ZSH=$HOME/.oh-my-zsh
|
export ZSH=$HOME/.oh-my-zsh
|
||||||
export ZSH_THEME="risto"
|
export ZSH_THEME="risto"
|
||||||
plugins=(rails git textmate ruby osx)
|
plugins=(rails git ruby osx)
|
||||||
|
|
||||||
if [ -d "$ZSH" ]; then
|
if [ -d "$ZSH" ]; then
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
@ -8,8 +8,4 @@ else
|
||||||
echo "Cloning Oh My Zsh..."
|
echo "Cloning Oh My Zsh..."
|
||||||
/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git "$ZSH"
|
/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git "$ZSH"
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
19
zsh/theme
19
zsh/theme
|
@ -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_VCS_PROMPT_PREFIX="%{$fg[red]%}‹"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}"
|
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})'
|
||||||
|
|
10
zsh/zshrc
10
zsh/zshrc
|
@ -1,8 +1,14 @@
|
||||||
export DOT_FILES=$HOME/.config
|
export DOT_FILES=$HOME/.config
|
||||||
export CURRENT_SHELL=`which zsh`
|
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
|
source $DOT_FILES/zsh/oh-my-zsh
|
||||||
|
|
||||||
|
# Extra ZSH configuration
|
||||||
source $DOT_FILES/zsh/config
|
source $DOT_FILES/zsh/config
|
||||||
|
|
||||||
|
# My custom theme
|
||||||
source $DOT_FILES/zsh/theme
|
source $DOT_FILES/zsh/theme
|
||||||
source $DOT_FILES/bash/common
|
|
Loading…
Reference in New Issue