こんな感じで neo-buffer--insert-fold-symbol
を再定義した.nerd-icons-icon-for-dir-with-chevron
は新規に作成した.
(defun neo-buffer--insert-fold-symbol (name &optional node-name)
"Write icon by NAME, the icon style affected by neo-theme.
`open' write opened folder icon.
`close' write closed folder icon.
`leaf' write leaf icon.
Optional NODE-NAME is used for the `icons' theme"
(let ((n-insert-image (lambda (n)
(insert-image (neo-buffer--get-icon n))))
(n-insert-symbol (lambda (n)
(neo-buffer--insert-with-face
n 'neo-expand-btn-face))))
(cond
((and (display-graphic-p) (equal neo-theme 'classic))
(or (and (equal name 'open) (funcall n-insert-image "open"))
(and (equal name 'close) (funcall n-insert-image "close"))
(and (equal name 'leaf) (funcall n-insert-image "leaf"))))
((equal neo-theme 'arrow)
(or (and (equal name 'open) (funcall n-insert-symbol "▾"))
(and (equal name 'close) (funcall n-insert-symbol "▸"))))
((equal neo-theme 'nerd)
(or (and (equal name 'open) (funcall n-insert-symbol "▾ "))
(and (equal name 'close) (funcall n-insert-symbol "▸ "))
(and (equal name 'leaf) (funcall n-insert-symbol " "))))
((and (display-graphic-p) (equal neo-theme 'icons))
(unless (require 'all-the-icons nil 'noerror)
(error "Package `all-the-icons' isn't installed"))
(setq-local tab-width 1)
(or (and (equal name 'open) (insert (all-the-icons-icon-for-dir-with-chevron (directory-file-name node-name) "down")))
(and (equal name 'close) (insert (all-the-icons-icon-for-dir-with-chevron (directory-file-name node-name) "right")))
(and (equal name 'leaf) (insert (format "\t\t\t%s\t" (all-the-icons-icon-for-file node-name))))))
((and (display-graphic-p) (equal neo-theme 'nerd-icons))
(unless (require 'nerd-icons nil 'noerror)
(error "Package `nerd-icons' isn't installed"))
(setq-local tab-width 1)
(or (and (equal name 'open) (insert (nerd-icons-icon-for-dir-with-chevron (directory-file-name node-name) "down")))
(and (equal name 'close) (insert (nerd-icons-icon-for-dir-with-chevron (directory-file-name node-name) "right")))
(and (equal name 'leaf) (insert (format "\t\t\t\t%s\t" (nerd-icons-icon-for-file node-name))))))
(t
(or (and (equal name 'open) (funcall n-insert-symbol "- "))
(and (equal name 'close) (funcall n-insert-symbol "+ ")))))))
(defun nerd-icons-icon-for-dir-with-chevron (dir &optional chevron padding)
"Format an icon for DIR with CHEVRON similar to tree based directories.
If PADDING is provided, it will prepend and separate the chevron
and directory with PADDING.
Produces different symbols by inspecting DIR to distinguish
symlinks and git repositories which do not depend on the
directory contents"
(let ((icon (nerd-icons-icon-for-dir dir))
(chevron (if chevron (nerd-icons-octicon (format "nf-oct-chevron_%s" chevron) :height 0.8 :v-adjust -0.1) ""))
(padding (or padding "\t")))
(format "%s%s%s%s%s" padding chevron padding icon padding)))
あとは
(setq neo-theme 'nerd-icons)
としておけばOK. 当然,nerd-icons はインストールしておくこと.
余談
nerd fontsの検索に便利なサイト
www.nerdfonts.com
追記
今回の記事の後にほぼ同じ修正を施したプルリクを見つけた。
github.com
追記2
上記プルリクはその後、マージされた。