Last active
March 30, 2018 14:14
-
-
Save ShingoFukuyama/7245914 to your computer and use it in GitHub Desktop.
Configuration file.
tabbar.el github https://github.com/dholm/tabbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;tabbar github https://github.com/dholm/tabbar | |
;;http://d.hatena.ne.jp/tequilasunset/20110103/p1 | |
;;http://d.hatena.ne.jp/plasticster/20110825/1314271209 | |
(require 'tabbar) | |
(tabbar-mode 1) | |
;;; Don't enable mouse wheel on tab bar | |
(tabbar-mwheel-mode nil) | |
;;; Don't use group tab | |
(setq tabbar-buffer-groups-function nil) | |
;;; Delete left button | |
(dolist (btn '(tabbar-buffer-home-button | |
tabbar-scroll-left-button | |
tabbar-scroll-right-button)) | |
(set btn (cons (cons "" nil) | |
(cons "" nil)))) | |
;;; Tab length | |
(setq tabbar-separator '(1.3)) | |
;;; Tab scrolling | |
(setq tabbar-auto-scroll-flag t) | |
;;; Abbreviate file name on a tab | |
;;(setq tabbar-auto-scroll-flag nil) | |
;;; Tab moving keybind | |
(global-set-key (kbd "<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) | |
;; (global-set-key (kbd "<S-s-right>") 'tabbar-forward-tab) | |
;; (global-set-key (kbd "<S-s-left>") 'tabbar-backward-tab) | |
;; Change appearance | |
(defun my-tabbar-color () | |
(sleep-for 1) | |
(set-face-attribute | |
'tabbar-default nil | |
;; :family "Comic Sans MS" | |
:family "Ricty" | |
:background "black" | |
:foreground "gray32" | |
:height 0.9) | |
(set-face-attribute | |
'tabbar-unselected nil | |
:background "black" | |
:foreground "grey80" | |
:box nil) | |
(set-face-attribute | |
'tabbar-selected nil | |
:background "#90f050" | |
:foreground "gray10" | |
:bold 0 | |
:height 1.0 | |
:box nil) | |
(set-face-attribute | |
'tabbar-button nil | |
:box nil) | |
(set-face-attribute | |
'tabbar-separator nil | |
:height 1.0)) | |
(add-hook 'after-init-hook 'my-tabbar-color) | |
;;; Specify buffer that remaining as a tab | |
(defvar my-tabbar-displayed-buffers | |
;;; '("*scratch*" "*Messages*" "*Backtrace*" "*Colors*" "*Faces*" "*vc-") | |
'("*scratch*" "*Backtrace*" "*Colors*" "*Faces*" "*vc-") | |
"*Regexps matches buffer names always included tabs.") | |
(defvar my-tabber-eliminate-major-mode | |
'(direx:direx-mode)) | |
(defun my-tabbar-buffer-list () | |
"Return the list of buffers to show in tabs. | |
Exclude buffers whose 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) | |
;;; Tab jumping - super + number | |
;;; http://d.hatena.ne.jp/tequilasunset/20101128/p1 | |
(defun my-tabbar-select-tab-by-number (n) | |
"Select Nth tab." | |
(interactive "p") | |
(let* ((tabset (tabbar-current-tabset t)) | |
(tab (tabbar-selected-tab tabset)) | |
previous) | |
(when (and tabset (numberp n) (<= 1 n)) | |
(while (setq previous (tabbar-tab-next tabset tab t)) | |
(setq tab previous)) | |
(loop for i from 1 below n | |
do (setq tab (tabbar-tab-next tabset tab)) | |
unless (tabbar-tab-next tabset tab) return nil) | |
(tabbar-click-on-tab tab)))) | |
(loop for i from 1 to 9 | |
for fn = (intern (format "my-tabbar-select-tab-%d" i)) | |
do | |
(fset fn `(lambda () (interactive) (my-tabbar-select-tab-by-number ,i))) | |
(global-set-key (read-kbd-macro (format "s-%d" i)) fn)) | |
;; Distinct same name buffers | |
(require 'uniquify) | |
(setq uniquify-buffer-name-style 'post-forward-angle-brackets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment