summaryrefslogtreecommitdiff
path: root/zsh/.zsh/functions
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2016-04-21 14:21:38 +0100
committerUrbain Vaes <urbain@vaes.uk>2016-04-21 14:21:38 +0100
commit750e9a5d58c2719a87f931eb5bcc505d382cb6c7 (patch)
tree9382cbac731493d0beeca31dd1364fc08adc4821 /zsh/.zsh/functions
parentcc6813cff722f2c6d65bd6aafc2da909f3b867ca (diff)
Add tomorrow theme and improve script
Diffstat (limited to 'zsh/.zsh/functions')
-rw-r--r--zsh/.zsh/functions23
1 files changed, 17 insertions, 6 deletions
diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions
index 7c2b49a..07fca73 100644
--- a/zsh/.zsh/functions
+++ b/zsh/.zsh/functions
@@ -2,15 +2,26 @@
function colo {
+ # Change environment variable
+ export COLORSCHEME=$1
+ export BACKGROUND=$2
+
+ if [[ -z ${BACKGROUND} ]]; then
+ XRESOURCE=~/.Xresources/${COLORSCHEME}
+ else
+ XRESOURCE=~/.Xresources/${COLORSCHEME}-${BACKGROUND}
+ fi
+
# Change colors for current session
- $HOME/bin/recolor < ~/.Xresources/$1
+ $HOME/bin/recolor < ${XRESOURCE}
# Load Xresources file for future sessions
- xrdb -I$HOME ~/.Xresources/$1
-
- # Change environment variable
- export COLORSCHEME=$1
+ xrdb -I$HOME ${XRESOURCE}
# Change default environment variable for future sessions
- sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/.zsh/tmp
+ sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=${COLORSCHEME}/g" ~/.zsh/tmp
+ sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export BACKGROUND=${BACKGROUND}/g" ~/.zsh/tmp
}
+
+# Completion for colorschemes
+compctl -k "($(ls ${HOME}/.Xresources))" colo