diff options
author | Urbain Vaes <urbain@vaes.uk> | 2016-04-21 14:25:15 +0100 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2016-04-21 14:41:21 +0100 |
commit | 2365be00f256393173154ebe35c63f8389093819 (patch) | |
tree | cfb6689c8f7253b7280ceb932203a107569fd7bb | |
parent | 750e9a5d58c2719a87f931eb5bcc505d382cb6c7 (diff) |
Make completion case insensitive
-rw-r--r-- | mutt/.mutt/muttrc | 4 | ||||
-rw-r--r-- | zsh/.zsh/functions | 26 |
2 files changed, 17 insertions, 13 deletions
diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index 2264a95..cef8107 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -86,8 +86,8 @@ folder-hook 'Work*' 'source ~/.mutt/id_work' folder-hook 'Personal*' 'source ~/.mutt/id_personal' # Source mutt solarized -`[ "$COLORSCHEME" = "light" ] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-light-16.muttrc || echo set` -`[ "$COLORSCHEME" = "dark" ] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-dark-16.muttrc || echo set` +`[[ "$COLORSCHEME" = "solarized" && "$BACKGROUND" = "light" ]] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-light-16.muttrc || echo set` +`[[ "$COLORSCHEME" = "solarized" && "$BACKGROUND" = "dark" ]] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-dark-16.muttrc || echo set` # Identities set reverse_name diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions index 07fca73..e77dee7 100644 --- a/zsh/.zsh/functions +++ b/zsh/.zsh/functions @@ -2,26 +2,30 @@ function colo { - # Change environment variable - export COLORSCHEME=$1 - export BACKGROUND=$2 + # Xresource file + XRESOURCE=$1 - if [[ -z ${BACKGROUND} ]]; then - XRESOURCE=~/.Xresources/${COLORSCHEME} - else - XRESOURCE=~/.Xresources/${COLORSCHEME}-${BACKGROUND} + if [[ "${XRESOURCE}" == *"-dark" ]]; then + export COLORSCHEME=${XRESOURCE%-dark} + export BACKGROUND="dark" + elif [[ "${XRESOURCE}" == *"-light" ]]; then + export COLORSCHEME=${XRESOURCE%-light} + export BACKGROUND="light" + else + export COLORSCHEME=${XRESOURCE} + export BACKGROUND="" fi # Change colors for current session - $HOME/bin/recolor < ${XRESOURCE} + $HOME/bin/recolor < ~/.Xresources/${XRESOURCE} # Load Xresources file for future sessions - xrdb -I$HOME ${XRESOURCE} + xrdb -I$HOME ~/.Xresources/${XRESOURCE} # Change default environment variable for future sessions 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 +# Completion for colorschemes (-M -> Case insensitive) +compctl -k "($(ls ${HOME}/.Xresources))" -M 'm:{a-z}={A-Z}' colo |