dired-subtreeもシマシマにしたい

dired-subtreeもシマシマにしたい

diredのサブディレクトリがひどい

dired使いなら、 一度ならずもサブディレクトリの扱いに疑問を感じた方は多いのではないでしょうか。

GNU Emacsマニュアル: Subdirectories in Dired

dired-maybe-insert-subdir などデフォルトでサブディレクトリを操作する関数もありますが、何せ表示されるのは、バッファの下の方で非常に見にくいです。階層構造がわかりにくいのもつらいし、ほとんど使ったことはありませんでした。

dired-subtreeは便利だけど

dired-subtree はdired標準のサブディレクトリにあった不満を解消してくれる素敵拡張です。

Fuco1/dired-hacks

いろいろと紹介もされていますので、詳しくはそちらを参照のこと。

emacs dired-subtree.el : 【更新】 diredがディレクトリツリーエディタに進化!dired-detailsにも対応 | MELPA Emacs Lisp Elisp パッケージ インストール 設定 使い方 スクリーンショット | るびきち「日刊Emacs」

Emacs – diredをより便利にするツール群 dired-hacks – Qiita

ところで、diredでは行の視認性を良くするために stripe-buffer を使わせてもらってます。 stripe-buffer については、以前紹介していますので、そちらを見てみてください。

DiredやOrg-modeのテーブルをシマシマにするstripe-bufferの紹介 – sheephead

この stripe-bufferdired-subtree を併用すると、なんだか悲しい感じになってしまいます。

screenshot_2015-03-01_13:44:03.png

stripe-buffer のシマシマが階層構造なぞお構いなしにシマシマにしてしまうので、階層がわかりにくくなってしまいます。

subtreeもシマシマにしてみる

せっかくなので、下の階層も階層構造に応じてシマシマにしたいですね。

というわけで、 stripe-buffer に少し手を加えてみました。

myuhe/stripe-buffer at subtree_support

作者にぷるりくも出しているので、もしかしたら、取りこんでもらえるかもしれません。

このブランチを使って、faceを良い塩梅にするとこんな感じになります。

screenshot_2015-03-01_14:00:40.png

faceの設定はこんな感じです。

(with-eval-after-load 'dired-subtree
  (set-face-attribute 'dired-subtree-depth-1-face nil :background "#B4C342")
  (set-face-attribute 'dired-subtree-depth-2-face nil :background "#F2804F")
  (set-face-attribute 'dired-subtree-depth-3-face nil :background "#9EA0E5")
  (set-face-attribute 'dired-subtree-depth-4-face nil :background "#DEB542")
  (set-face-attribute 'dired-subtree-depth-5-face nil :background "#657b83")
  (set-face-attribute 'dired-subtree-depth-6-face nil :background "#657b83"))

(with-eval-after-load 'stripe-buffer 
  (set-face-attribute 'stripe-dired-subtree-depth-1-face nil :background "#cbd57c")
  (set-face-attribute 'stripe-dired-subtree-depth-2-face nil :background "#f7b396")
  (set-face-attribute 'stripe-dired-subtree-depth-3-face nil :background "#dadbf5")
  (set-face-attribute 'stripe-dired-subtree-depth-4-face nil :background "#e9cf83")
  (set-face-attribute 'stripe-dired-subtree-depth-5-face nil :background "#657b83")
  (set-face-attribute 'stripe-dired-subtree-depth-6-face nil :background "#657b83"))

stripe-bufferdired-subtree を併用している人しかおいしくないニッチなハックでしたが、悩めるdirederのdiredバッファがカラフルなシマシマになれば幸いです。