ff823f810b38cd761ac3f65162065ad613b6e25d

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #3564 from mcornella/LFDM-cleaning_lib

Repost #2422: cleaning lib

Diff

  1diff --git a/lib/aliases.zsh b/lib/aliases.zsh
  2deleted file mode 100644
  3index aae865046ef6ea7467deb675a5cbd82bfdac9a94..0000000000000000000000000000000000000000
  4--- a/lib/aliases.zsh
  5+++ /dev/null
  6@@ -1,35 +0,0 @@
  7-# Push and pop directories on directory stack
  8-alias pu='pushd'
  9-alias po='popd'
 10-
 11-# Basic directory operations
 12-alias ...='cd ../..'
 13-alias -- -='cd -'
 14-
 15-# Super user
 16-alias _='sudo'
 17-alias please='sudo'
 18-
 19-#alias g='grep -in'
 20-
 21-# Show history
 22-if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
 23-then
 24-    alias history='fc -fl 1'
 25-elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
 26-then
 27-    alias history='fc -El 1'
 28-elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
 29-then
 30-    alias history='fc -il 1'
 31-else
 32-    alias history='fc -l 1'
 33-fi
 34-# List direcory contents
 35-alias lsa='ls -lah'
 36-alias l='ls -lah'
 37-alias ll='ls -lh'
 38-alias la='ls -lAh'
 39-
 40-alias afind='ack-grep -il'
 41-
 42diff --git a/lib/directories.zsh b/lib/directories.zsh
 43index 02743e0c78130bb05f7150cd3ade0a14b98c7831..1a9698544d8802ea0b06ea11a0aba009826f9399 100644
 44--- a/lib/directories.zsh
 45+++ b/lib/directories.zsh
 46@@ -3,12 +3,10 @@ setopt auto_pushd
 47 setopt pushd_ignore_dups
 48 setopt pushdminus
 49 
 50-alias ..='cd ..'
 51-alias cd..='cd ..'
 52-alias cd...='cd ../..'
 53-alias cd....='cd ../../..'
 54-alias cd.....='cd ../../../..'
 55-alias cd/='cd /'
 56+alias -g ...='../..'
 57+alias -g ....='../../..'
 58+alias -g .....='../../../..'
 59+alias -g ......='../../../../..'
 60 
 61 alias 1='cd -'
 62 alias 2='cd -2'
 63@@ -20,23 +18,16 @@ alias 7='cd -7'
 64 alias 8='cd -8'
 65 alias 9='cd -9'
 66 
 67-cd () {
 68-  if   [[ "x$*" == "x..." ]]; then
 69-    cd ../..
 70-  elif [[ "x$*" == "x...." ]]; then
 71-    cd ../../..
 72-  elif [[ "x$*" == "x....." ]]; then
 73-    cd ../../../..
 74-  elif [[ "x$*" == "x......" ]]; then
 75-    cd ../../../../..
 76-  elif [ -d ~/.autoenv ]; then
 77-    source ~/.autoenv/activate.sh
 78-    autoenv_cd "$@"
 79-  else
 80-    builtin cd "$@"
 81-  fi
 82-}
 83-
 84 alias md='mkdir -p'
 85 alias rd=rmdir
 86 alias d='dirs -v | head -10'
 87+
 88+# List directory contents
 89+alias lsa='ls -lah'
 90+alias l='ls -la'
 91+alias ll='ls -l'
 92+alias la='ls -lA'
 93+
 94+# Push and pop directories on directory stack
 95+alias pu='pushd'
 96+alias po='popd'
 97diff --git a/lib/history.zsh b/lib/history.zsh
 98index e78a98e9e8da4e9a11d101dfa6fa1ffd7e9f9c32..5de71c2d3e0fdd0296cc8d46da9fbd1724fd7a00 100644
 99--- a/lib/history.zsh
100+++ b/lib/history.zsh
101@@ -6,6 +6,15 @@ fi
102 HISTSIZE=10000
103 SAVEHIST=10000
104 
105+# Show history
106+case $HIST_STAMPS in
107+  "mm/dd/yyyy") alias history='fc -fl 1' ;;
108+  "dd.mm.yyyy") alias history='fc -El 1' ;;
109+  "yyyy-mm-dd") alias history='fc -il 1' ;;
110+  *) alias history='fc -l 1' ;;
111+esac
112+
113+setopt append_history
114 setopt extended_history
115 setopt hist_expire_dups_first
116 setopt hist_ignore_dups # ignore duplication command history list
117diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
118index 9063c6a18c2778056832654e5a300b25ec32a084..eb2b58058cee10471175530ee3fa67bb04436543 100644
119--- a/lib/key-bindings.zsh
120+++ b/lib/key-bindings.zsh
121@@ -64,6 +64,9 @@ autoload -U edit-command-line
122 zle -N edit-command-line
123 bindkey '\C-x\C-e' edit-command-line
124 
125+# file rename magick
126+bindkey "^[m" copy-prev-shell-word
127+
128 # consider emacs keybindings:
129 
130 #bindkey -e  ## emacs key bindings
131diff --git a/lib/misc.zsh b/lib/misc.zsh
132index a8678b8ecd0185d66500e79bab39224676def2a6..ea8a05fcb98b78190aea0cfae1ba290ee04b16be 100644
133--- a/lib/misc.zsh
134+++ b/lib/misc.zsh
135@@ -2,9 +2,6 @@
136 autoload -U url-quote-magic
137 zle -N self-insert url-quote-magic
138 
139-## file rename magick
140-bindkey "^[m" copy-prev-shell-word
141-
142 ## jobs
143 setopt long_list_jobs
144 
145@@ -13,3 +10,10 @@ export PAGER="less"
146 export LESS="-R"
147 
148 export LC_CTYPE=$LANG
149+
150+## super user alias
151+alias _='sudo'
152+alias please='sudo'
153+
154+## more intelligent acking for ubuntu users
155+alias afind='ack-grep -il'
156diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
157index 0353f9db4d1c5ac973264132c316fde2dc084cf7..926303ca4509cd89bbc30187fd99879c1fbeb771 100644
158--- a/lib/theme-and-appearance.zsh
159+++ b/lib/theme-and-appearance.zsh
160@@ -1,14 +1,13 @@
161 # ls colors
162-autoload colors; colors;
163+autoload -U colors && colors
164 export LSCOLORS="Gxfxcxdxbxegedabagacad"
165-#export LS_COLORS
166 
167 # Enable ls colors
168 if [ "$DISABLE_LS_COLORS" != "true" ]
169 then
170   # Find the option for using colors in ls, depending on the version: Linux or BSD
171   if [[ "$(uname -s)" == "NetBSD" ]]; then
172-    # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); 
173+    # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
174     # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
175     gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
176   elif [[ "$(uname -s)" == "OpenBSD" ]]; then
177@@ -23,7 +22,7 @@ fi
178 #setopt no_beep
179 setopt auto_cd
180 setopt multios
181-setopt cdablevarS
182+setopt cdablevars
183 
184 if [[ x$WINDOW != x ]]
185 then
186@@ -43,4 +42,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN=""               # Text to display if the branch is c
187 
188 # Setup the prompt with pretty colors
189 setopt prompt_subst
190-
191diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
192index ca5666979cd7de508643295b7625835643847e8a..a8271849e3004255b2acb29b6cdefa089e917ddb 100644
193--- a/plugins/autoenv/autoenv.plugin.zsh
194+++ b/plugins/autoenv/autoenv.plugin.zsh
195@@ -1,6 +1,17 @@
196+# Activates autoenv or reports its failure
197+if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
198+  echo '-------- AUTOENV ---------'
199+  echo 'Could not find ~/.autoenv/activate.sh.'
200+  echo 'Please check if autoenv is correctly installed.'
201+  echo 'In the meantime the autoenv plugin is DISABLED.'
202+  echo '--------------------------'
203+  return 1
204+fi
205+
206 # The use_env call below is a reusable command to activate/create a new Python
207 # virtualenv, requiring only a single declarative line of code in your .env files.
208 # It only performs an action if the requested virtualenv is not the current one.
209+
210 use_env() {
211     typeset venv
212     venv="$1"
213diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
214index 90d59910c794e7a893281e0c6096be81881c3916..e3830adcf9566f5bc6c944dd3d022a6a35707cc5 100644
215--- a/plugins/common-aliases/common-aliases.plugin.zsh
216+++ b/plugins/common-aliases/common-aliases.plugin.zsh
217@@ -20,12 +20,6 @@ alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
218 
219 alias t='tail -f'
220 
221-# because typing 'cd' is A LOT of work!!
222-alias ..='cd ../'
223-alias ...='cd ../../'
224-alias ....='cd ../../../'
225-alias .....='cd ../../../../'
226-
227 # Command line head / tail shortcuts
228 alias -g H='| head'
229 alias -g T='| tail'
230diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
231index 01b8a88d921247bc43d5e003956ffb4fefa2dd53..d868a5fe1d1bf6b6117db674b093d1a632f5d0d7 100644
232--- a/plugins/git-prompt/git-prompt.plugin.zsh
233+++ b/plugins/git-prompt/git-prompt.plugin.zsh
234@@ -2,9 +2,6 @@
235 # http://github.com/olivierverdier/zsh-git-prompt
236 #
237 export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
238-# Initialize colors.
239-autoload -U colors
240-colors
241 
242 # Allow for functions in the prompt.
243 setopt PROMPT_SUBST
244diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
245index b16814fe4d12b9935a046e745ab46169090c3446..d082c11e54280c392846ef8800545ef9d01a0644 100644
246--- a/plugins/jump/jump.plugin.zsh
247+++ b/plugins/jump/jump.plugin.zsh
248@@ -27,7 +27,6 @@ unmark() {
249 	rm -i "$MARKPATH/$1"
250 }
251 
252-autoload colors
253 marks() {
254 	for link in $MARKPATH/*(@); do
255 		local markname="$fg[cyan]${link:t}$reset_color"
256diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
257index 6869c8a20ae20203ded67bd33f1ee987af09bd19..212b823a5c95c3a8bd64f39480fb7b9ab6d2be25 100644
258--- a/themes/adben.zsh-theme
259+++ b/themes/adben.zsh-theme
260@@ -69,17 +69,17 @@ function precmd {
261         #Choose from all databases, regardless of whether they are considered "offensive"
262         fortune -a
263     }
264-    #obtains the tip 
265+    #obtains the tip
266     ps1_command_tip () {
267         wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
268-    }  
269+    }
270     prompt_header () {
271         if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
272             ps1_command_tip
273         else
274             ps1_fortune
275-        fi 
276-    }   
277+        fi
278+    }
279     PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
280     # set a simple variable to show when in screen
281     if [[ -n "${WINDOW}" ]]; then
282@@ -99,11 +99,8 @@ prompt_context () {
283 set_prompt () {
284     # required for the prompt
285     setopt prompt_subst
286-    autoload colors zsh/terminfo
287-    if [[ "$terminfo[colors]" -gt 8 ]]; then
288-        colors
289-    fi 
290-    
291+    autoload zsh/terminfo
292+
293     # ######### PROMPT #########
294     PROMPT='${PROMPT_HEAD}
295 ${RED_START}$(prompt_context)
296diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme
297index 275341dc67a8d85caafe92d78ab414787f104cdc..95e6249fa897a46ab12c80b9b3f18b99dc1f0ba7 100644
298--- a/themes/apple.zsh-theme
299+++ b/themes/apple.zsh-theme
300@@ -7,7 +7,6 @@ get_git_dirty() {
301 }
302 
303 autoload -Uz vcs_info
304-autoload -U colors && colors
305 zstyle ':vcs_info:*' check-for-changes true
306 zstyle ':vcs_info:*' unstagedstr '%F{red}*'   # display this when there are unstaged changes
307 zstyle ':vcs_info:*' stagedstr '%F{yellow}+'  # display this when there are staged changes
308diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
309index 0519fbefb4150397be44d164cb6c93edcc8d9470..ab154c1e5cbc8a5cdbd014a11c2967449d591530 100644
310--- a/themes/gnzh.zsh-theme
311+++ b/themes/gnzh.zsh-theme
312@@ -2,8 +2,7 @@
313 # Based on bira theme
314 
315 # load some modules
316-autoload -U colors zsh/terminfo # Used in the colour alias below
317-colors
318+autoload -U zsh/terminfo # Used in the colour alias below
319 setopt prompt_subst
320 
321 # make some aliases for the colours: (could use normal escape sequences too)
322diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme
323index 942affa94dc3a746ff8895048cb151abd303af64..a3c50570626f8011d4677925ace04929788d4041 100644
324--- a/themes/half-life.zsh-theme
325+++ b/themes/half-life.zsh-theme
326@@ -13,8 +13,6 @@ function virtualenv_info {
327 PR_GIT_UPDATE=1
328 
329 setopt prompt_subst
330-autoload colors
331-colors
332 
333 autoload -U add-zsh-hook
334 autoload -Uz vcs_info
335diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
336index bca92970c48f63748e4df10b92d1c43fe6386d18..2f0e774315dbb31564ae8d43c5466d1f361c4ec4 100644
337--- a/themes/jonathan.zsh-theme
338+++ b/themes/jonathan.zsh-theme
339@@ -44,10 +44,7 @@ setprompt () {
340     ###
341     # See if we can use colors.
342 
343-    autoload colors zsh/terminfo
344-    if [[ "$terminfo[colors]" -ge 8 ]]; then
345-	colors
346-    fi
347+    autoload zsh/terminfo
348     for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
349 	eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
350 	eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
351diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme
352index e743289c35aff6561f519b4702c5b070df08320a..51b0af724aff06735f0aef28381d9787e03f6e94 100644
353--- a/themes/kolo.zsh-theme
354+++ b/themes/kolo.zsh-theme
355@@ -1,5 +1,3 @@
356-autoload -U colors && colors
357-
358 autoload -Uz vcs_info
359 
360 zstyle ':vcs_info:*' stagedstr '%F{green}●'
361diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme
362index 943f04d389ccee2883584b8c55b9518126d3b4a4..a95383ba56d356b0fed972229468ca1673adaea4 100644
363--- a/themes/mikeh.zsh-theme
364+++ b/themes/mikeh.zsh-theme
365@@ -1,6 +1,4 @@
366 setopt prompt_subst
367-autoload colors
368-colors
369 
370 autoload -U add-zsh-hook
371 autoload -Uz vcs_info
372diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme
373index fb4d32e2419a42d759af0bc224912c68c7b9117b..63ce4261bf61348a01c3cdb2526b638c563f3602 100644
374--- a/themes/simonoff.zsh-theme
375+++ b/themes/simonoff.zsh-theme
376@@ -63,10 +63,7 @@ setprompt () {
377 ###
378 # See if we can use colors.
379 
380-    autoload colors zsh/terminfo
381-    if [[ "$terminfo[colors]" -ge 8 ]]; then
382-    colors
383-    fi
384+    autoload zsh/terminfo
385     for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
386     eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
387     eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
388diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme
389index e38188d353daafe1d7673719b9a99c9fe78aa87c..13728ca9a9b95fe7bcef160ef5e01f1d2ec3a3b0 100644
390--- a/themes/steeef.zsh-theme
391+++ b/themes/steeef.zsh-theme
392@@ -15,8 +15,6 @@ function virtualenv_info {
393 PR_GIT_UPDATE=1
394 
395 setopt prompt_subst
396-autoload colors
397-colors
398 
399 autoload -U add-zsh-hook
400 autoload -Uz vcs_info
401diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme
402index 5c085473002a5decae40d9cc7dec78beb5cdf586..27597ec6ce6de3720b58e722c6d3a1f108867285 100644
403--- a/themes/zhann.zsh-theme
404+++ b/themes/zhann.zsh-theme
405@@ -1,5 +1,3 @@
406-autoload -U colors && colors
407-
408 autoload -Uz vcs_info
409 
410 zstyle ':vcs_info:*' stagedstr '%F{green}●'