New version of zshrc, that uses /Network/Library/zsh.d

This commit is contained in:
Andrea Mistrali 2010-11-04 14:05:46 +00:00
parent 6eb89f7d1e
commit dc808faaf7
6 changed files with 105 additions and 48 deletions

View File

@ -0,0 +1,8 @@
# Environment and aliases for OSX
export LSCOLORS="GxgxcxdxCxegedabagacad"
alias aquamacs='open -a Aquamacs\ Emacs'
alias ldd='otool -L'
alias ls='ls -F -G'
alias skill=killall
alias lsrebuild='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user'
alias ipython='ipython-2.6 '

4
zsh.d/20-macPorts Normal file
View File

@ -0,0 +1,4 @@
if [ -f /opt/local/etc/init.sh ]; then
source /opt/local/etc/init.sh
fi
# vim: set ts=4 sw=4 tw=0 ft=sh :

23
zsh.d/30-dsFunctions Normal file
View File

@ -0,0 +1,23 @@
BASE='/LDAPv3/dioniso.cube.lan'
KEYWORD="desktop"
function dsComputerUserList {
for c in `dscl $BASE -search Computers Keywords desktop|grep Keywords|cut -f1|sort`; do
echo -n $c:
dscl $BASE -read Computers/$c Comment|cut -d: -f3
done
}
function dsComputerList {
for c in `dsComputerUserList`; do
echo $c|cut -d: -f1
done
}
function dsUser {
COMPUTER=${1-`dscl . -list Computers|grep -v localhost`}
dsComputerUserList| grep -i $COMPUTER|cut -d: -f2
}
unset BASE
unset KEYWORD

18
zsh.d/30-gnucoreutils Normal file
View File

@ -0,0 +1,18 @@
which gcp > /dev/null
if [ $? -eq 0 ]; then
if [ -f /etc/zsh/gdircolors ]; then
eval `gdircolors /etc/zsh/gdircolors`
else
eval `gdircolors`
fi
#alias ls='gls --color -F'
alias ll='ls -l'
alias la='ls -a'
alias cp='gcp'
alias mv='gmv'
alias rm='grm'
alias du='gdu'
alias df='gdf -a'
fi

6
zsh.d/90-vimFunc Normal file
View File

@ -0,0 +1,6 @@
# Alias for editors on OSX, a bit hard, to be fixed
# alias mvim="vimFunc "
alias mvim="mvim --serverlist && mvim --remote-tab-silent "
# alias vi="mvim "
# vim: set ts=4 sw=4 tw=0 ft=sh :

92
zshrc
View File

@ -6,12 +6,14 @@
# #
# Global Order: zshenv, zprofile, zshrc, zlogin # Global Order: zshenv, zprofile, zshrc, zlogin
# $Id$ # $Id$
# $HeadURL$
setopt ALWAYS_TO_END setopt ALWAYS_TO_END
setopt APPEND_HISTORY setopt APPEND_HISTORY
setopt AUTO_CD setopt AUTO_CD
setopt ALL_EXPORT setopt ALL_EXPORT
setopt AUTO_MENU setopt AUTO_MENU
setopt AUTO_LIST
setopt AUTONAMEDIRS setopt AUTONAMEDIRS
setopt AUTO_PARAM_SLASH setopt AUTO_PARAM_SLASH
setopt AUTO_REMOVE_SLASH setopt AUTO_REMOVE_SLASH
@ -25,8 +27,7 @@ setopt HIST_REDUCE_BLANKS
setopt LIST_TYPES setopt LIST_TYPES
setopt LONG_LIST_JOBS setopt LONG_LIST_JOBS
setopt MENU_COMPLETE setopt MENU_COMPLETE
setopt NO_AUTOLIST # setopt NO_AUTOLIST
setopt NO_AUTOLIST
setopt NO_BEEP setopt NO_BEEP
setopt NOHUP setopt NOHUP
setopt NOTIFY setopt NOTIFY
@ -34,6 +35,7 @@ setopt PATH_DIRS
setopt SHORT_LOOPS setopt SHORT_LOOPS
umask 002 umask 002
ulimit -c 0
## Vars used always ## Vars used always
# #
@ -44,30 +46,20 @@ HISTSIZE=10000
LANG="it_IT.UTF-8" LANG="it_IT.UTF-8"
TZ='Europe/Rome' TZ='Europe/Rome'
MIBS=all MIBS=all
LOGD=/var/log
## If we are not interactive quit ## If we are not interactive quit
[ -z "$PS1" ] && return [ -z "$PS1" ] && return
## Vars only for interactive sessions ## Vars only for interactive sessions
LESS="-c -x2 -R -MM -PMFile\:?f%f:STDIN. Size\:?B%B:Unknown. Pos\:?pb%pb\%:Unknown. File No.\:%i/%m"
LESSCHARSET=utf-8
READNULLCMD=/usr/bin/less
PAGER=/usr/bin/less
if [ -x =lesspipe ]; then
eval `lesspipe`
fi
EDITOR=vi EDITOR=vi
PYTHONSTARTUP=~/.pythonrc.py
PS1="%B%m:%n:%~ %#%b "
LOGCHECK=30 LOGCHECK=30
LOGD=/var/log
REPORTTIME=15 REPORTTIME=15
WATCH=notme WATCH=notme
WATCHFMT="%n %a %l (%m) at %t." WATCHFMT="%n %a %l (%m) at %t."
PYTHONSTARTUP=~/.pythonrc.py
MINICOM="-c on"
# Functions and aliases
function cdb { function cdb {
cd `dirname $1` cd `dirname $1`
} }
@ -94,12 +86,13 @@ alias mx='host -t mx'
alias soa='host -t soa' alias soa='host -t soa'
alias ptr='host -t ptr' alias ptr='host -t ptr'
alias vi=vim alias vi="vim "
# Start autocoplete # Start autocomplete
autoload -U compinit; compinit autoload -U compinit; compinit
compctl -g "*(-/)" + -g ".*(-/)" cd # autoload -U compsys
# # compctl -g "*(-/)" + -g ".*(-/)" cd
# Colorize terminal
autoload colors zsh/terminfo autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then if [[ "$terminfo[colors]" -ge 8 ]]; then
colors colors
@ -111,14 +104,6 @@ for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
done done
PR_NO_COLOR="%{$terminfo[sgr0]%}" PR_NO_COLOR="%{$terminfo[sgr0]%}"
# #
## make less colourful
LESS_TERMCAP_mb=$'\E[01;31m'
LESS_TERMCAP_md=$'\E[01;31m'
LESS_TERMCAP_me=$'\E[0m'
LESS_TERMCAP_se=$'\E[0m'
LESS_TERMCAP_so=$'\E[01;44;33m'
LESS_TERMCAP_ue=$'\E[0m'
LESS_TERMCAP_us=$'\E[01;32m'
# Useful under iTerm # Useful under iTerm
bindkey "-e" bindkey "-e"
@ -133,9 +118,7 @@ bindkey "\e[5D" backward-word
bindkey "\e[5C" forward-word bindkey "\e[5C" forward-word
bindkey "" vi-backward-kill-word bindkey "" vi-backward-kill-word
ulimit -c 0 # Setup PROMPT
# PROMPT
if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then
# We are on xterminal # We are on xterminal
PS1="%{]2;%n@%m:%.%}%{]1; %m:%. %}%B<%l> %~ %#%b " PS1="%{]2;%n@%m:%.%}%{]1; %m:%. %}%B<%l> %~ %#%b "
@ -144,32 +127,47 @@ else
PS1="%B[%l] %n@%m:%~ %#%b " PS1="%B[%l] %n@%m:%~ %#%b "
fi fi
# Setup LESS
for lp in lesspipe lesspipe.sh; do
LESSPIPE=`which $lp`
[ $? -eq 0 ] && eval `$LESSPIPE`
done
## make less colourful
LESS_TERMCAP_mb=$'\E[01;34m' # begin blinking
LESS_TERMCAP_md=$'\E[01;36m' # begin bold
LESS_TERMCAP_me=$'\E[0m' # end mode
LESS_TERMCAP_so=$'\E[01;47;34m' # begin standout-mode - info box
LESS_TERMCAP_se=$'\E[0m' # end standout-mode
LESS_TERMCAP_us=$'\E[04;32m' # begin underline
LESS_TERMCAP_ue=$'\E[0m' # end underline
LESS="-c -x4 -R -MM -PMFile\:?f%f:STDIN. ?BSize\:?B%B:Unk.?B\:?pb%pb\%:Unk.?B\:%i/%m"
LESSCHARSET=utf-8
READNULLCMD=/usr/bin/less
PAGER=/usr/bin/less
# Platform specific customizations
# Linux
if [ `uname -s` = "Linux" ]; then if [ `uname -s` = "Linux" ]; then
if [ -f /etc/dir_colors ]; then eval `dircolors`
eval `dircolors /etc/dir_colors`
else
eval `dircolors`
fi
fi fi
# Darwin/OSX
if [ `uname -s` = "Darwin" ]; then if [ `uname -s` = "Darwin" ]; then
export LSCOLORS="GxgxcxdxCxegedabagacad" for zshFile in /Network/Library/zsh.d/*; do
# Alias for editors on OSX . $zshFile
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim' done
alias aquamacs='open -a Aquamacs\ Emacs'
alias ldd='otool -L'
alias ls='ls -F -G'
alias skill=killall
if [ -f /opt/local/etc/init.sh ]; then
source /opt/local/etc/init.sh
fi
fi fi
# Process Local file # Host specific customizations
for localDir in /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do for localDir in /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do
if [ -f ${localDir}/zshrc.local ]; then if [ -f ${localDir}/zshrc.local ]; then
. ${localDir}/zshrc.local . ${localDir}/zshrc.local
fi fi
done done
unset localDir unset localDir
# User specific customizations
if [ -f ~/.zshrc.user ]; then
. ~/.zshrc.user
fi