2018-06-09 12:16:29 +10:00
|
|
|
;;; ui/treemacs/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2018-07-10 23:05:01 +02:00
|
|
|
(setq treemacs-follow-after-init t
|
2018-06-10 23:16:50 +02:00
|
|
|
treemacs-width 35
|
|
|
|
treemacs-position 'left
|
|
|
|
treemacs-is-never-other-window t
|
|
|
|
treemacs-silent-refresh nil
|
|
|
|
treemacs-indentation 2
|
|
|
|
treemacs-sorting 'alphabetic-desc
|
|
|
|
treemacs-show-hidden-files t
|
2018-06-14 14:01:25 +02:00
|
|
|
treemacs-goto-tag-strategy 'refetch-index
|
2018-08-03 19:15:46 +02:00
|
|
|
treemacs-display-in-side-window t
|
2018-06-14 14:01:25 +02:00
|
|
|
treemacs-persist-file (concat doom-cache-dir "treemacs-persist"))
|
2018-06-10 23:16:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
(after! treemacs
|
2018-08-03 19:15:46 +02:00
|
|
|
(set-popup-rule! "^ \\*Treemacs"
|
|
|
|
:side treemacs-position
|
|
|
|
:size treemacs-width
|
|
|
|
:quit nil
|
|
|
|
:ttl 0)
|
|
|
|
|
2018-06-10 23:16:50 +02:00
|
|
|
(defvar +treemacs-use-git-mode
|
|
|
|
(pcase (cons (not (null (executable-find "git")))
|
|
|
|
(not (null (executable-find "python3"))))
|
|
|
|
(`(t . t) 'extended)
|
2018-08-06 13:20:46 +02:00
|
|
|
(`(t) 'simple))
|
2018-06-10 23:16:50 +02:00
|
|
|
"Type of git integration for `treemacs-git-mode'.
|
2018-06-09 12:16:29 +10:00
|
|
|
There are 2 possible values:
|
|
|
|
1) simple, which highlights only files based on their git status, and is
|
|
|
|
slightly faster
|
|
|
|
2) extended, which highlights both files and directories, but requires python")
|
|
|
|
|
2018-06-10 23:16:50 +02:00
|
|
|
(defvar treemacs-collapse-dirs
|
|
|
|
(if (executable-find "python3") 3 0))
|
|
|
|
|
2018-08-28 13:30:51 +02:00
|
|
|
(defun +treemacs|improve-hl-line-contrast ()
|
|
|
|
"`hl-line' doesn't stand out enough in some themes."
|
|
|
|
(face-remap-add-relative 'hl-line 'region))
|
|
|
|
(add-hook 'treemacs-mode-hook #'+treemacs|improve-hl-line-contrast)
|
|
|
|
|
2018-07-19 03:38:52 +02:00
|
|
|
(treemacs-follow-mode -1)
|
2018-06-09 12:16:29 +10:00
|
|
|
(treemacs-filewatch-mode t)
|
2018-06-10 23:16:50 +02:00
|
|
|
(when (memq +treemacs-use-git-mode '(simple extended))
|
2018-07-10 23:06:26 +02:00
|
|
|
(treemacs-git-mode +treemacs-use-git-mode)))
|
2018-06-09 12:16:29 +10:00
|
|
|
|
|
|
|
|
|
|
|
(def-package! treemacs-evil
|
2018-06-10 23:16:50 +02:00
|
|
|
:when (featurep! :feature evil +everywhere)
|
2018-06-11 00:11:20 +02:00
|
|
|
:after treemacs
|
2018-09-27 18:16:21 -04:00
|
|
|
:config
|
|
|
|
;; FIXME Remove this when general.el is in
|
|
|
|
(set-evil-initial-state! 'treemacs-mode 'normal)
|
|
|
|
(map! :map treemacs-mode-map
|
|
|
|
:n "?" #'treemacs-helpful-hydra
|
|
|
|
:n [mouse-1] #'treemacs-leftclick-action
|
|
|
|
:n [double-mouse-1] #'treemacs-doubleclick-action
|
|
|
|
:n [tab] #'treemacs-TAB-action
|
|
|
|
:n [?\t] #'treemacs-TAB-action
|
|
|
|
:n [return] #'treemacs-RET-action
|
|
|
|
:n "RET" #'treemacs-RET-action
|
|
|
|
:n "r" #'treemacs-refresh
|
|
|
|
:n "d" #'treemacs-delete
|
|
|
|
:n "cf" #'treemacs-create-file
|
|
|
|
:n "cd" #'treemacs-create-dir
|
|
|
|
:n "R" #'treemacs-rename
|
|
|
|
:n "u" #'treemacs-goto-parent-node
|
|
|
|
:n "q" #'bury-buffer
|
|
|
|
:n "Q" #'treemacs-kill-buffer
|
|
|
|
:n "ov" #'treemacs-visit-node-vertical-split
|
|
|
|
:n "oh" #'treemacs-visit-node-horizontal-split
|
|
|
|
:n "oo" #'treemacs-visit-node-no-split
|
|
|
|
:n "oaa" #'treemacs-visit-node-ace
|
|
|
|
:n "oah" #'treemacs-visit-node-ace-horizontal-split
|
|
|
|
:n "oav" #'treemacs-visit-node-ace-vertical-split
|
|
|
|
:n "ox" #'treemacs-visit-node-in-external-application
|
|
|
|
:n "P" #'treemacs-peek
|
|
|
|
:n "n" #'treemacs-next-line
|
|
|
|
:n "p" #'treemacs-previous-line
|
|
|
|
:n "M-N" #'treemacs-next-line-other-window
|
|
|
|
:n "M-P" #'treemacs-previous-line-other-window
|
|
|
|
:n "<prior>" #'treemacs-previous-page-other-window
|
|
|
|
:n "<next>" #'treemacs-next-page-other-window
|
|
|
|
:n "M-n" #'treemacs-next-neighbour
|
|
|
|
:n "M-p" #'treemacs-previous-neighbour
|
|
|
|
:n "th" #'treemacs-toggle-show-dotfiles
|
|
|
|
:n "tw" #'treemacs-toggle-fixed-width
|
|
|
|
:n "tv" #'treemacs-fringe-indicator-mode
|
|
|
|
:n "tg" #'treemacs-git-mode
|
|
|
|
:n "tf" #'treemacs-follow-mode
|
|
|
|
:n "ta" #'treemacs-filewatch-mode
|
|
|
|
:n "w" #'treemacs-set-width
|
|
|
|
:n "yy" #'treemacs-copy-path-at-point
|
|
|
|
:n "yr" #'treemacs-copy-project-root
|
|
|
|
:n "s" #'treemacs-resort
|
|
|
|
:n "b" #'treemacs-add-bookmark
|
|
|
|
:n "C-p r" #'treemacs-rename-project
|
|
|
|
:n "C-p a" #'treemacs-add-project-to-workspace
|
|
|
|
:n "C-p d" #'treemacs-remove-project-from-workspace
|
|
|
|
:n "C-p c c" #'treemacs-collapse-project
|
|
|
|
:n "C-p c o" #'treemacs-collapse-other-projects
|
|
|
|
:n "C-p c a" #'treemacs-collapse-all-projects
|
|
|
|
:n "<backtab>" #'treemacs-collapse-all-projects
|
|
|
|
:n "C-j" #'treemacs-next-project
|
|
|
|
:n "C-k" #'treemacs-previous-project
|
|
|
|
:n "h" #'treemacs-root-up
|
|
|
|
:n "l" #'treemacs-root-down
|
|
|
|
:n [escape] #'delete-window
|
|
|
|
:n "j" #'treemacs-next-line
|
|
|
|
:n "k" #'treemacs-previous-line
|
|
|
|
:n "M-j" #'treemacs-next-neighbour
|
|
|
|
:n "M-k" #'treemacs-previous-neighbour
|
|
|
|
:n "M-J" #'treemacs-next-line-other-window
|
|
|
|
:n "M-K" #'treemacs-previous-line-other-window
|
|
|
|
:n "th" #'treemacs-toggle-show-dotfiles
|
|
|
|
:n "tw" #'treemacs-toggle-fixed-width
|
|
|
|
:n "tv" #'treemacs-fringe-indicator-mode
|
|
|
|
:n "tf" #'treemacs-follow-mode
|
|
|
|
:n "ta" #'treemacs-filewatch-mode
|
|
|
|
:n "tg" #'treemacs-git-mode
|
|
|
|
:n "w" #'treemacs-set-width
|
|
|
|
:n "b" #'treemacs-add-bookmark
|
|
|
|
:n "?" #'treemacs-helpful-hydra
|
|
|
|
:n "RET" #'treemacs-RET-action
|
|
|
|
:n "yr" #'treemacs-copy-project-root
|
|
|
|
:n "yy" #'treemacs-copy-path-at-point
|
|
|
|
:n "gr" #'treemacs-refresh
|
|
|
|
:n [down-mouse-1] #'ignore
|
|
|
|
:n "h" #'treemacs-root-up
|
|
|
|
:n "l" #'treemacs-root-down))
|
2018-06-10 23:16:50 +02:00
|
|
|
|
2018-06-09 12:16:29 +10:00
|
|
|
|
|
|
|
(def-package! treemacs-projectile
|
2018-06-10 23:16:50 +02:00
|
|
|
:after treemacs)
|