From f28e16a15856baf92163dba8ac6eec1e02cf6c1f Mon Sep 17 00:00:00 2001
From: Lindolfo 'Lorn' Rodrigues <lorn@lornlab.org>
Date: Tue, 30 Apr 2013 01:51:09 -0300
Subject: Cache for fasd --init

Using cache technique for faster fasd --init as shown at:
 https://github.com/clvv/fasdi#install
---
 plugins/fasd/fasd.plugin.zsh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'plugins/fasd/fasd.plugin.zsh')

diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
index d42584f1a..8ad43fc23 100644
--- a/plugins/fasd/fasd.plugin.zsh
+++ b/plugins/fasd/fasd.plugin.zsh
@@ -1,5 +1,10 @@
 if [ $commands[fasd] ]; then # check if fasd is installed
-  eval "$(fasd --init auto)"
+  fasd_cache="$HOME/.fasd-init-cache"
+  if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
+    fasd --init auto >| "$fasd_cache"
+  fi
+  source "$fasd_cache"
+  unset fasd_cache
   alias v='f -e vim'
   alias o='a -e open'
 fi
-- 
cgit v1.2.3-70-g09d2