パスを設定して設定する
;;; neotree
;; emacs-memoize は、all-the-icons が依存している
;; 設定後初回起動は、M-x all-the-icons-install-fonts でフォントを DL する必要がある
;; -> ${HOME}/.local/share/fonts に保存される
;;
(setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/emacs-memoize") load-path))
(setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/all-the-icons") load-path))
(setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/emacs-neotree") load-path))
(use-package neotree
:init
(setq-default neo-keymap-style 'concise)
:config
(setq neo-smart-open t)
(setq neo-create-file-auto-open t)
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
(bind-key [f8] 'neotree-toggle)
(bind-key "RET" 'neotree-enter-hide neotree-mode-map)
(bind-key "a" 'neotree-hidden-file-toggle neotree-mode-map)
(bind-key "<left>" 'neotree-select-up-node neotree-mode-map)
(bind-key "<right>" 'neotree-change-root neotree-mode-map))
;; Change neotree's font size
;; Tips from https://github.com/jaypei/emacs-neotree/issues/218
(defun neotree-text-scale ()
"Text scale for neotree."
(interactive)
(text-scale-adjust 0)
(text-scale-decrease 1)
(message nil))
(add-hook 'neo-after-create-hook
(lambda (_)
(call-interactively 'neotree-text-scale)))
;; neotree enter hide
;; Tips from https://github.com/jaypei/emacs-neotree/issues/77
(defun neo-open-file-hide (full-path &optional arg)
"Open file and hiding neotree.
The description of FULL-PATH & ARG is in `neotree-enter'."
(neo-global--select-mru-window arg)
(find-file full-path)
(neotree-hide))
(defun neotree-enter-hide (&optional arg)
"Neo-open-file-hide if file, Neo-open-dir if dir.
The description of ARG is in `neo-buffer--execute'."
(interactive "P")
(neo-buffer--execute arg 'neo-open-file-hide 'neo-open-dir))