.zshrc: Make more portable for cross-platform use

Test Mac OS X / Linux properly, and get rid of Homebrew-isms -- I
am now using pkgsrc instead.

Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
Alan Orth 2015-05-05 11:39:45 +03:00
parent eee6929dc4
commit 5d13f77f10
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

46
.zshrc
View File

@ -20,21 +20,44 @@ compinit
# OS-specific things # OS-specific things
if [[ "$OSTYPE" =~ ^darwin.*$ ]]; then if [[ "$OSTYPE" =~ ^darwin.*$ ]]; then
PATH=$(brew --prefix coreutils)/libexec/gnubin:/usr/local/sbin:$PATH # set pkgsrc paths
# see: http://pkgsrc.joyent.com/install-on-osx/
PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH
MANPATH=/usr/pkg/man:$MANPATH
if [[ -f $(brew --prefix)/etc/bash_completion ]]; then # use pkgsrc's GNU coreutils (prefixed with 'g')
. $(brew --prefix)/etc/bash_completion # requires at least: coreutils findutils gsed
fi alias du='gdu'
alias ls='gls -F --color=auto'
alias df='gdf'
alias rm='grm'
alias cp='gcp'
alias mv='gmv'
alias mkdir='gmkdir'
alias rmdir='grmdir'
alias chmod='gchmod'
alias chown='gchown'
alias ln='gln'
alias find='gfind'
alias less='gless -R' # preserves colors
alias sed='gsed'
# solarized dircolors (needs coreutils from pkgsrc)
[[ -r ~/.dircolors.ansi-dark ]] && eval `gdircolors ~/.dircolors.ansi-dark`
elif [[ "$OSTYPE" =~ ^linux*$ ]]; then
# aliases
alias ls='ls -F --color=auto'
alias less='less -R' # preserves colors in GNU coreutils' `less`
# solarized dircolors
[[ -r ~/.dircolors.ansi-dark ]] && eval `dircolors ~/.dircolors.ansi-dark`
fi fi
# Aliases
alias ls='ls -F --color=auto'
alias less='less -R' # preserves colors in GNU coreutils' `less`
# Environment # Environment
export PS1='[%n@%m: %~]$ ' export PS1='[%n@%m: %~]$ '
export EDITOR=/usr/bin/vim export EDITOR=vim
export PAGER=/usr/bin/less export PAGER=less
# look for Ansible hosts file in current directory # look for Ansible hosts file in current directory
export ANSIBLE_INVENTORY=hosts export ANSIBLE_INVENTORY=hosts
@ -65,7 +88,4 @@ fi
# If a private bin directory exists, add it to PATH # If a private bin directory exists, add it to PATH
[[ -d ~/bin ]] && PATH="$PATH:~/bin" [[ -d ~/bin ]] && PATH="$PATH:~/bin"
# solarized dircolors (needs coreutils from homebrew on Mac OS X)
[[ -r ~/.dircolors.ansi-dark ]] && eval `dircolors ~/.dircolors.ansi-dark`
export PATH export PATH