summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2015-08-30 20:00:00 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2015-08-30 22:02:56 +0200
commita06e98948faedbbe2aef7bec94ef34d53cb906dd (patch)
tree5146ff9181e2739a3c1704973aafbec189cfe9d7
parent50e2c6171354cceae06488a8d485c99212d9d0a7 (diff)
downloaddotfiles-a06e98948faedbbe2aef7bec94ef34d53cb906dd.tar.gz
dotfiles-a06e98948faedbbe2aef7bec94ef34d53cb906dd.tar.bz2
dotfiles-a06e98948faedbbe2aef7bec94ef34d53cb906dd.zip
[zsh] Introduce $_IS_GENTOO
-rwxr-xr-x[-rw-r--r--].xinitrc0
-rw-r--r--.zsh/zshfunctions96
-rw-r--r--.zsh/zshrc33
3 files changed, 73 insertions, 56 deletions
diff --git a/.xinitrc b/.xinitrc
index 0b1ebbf..0b1ebbf 100644..100755
--- a/.xinitrc
+++ b/.xinitrc
diff --git a/.zsh/zshfunctions b/.zsh/zshfunctions
index fb24fee..4a7f0b9 100644
--- a/.zsh/zshfunctions
+++ b/.zsh/zshfunctions
@@ -1,11 +1,13 @@
-# Nice mappings to restart/... the services
-Start Stop Reload Restart ()
-{
- local SUDO
+if [[ -n $_IS_GENTOO ]]; then
+ # Nice mappings to restart/... the services
+ Start Stop Reload Restart ()
+ {
+ local SUDO
- [[ $UID != 0 ]] && SUDO="sudo"
- $SUDO /etc/init.d/$1 ${0:l}
-}
+ [[ $UID != 0 ]] && SUDO="sudo"
+ $SUDO /etc/init.d/$1 ${0:l}
+ }
+fi
# Quick find
f()
@@ -20,18 +22,6 @@ zman() {
PAGER="less -g -s '+/(?i)^ "$1"'" man zshall
}
-# Change to the directory of a specific package
-_cdu ()
-{
- cd ${1:h}
-}
-
-# unpacks a specific package
-_unpack ()
-{
- ebuild $1 clean unpack
-}
-
check_libs()
{
local pmapc="
@@ -101,31 +91,45 @@ PROG
esac
}
-# set job count to 1 if there is only one package to install
-emerge()
-{
- if [[ $# < 3 ]]; then
- command emerge --jobs=1 $@
- else
- command emerge $@
- fi
-}
+if [[ -n $_IS_GENTOO ]]; then
+ # Change to the directory of a specific package
+ _cdu ()
+ {
+ cd ${1:h}
+ }
-# keyword a specific package using flaggie
-# relies on the $_kw variable set in .zshenv
-kw()
-{
- if [[ -z $1 ]]; then
- echo "Error: Need the package"
- return 1
- fi
-
- if whence flaggie NOE; then
- # use 'flaggie'
- flaggie $1 "+$_kw"
- else
- echo "Error: flaggie not installed"
- echo "Do it yourself!"
- return 1
- fi
-}
+ # unpacks a specific package
+ _unpack ()
+ {
+ ebuild $1 clean unpack
+ }
+
+ # set job count to 1 if there is only one package to install
+ emerge()
+ {
+ if [[ $# < 3 ]]; then
+ command emerge --jobs=1 $@
+ else
+ command emerge $@
+ fi
+ }
+
+ # keyword a specific package using flaggie
+ # relies on the $_kw variable set in .zshenv
+ kw()
+ {
+ if [[ -z $1 ]]; then
+ echo "Error: Need the package"
+ return 1
+ fi
+
+ if whence flaggie NOE; then
+ # use 'flaggie'
+ flaggie $1 "+$_kw"
+ else
+ echo "Error: flaggie not installed"
+ echo "Do it yourself!"
+ return 1
+ fi
+ }
+fi
diff --git a/.zsh/zshrc b/.zsh/zshrc
index 88baa18..a8024e8 100644
--- a/.zsh/zshrc
+++ b/.zsh/zshrc
@@ -1,11 +1,16 @@
# provide the is-at-least command
autoload is-at-least
+# check for Gentoo
+if [[ -e /etc/gentoo-release ]]; then
+ _IS_GENTOO=1
+fi
+
# Alias definition {{{
#################################################
# directory aliases
-hash -d ulp=/usr/local/portage
+[[ -n $_IS_GENTOO ]] && hash -d ulp=/usr/local/portage
# the | cmd aliases
alias -g L='| less'
@@ -30,15 +35,17 @@ alias la='ls -a'
# prevent man from using localized pages
alias man='LANG= man'
-# emerge stuff
-alias AK="ACCEPT_KEYWORDS=\"$_kw\"" # _kw should be set in .zshenv
-alias NS='FEATURES="nostrip" CFLAGS="-O0 -ggdb -pipe -march=native" CXXFLAGS="${CFLAGS}"'
-alias e="eix -e"
-alias i="eix -I"
-alias ee='open_ebuild vim'
-alias eeg='open_ebuild gvim'
-alias cdu='open_ebuild _cdu'
-alias unpack='open_ebuild _unpack'
+if [[ -n $_IS_GENTOO ]]; then
+ # emerge stuff
+ alias AK="ACCEPT_KEYWORDS=\"$_kw\"" # _kw should be set in .zshenv
+ alias NS='FEATURES="nostrip" CFLAGS="-O0 -ggdb -pipe -march=native" CXXFLAGS="${CFLAGS}"'
+ alias e="eix -e"
+ alias i="eix -I"
+ alias ee='open_ebuild vim'
+ alias eeg='open_ebuild gvim'
+ alias cdu='open_ebuild _cdu'
+ alias unpack='open_ebuild _unpack'
+fi
# misc
alias quickweb='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
@@ -314,4 +321,10 @@ autoload -U zmv
# }}}
+# Cleanuo {{{
+#################################################
+
+unset _IS_GENTOO
+
+# }}}
# vim: fdm=marker