From dc808faaf702fbaae1301504bcc440fb15b6e04b Mon Sep 17 00:00:00 2001 From: andre Date: Thu, 4 Nov 2010 14:05:46 +0000 Subject: [PATCH] New version of zshrc, that uses /Network/Library/zsh.d --- zsh.d/10-darwinEnvironment | 8 ++++ zsh.d/20-macPorts | 4 ++ zsh.d/30-dsFunctions | 23 ++++++++++ zsh.d/30-gnucoreutils | 18 ++++++++ zsh.d/90-vimFunc | 6 +++ zshrc | 94 +++++++++++++++++++------------------- 6 files changed, 105 insertions(+), 48 deletions(-) create mode 100644 zsh.d/10-darwinEnvironment create mode 100644 zsh.d/20-macPorts create mode 100644 zsh.d/30-dsFunctions create mode 100644 zsh.d/30-gnucoreutils create mode 100644 zsh.d/90-vimFunc diff --git a/zsh.d/10-darwinEnvironment b/zsh.d/10-darwinEnvironment new file mode 100644 index 0000000..a0210da --- /dev/null +++ b/zsh.d/10-darwinEnvironment @@ -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 ' diff --git a/zsh.d/20-macPorts b/zsh.d/20-macPorts new file mode 100644 index 0000000..20f198a --- /dev/null +++ b/zsh.d/20-macPorts @@ -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 : diff --git a/zsh.d/30-dsFunctions b/zsh.d/30-dsFunctions new file mode 100644 index 0000000..7b9e8e2 --- /dev/null +++ b/zsh.d/30-dsFunctions @@ -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 diff --git a/zsh.d/30-gnucoreutils b/zsh.d/30-gnucoreutils new file mode 100644 index 0000000..05acce9 --- /dev/null +++ b/zsh.d/30-gnucoreutils @@ -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 diff --git a/zsh.d/90-vimFunc b/zsh.d/90-vimFunc new file mode 100644 index 0000000..cf4ae0c --- /dev/null +++ b/zsh.d/90-vimFunc @@ -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 : diff --git a/zshrc b/zshrc index ad0d2aa..751fa20 100644 --- a/zshrc +++ b/zshrc @@ -6,12 +6,14 @@ # # Global Order: zshenv, zprofile, zshrc, zlogin # $Id$ +# $HeadURL$ setopt ALWAYS_TO_END setopt APPEND_HISTORY setopt AUTO_CD setopt ALL_EXPORT setopt AUTO_MENU +setopt AUTO_LIST setopt AUTONAMEDIRS setopt AUTO_PARAM_SLASH setopt AUTO_REMOVE_SLASH @@ -25,8 +27,7 @@ setopt HIST_REDUCE_BLANKS setopt LIST_TYPES setopt LONG_LIST_JOBS setopt MENU_COMPLETE -setopt NO_AUTOLIST -setopt NO_AUTOLIST +# setopt NO_AUTOLIST setopt NO_BEEP setopt NOHUP setopt NOTIFY @@ -34,6 +35,7 @@ setopt PATH_DIRS setopt SHORT_LOOPS umask 002 +ulimit -c 0 ## Vars used always # @@ -44,30 +46,20 @@ HISTSIZE=10000 LANG="it_IT.UTF-8" TZ='Europe/Rome' MIBS=all +LOGD=/var/log ## If we are not interactive quit [ -z "$PS1" ] && return ## 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 - -PS1="%B%m:%n:%~ %#%b " - +PYTHONSTARTUP=~/.pythonrc.py LOGCHECK=30 -LOGD=/var/log REPORTTIME=15 WATCH=notme WATCHFMT="%n %a %l (%m) at %t." -PYTHONSTARTUP=~/.pythonrc.py -MINICOM="-c on" +# Functions and aliases function cdb { cd `dirname $1` } @@ -94,12 +86,13 @@ alias mx='host -t mx' alias soa='host -t soa' alias ptr='host -t ptr' -alias vi=vim +alias vi="vim " -# Start autocoplete +# Start autocomplete autoload -U compinit; compinit -compctl -g "*(-/)" + -g ".*(-/)" cd -# +# autoload -U compsys +# compctl -g "*(-/)" + -g ".*(-/)" cd +# Colorize terminal autoload colors zsh/terminfo if [[ "$terminfo[colors]" -ge 8 ]]; then colors @@ -111,17 +104,9 @@ for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do done 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 -bindkey "-e" +bindkey "-e" bindkey "\e[1~" beginning-of-line bindkey "\e[4~" end-of-line bindkey "\e[3~" delete-char @@ -133,9 +118,7 @@ bindkey "\e[5D" backward-word bindkey "\e[5C" forward-word bindkey "" vi-backward-kill-word -ulimit -c 0 - -# PROMPT +# Setup PROMPT if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then # We are on xterminal PS1="%{]2;%n@%m:%.%}%{]1; %m:%. %}%B<%l> %~ %#%b " @@ -144,32 +127,47 @@ else PS1="%B[%l] %n@%m:%~ %#%b " 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 [ -f /etc/dir_colors ]; then - eval `dircolors /etc/dir_colors` - else - eval `dircolors` - fi + eval `dircolors` fi - +# Darwin/OSX if [ `uname -s` = "Darwin" ]; then - export LSCOLORS="GxgxcxdxCxegedabagacad" - # Alias for editors on OSX - alias vim='/Applications/MacVim.app/Contents/MacOS/Vim' - 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 + for zshFile in /Network/Library/zsh.d/*; do + . $zshFile + done fi -# Process Local file +# Host specific customizations for localDir in /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do if [ -f ${localDir}/zshrc.local ]; then . ${localDir}/zshrc.local fi done unset localDir + +# User specific customizations +if [ -f ~/.zshrc.user ]; then + . ~/.zshrc.user +fi