Created
May 12, 2011 05:27
-
-
Save mig/967994 to your computer and use it in GitHub Desktop.
zshrc for remote servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ZSH config for remote servers | |
# Encoding | |
LANG=en_US.UTF-8 | |
# Path | |
export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
# Appearence | |
# ls colors | |
autoload colors; colors; | |
export LSCOLORS="Gxfxcxdxbxegedabagacad" | |
# Enable ls colors | |
#if [ "$DISABLE_LS_COLORS" != "true" ] | |
#then | |
# Find the option for using colors in ls, depending on the version: Linux or BSD | |
# ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' | |
#fi | |
setopt no_beep | |
setopt auto_cd | |
setopt multios | |
setopt cdablevarS | |
if [[ x$WINDOW != x ]] | |
then | |
SCREEN_NO="%B$WINDOW%b " | |
else | |
SCREEN_NO="" | |
fi | |
# Apply theming defaults | |
PS1="%n@%m:%$%# " | |
# Setup the prompt with pretty colors | |
setopt prompt_subst | |
# Load theme | |
local return_code="%(?..%{$fg[red]%}%? âµ%{$reset_color%})" | |
# PROMPT='%{$fg_bold[red]%}%{$fg_bold[green]%}%p[%{$fg[cyan]%}%c%{$fg_bold[green]%}]%{$reset_color%} %% ' | |
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~)%#%{$reset_color%} ' | |
ZSH_THEME_GIT_PROMPT_PREFIX="(" | |
ZSH_THEME_GIT_PROMPT_SUFFIX=") " | |
# Completion | |
unsetopt menu_complete # do not autoselect the first completion entry | |
unsetopt flowcontrol | |
setopt auto_menu # show completion menu on succesive tab press | |
setopt complete_in_word | |
setopt always_to_end | |
WORDCHARS='' | |
autoload -U compinit | |
compinit -i | |
# Load known hosts file for auto-completion with ssh and scp commands | |
if [ -f ~/.ssh/known_hosts ]; then | |
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) | |
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` | |
fi | |
# Functions | |
function authme() { | |
ssh $1 "if [ ! -d '.ssh' ]; then mkdir '.ssh'; fi; cat >>.ssh/authorized_keys" <~/.ssh/id_rsa.pub | |
} | |
# History | |
HISTFILE=$HOME/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
setopt hist_ignore_dups # ignore duplication command history list | |
setopt share_history # share command history data | |
setopt hist_verify | |
setopt inc_append_history | |
setopt extended_history | |
setopt hist_expire_dups_first | |
setopt hist_ignore_space | |
setopt SHARE_HISTORY | |
setopt APPEND_HISTORY | |
alias gcm='git checkout master' | |
alias gcw='git checkout work' | |
alias grb='git rebase master' | |
alias gmw='git merge work' | |
alias db-reset='rake db:migrate:reset db:seed db:test:prepare' | |
# rails functions | |
function sc () { | |
if [ -f ./script/rails ] | |
then | |
rails console $argv | |
else | |
./script/console $argv | |
fi | |
} | |
function ss () { | |
if [ -f ./script/rails ] | |
then | |
rails server $argv | |
else | |
./script/server $argv | |
fi | |
} | |
function sg () { | |
if [ -f ./script/rails ] | |
then | |
rails generate $argv | |
else | |
./script/generate $argv | |
fi | |
} | |
function sd () { | |
if [ -f ./script/rails ] | |
then | |
rails destroy $argv | |
else | |
./script/destroy $argv | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment