Diff
1diff --git a/lib/completion.zsh b/lib/completion.zsh
2index c932bc925494da7a2ce74f67daa9c32dd5a31996..8b87557a2aef56f47950ae3db260d4d27cd41135 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -73,4 +73,4 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
6 fi
7
8 # automatically load bash completion functions
9-autoload -Uz bashcompinit && bashcompinit
10+autoload -U +X bashcompinit && bashcompinit
11diff --git a/lib/functions.zsh b/lib/functions.zsh
12index f934ab96803ae100ff2a861b87344d3dffdbc0b5..678e29ce7b3de5f8d2d8fadff677e3a3e536cdbe 100644
13--- a/lib/functions.zsh
14+++ b/lib/functions.zsh
15@@ -89,7 +89,7 @@ function default() {
16 # 0 if the env variable exists, 3 if it was set
17 #
18 function env_default() {
19- (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
20+ [[ ${parameters[$1]} = *-export* ]] && return 0
21 export "$1=$2" && return 3
22 }
23
24diff --git a/lib/misc.zsh b/lib/misc.zsh
25index 61571afc9cdde321bc5d2e686d95e4283cf2ec7c..a5d3af99869c87b0ba621baa30d12bdd5476732e 100644
26--- a/lib/misc.zsh
27+++ b/lib/misc.zsh
28@@ -3,15 +3,15 @@ autoload -Uz is-at-least
29 # *-magic is known buggy in some versions; disable if so
30 if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
31 for d in $fpath; do
32- if [[ -e "$d/url-quote-magic" ]]; then
33- if is-at-least 5.1; then
34- autoload -Uz bracketed-paste-magic
35- zle -N bracketed-paste bracketed-paste-magic
36- fi
37- autoload -Uz url-quote-magic
38- zle -N self-insert url-quote-magic
39- break
40- fi
41+ if [[ -e "$d/url-quote-magic" ]]; then
42+ if is-at-least 5.1; then
43+ autoload -Uz bracketed-paste-magic
44+ zle -N bracketed-paste bracketed-paste-magic
45+ fi
46+ autoload -Uz url-quote-magic
47+ zle -N self-insert url-quote-magic
48+ break
49+ fi
50 done
51 fi
52
53@@ -25,7 +25,7 @@ env_default 'LESS' '-R'
54 alias _='sudo '
55
56 ## more intelligent acking for ubuntu users
57-if which ack-grep &> /dev/null; then
58+if (( $+commands[ack-grep] )); then
59 alias afind='ack-grep -il'
60 else
61 alias afind='ack -il'
62diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh
63index 312ab22482176acf25bedd74276f6ce2f6048384..d5c22a8c547e84830416474544caefd106569fe0 100644
64--- a/lib/spectrum.zsh
65+++ b/lib/spectrum.zsh
66@@ -1,4 +1,3 @@
67-#! /bin/zsh
68 # A script to make using 256 colors in zsh less painful.
69 # P.C. Shyamshankar <sykora@lucentbeing.com>
70 # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
71@@ -6,32 +5,31 @@
72 typeset -AHg FX FG BG
73
74 FX=(
75- reset "%{[00m%}"
76- bold "%{[01m%}" no-bold "%{[22m%}"
77- italic "%{[03m%}" no-italic "%{[23m%}"
78- underline "%{[04m%}" no-underline "%{[24m%}"
79- blink "%{[05m%}" no-blink "%{[25m%}"
80- reverse "%{[07m%}" no-reverse "%{[27m%}"
81+ reset "%{[00m%}"
82+ bold "%{[01m%}" no-bold "%{[22m%}"
83+ italic "%{[03m%}" no-italic "%{[23m%}"
84+ underline "%{[04m%}" no-underline "%{[24m%}"
85+ blink "%{[05m%}" no-blink "%{[25m%}"
86+ reverse "%{[07m%}" no-reverse "%{[27m%}"
87 )
88
89 for color in {000..255}; do
90- FG[$color]="%{[38;5;${color}m%}"
91- BG[$color]="%{[48;5;${color}m%}"
92+ FG[$color]="%{[38;5;${color}m%}"
93+ BG[$color]="%{[48;5;${color}m%}"
94 done
95
96-
97-ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
98-
99 # Show all 256 colors with color number
100 function spectrum_ls() {
101+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
102 for code in {000..255}; do
103- print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
104+ print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
105 done
106 }
107
108 # Show all 256 colors where the background is set to specific color
109 function spectrum_bls() {
110+ local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
111 for code in {000..255}; do
112- print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
113+ print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}"
114 done
115 }