aboutsummaryrefslogtreecommitdiffstats
path: root/.zshrc-freebsd
diff options
context:
space:
mode:
authorshmibs <shmibs@gmail.com>2015-07-07 16:13:25 -0700
committershmibs <shmibs@gmail.com>2015-07-07 16:13:25 -0700
commit12f912e9ed0b5decb5e88941a631619652b3ee3e (patch)
tree76456ad601aa425f3dd0589158c208933062d2ab /.zshrc-freebsd
parenta459421d82cf6de64be597286d4e327902b8437e (diff)
downloaddotfiles-12f912e9ed0b5decb5e88941a631619652b3ee3e.tar.gz
make .zshrc portable
also remove extraneous commands
Diffstat (limited to '.zshrc-freebsd')
-rw-r--r--.zshrc-freebsd40
1 files changed, 40 insertions, 0 deletions
diff --git a/.zshrc-freebsd b/.zshrc-freebsd
new file mode 100644
index 0000000..e1ccb23
--- /dev/null
+++ b/.zshrc-freebsd
@@ -0,0 +1,40 @@
+################### ALIASES ##################
+alias ls='ls -G'
+alias ll='ls -lG'
+alias grep='grep --color=auto'
+alias diff='colordiff'
+alias less='less -R'
+alias ag='ag --color-match "1;34"'
+alias svim='sudo -E vim'
+
+alias :q='exit'
+
+export EDITOR="vim"
+export PAGER="less -R"
+
+################## FUNCTIONS ##################
+
+# bits to human readable value
+b2h() {
+ suffixes=( 'B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y' )
+ sindex=1
+ val=$1
+ [[ -z $(echo $1 | grep "^[0-9]*$") ]] && read val
+
+ while [[ $(echo $val / 1024 | bc) -ne 0 ]]; do
+ val=$(echo "scale=2; $val / 1024" | bc)
+ let sindex=sindex+1
+ done
+
+ echo "${val}${suffixes[$sindex]}"
+}
+
+# ignore non-tracked files
+git() {
+ if [[ $# -gt 0 ]] && [[ "$1" == "status" ]]; then
+ shift
+ $(which -p git) status -uno "$@"
+ else
+ $(which -p git) "$@"
+ fi
+}