3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

direx-project + popwinで快適なディレクトリツリー環境を構築する

Last updated at Posted at 2019-04-08

Alt Text

Emacsでディレクトリツリーを使う意味

Vim使いのひとには、neotreeは親しみやすいと思うのですが、Emacsのdiredに慣れ親しんだ私には、次の作業のために不要になったtreeバファーをいちいち手動で閉じるというアクションは案外不便なのです。direxの場合は、diredのコンセプトを継承して作られているので、treeバファーから必要なファイルを選んで開くと自動的にtreeバッファーが隠れてくれてカレントバファーにファイルを展開してくれます。実際にEmacsで作業する手順を考えるとこの方が使いやすいと私は思うのです。

Direx-projectを使う

direxの作者は、popwinを開発された方でdirexは単独でも機能しますがpopwinと併用することでneotreeに勝るとも劣らない機能を提供してくれます。例によってパッチワークですが設定を公開します。特徴として以下の機能を持ちます。

  • フォルダー表示はビジュアルにしたいのでunicodeの絵文字を使う。
  • popwinを使うことで表示幅を自由に設定できる。
    toggle機能はありませんが、q または C−g で隠れてくれるので使い勝手が良いです。
  • project内にいるなら、direx-projectを起動し、そうでなければ普通にdirexを起動する。
    以下のTipsのパクリですが、これが気に入っています。
  • https://blog.shibayu36.org/entry/2013/02/12/191459

設定

;; direx
(use-package direx)
(setq direx:leaf-icon "  " direx:open-icon "📂" direx:closed-icon "📁")
(push '(direx:direx-mode :position left :width 35 :dedicated t)
      popwin:special-display-config)
;; use direx-project.el
;; https://blog.shibayu36.org/entry/2013/02/12/191459
(bind-key
 [f11]
 (defun direx:jump-to-project-directory ()
   "If in project, launch direx-project otherwise start direx."
  (interactive)
  (let ((result (ignore-errors
                  (direx-project:jump-to-project-root-other-window)
                  t)))
    (unless result
      (direx:jump-to-directory-other-window)))))
3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?