emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

In the Fig, I see that buffers are shown in the top. How to set for that? #119

Closed Ra1nyHouse closed 6 years ago

ShingoFukuyama commented 6 years ago

That is a tabbar-mode, and here is my rough settings. Tab styles, and [Ctrl-TAB / Ctrl-Shift-TAB] to switch buffers.

(setq my-key-c-tab (kbd "<C-tab>"))

(when (require 'tabbar nil t)
  (tabbar-mode 1)
  (global-set-key my-key-c-tab 'tabbar-forward-tab)
  (global-set-key (kbd "<C-S-tab>") 'tabbar-backward-tab)
  (global-set-key (kbd "<C-S-iso-lefttab>") 'tabbar-backward-tab)
  (tabbar-mwheel-mode nil)
  (setq tabbar-buffer-groups-function nil)
  (dolist (btn '(tabbar-buffer-home-button
                 tabbar-scroll-left-button
                 tabbar-scroll-right-button))
    (set btn (cons (cons "" nil)
                   (cons "" nil))))
  (setq tabbar-separator '(1.3))
  (setq tabbar-auto-scroll-flag t)

  (defadvice tabbar-face-condition (around my-tabbar-face-condition activate)
    (setq ad-return-value
          (cond ((tabbar-selected-p (ad-get-arg 0) (tabbar-current-tabset))
                 'tabbar-selected)
                ((tabbar-modified-p (ad-get-arg 0) (tabbar-current-tabset))
                 'tabbar-modified)
                ((eq 'dired-mode
                     (with-current-buffer (tabbar-tab-value (ad-get-arg 0)) major-mode))
                 (:background "#ff9900"))
                (t 'tabbar-unselected))))
  (progn
    (ad-disable-advice 'tabbar-face-condition 'around 'my-tabbar-face-condition)
    (ad-activate 'tabbar-face-condition))

  (defun my-tabbar-color ()
    (set-face-attribute
     'tabbar-default nil
     :family "Ricty Diminished"
     :background "black"
     :foreground "gray32"
     :height 0.8)
    (set-face-attribute
     'tabbar-unselected nil
     :background "black"
     :foreground "grey80"
     :box nil)
    (set-face-attribute
     'tabbar-modified nil
     :background "#eeee00"
     :foreground "#000000"
     :box nil)
    (set-face-attribute
     'tabbar-selected nil
     :background "#90f050"
     :foreground "gray10"
     :bold 0
     :height 1.2
     :box nil)
    (set-face-attribute
     'tabbar-button nil
     :box nil)
    (set-face-attribute
     'tabbar-separator nil
     :height 0.9))
  (add-hook 'after-init-hook 'my-tabbar-color t)

  (defvar my-tabbar-displayed-buffers
    '("*scratch*" "*Backtrace*" "*Colors*" "*Faces*"
      "*vc-" "*magit" "*ag search")
    "*Regexps matches buffer names always included tabs.")
  (defvar my-tabber-eliminate-major-mode
    '(
      ;;direx:direx-mode
      snippet-mode
      ))
  (defun my-tabbar-buffer-list ()
    "Return the list of buffers to show in tabs.
Exclude buffers that name starts with a space or an asterisk.
The current buffer and buffers matches `my-tabbar-displayed-buffers'
are always included."
    (let* ((hides (list ?\  ?\*))
           (re (regexp-opt my-tabbar-displayed-buffers))
           (cur-buf (current-buffer))
           (tabs (delq nil
                       (mapcar (lambda (buf)
                                 (let ((name (buffer-name buf)))
                                   (when (or (string-match re name)
                                             (not (memq (aref name 0) hides)))
                                     (unless (memq (with-current-buffer buf major-mode)
                                                   my-tabber-eliminate-major-mode)
                                       buf))))
                               (buffer-list)))))
    ;;; Always include the current buffer.
      (if (memq cur-buf tabs)
          tabs
        (cons cur-buf tabs))))
  (setq tabbar-buffer-list-function 'my-tabbar-buffer-list)
)