 ;; Contributers of ideas and/or code:
 ;;
 ;;; Change log:
+;; 20 12 2019 -- v1.1
+;;               support projectile
 ;;
 ;; 10 june 2018 -- v1.0
 ;;;                initial

            (eq (get major-mode 'derived-mode-parent)
                'comint-mode)
            (eq major-mode 'vterm-mode))))
    (buffer-list))
   (lambda (x y)
     (string< (buffer-name x) (buffer-name y)))))

(defun shell-header--shell-mode-buffer-list ()
  (mapcar
   (lambda (x)
     (let ((name (buffer-name x)))
       (if (eq name (buffer-name))
           (propertize
            (format "[%s]" name)
            'face
            `((:background
               ,(face-background 'mode-line-inactive))))
         (format "[%s]" name))))
   (shell-header--get-shell-buffer)))

(defun shell-header--header-line-setup ()
  (setq-local header-line-format

  :type  'symbol
  :group 'shell-header)

(defcustom shell-header-use-project-support t
  "support projectile"
  :type  'symbol
  :group 'shell-header)

(defun shell-header--get-current-buffer-list (&optional is-global)
  (if (or is-global (not shell-header-use-project-support))
      (buffer-list)
    ;; projectile buffer
    (if (and (require 'projectile nil t) (projectile-project-p))
        (projectile-project-buffers)
      (buffer-list))))

(defun shell-header--get-project-name ()
  (if (require 'projectile nil t)
      (projectile-project-name)
    ""))

(defun shell-header--get-shell-buffer (&optional is-global)
  (sort
   (remove-if-not
    (lambda (x)
