]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
lesskey, setup.sh: Don't store less' history in ~/.
authorSimon Ruderich <simon@ruderich.org>
Thu, 15 Nov 2012 16:20:05 +0000 (17:20 +0100)
committerSimon Ruderich <simon@ruderich.org>
Thu, 15 Nov 2012 16:20:05 +0000 (17:20 +0100)
.gitignore
lesskey
setup.sh

index caf69221639f471ff9e5a14bf599b9827385179a..5b546a13f9a7b02c60347aa1ac5e369b40d9dce5 100644 (file)
@@ -5,6 +5,7 @@
 /tmux.conf
 /tmux-window1.conf
 /tmux-window2.conf
-# Ignore temporary zsh files.
+# Ignore temporary files.
+/lesshistory
 /zsh/cache
 /zsh/history*
diff --git a/lesskey b/lesskey
index a5aac7aa36b4d9021f4a371f2a1fbd9fd7b725a7..da9ace4a191d7d9722c506e19dad4fbb169b580f 100644 (file)
--- a/lesskey
+++ b/lesskey
@@ -46,3 +46,7 @@ l right-scroll
 # ignore-case: Ignore case if the search string doesn't contain any uppercase
 #              letters.
 LESS = --no-init --search-skip-screen --quit-if-one-screen --RAW-CONTROL-CHARS --ignore-case
+
+# Store less' history file in this directory. HISTORY_PATH is replaced by
+# setup.sh because lesskey doesn't expand ~/.
+LESSHISTFILE = HISTORY_PATH
index a5af86b2e6321ab8848fd09582693fac2dee550c..041629f0d2bac00071b5c6d709ee33be08dda398 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -39,8 +39,17 @@ fi
 mkdir -p ~/.tmp
 chmod 0700 ~/.tmp
 
-# Generate ~/.less with lesskey.
-lesskey lesskey
+# Generate ~/.less with lesskey. Prevent cluttering ~/ by storing the history
+# file in this directory; this requires replacing the constant HISTORY_PATH in
+# lesskey.
+echo lesskey: generating .lesskey
+perl < lesskey \
+    -e 'while (<STDIN>) {
+            s/\bHISTORY_PATH\b/$ARGV[0]/;
+            print;
+        }' \
+    "`pwd`/lesshistory" \
+    | lesskey -
 chmod 0600 ~/.less
 
 # Find the required options to get colored ls output. GNU ls is preferred. See