jaypei / emacs-neotree

A emacs tree plugin like NerdTree for Vim.
GNU General Public License v3.0
1.56k stars 147 forks source link

[feature] support directory paths collapsed #339

Closed zsxh closed 1 year ago

zsxh commented 3 years ago

WARNING: Do Not Merge

I think this might fix the issue https://github.com/jaypei/emacs-neotree/issues/147. If anyone can test.

for doom theme neotree

(defun doom-themes-neotree-insert-dir (node depth expanded &optional short-name)
    (let ((short-name (or short-name (neo-path--file-short-name node)))
          (faces '(doom-themes-neotree-dir-face))
          icon-text)
      ;; insert indentation
      (insert-char ?\s (* (- depth 1) 2))
      ;; vcs integration
      (let ((vc (if neo-vc-integration (neo-vc-for-node node))))
        (when (memq 'char neo-vc-integration)
          (insert-char (car vc))
          (insert-char ?\s))
        (unless (and (memq 'face neo-vc-integration)
                     (not (eq (cdr vc) 'neo-vc-up-to-date-face))
                     (setq faces (list (cdr vc))))
          (cl-destructuring-bind (&key face icon)
              (doom-themes-neotree-spec node doom-themes-neotree-dir-rules)
            (if face (push face faces))
            (if icon (setq icon-text icon)))))
      ;; insert icon
      (let ((type (if expanded 'open 'close)))
        (if (display-graphic-p)
            (doom--neotree-insert-icon type node icon-text faces)
          (neo-buffer--insert-fold-symbol type node)))
      ;; insert label button
      (when doom-themes-neotree-enable-variable-pitch
        (push 'variable-pitch faces))
      (insert-button short-name
                     'follow-link t
                     'face `(:inherit (,@faces))
                     'neo-full-path node
                     'keymap neotree-dir-button-keymap)
      ;; metadata + newline
      (neo-buffer--node-list-set nil node)
      (neo-buffer--newline-and-begin)))