下面地址先下载tabbar.el
http://www.emacswiki.org/emacs/tabbar.el
先贴个人设置 在下文在进行解释
(require 'tabbar)
(tabbar-mode)
(global-set-key (kbd "<M-up>") 'tabbar-backward-group)
(global-set-key (kbd "<M-down>") 'tabbar-forward-group)
(global-set-key (kbd "<M-left>") 'tabbar-backward-tab)
(global-set-key (kbd "<M-right>") 'tabbar-forward-tab)
(setq
tabbar-scroll-left-help-function nil ;don't show help information
tabbar-scroll-right-help-function nil
tabbar-help-on-tab-function nil
tabbar-home-help-function nil
tabbar-buffer-home-button (quote (("") "")) ;don't show tabbar button
tabbar-scroll-left-button (quote (("") ""))
tabbar-scroll-right-button (quote (("") "")))
(defun my-tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
Return a list of one element based on major mode."
(list
(cond
((or (get-buffer-process (current-buffer))
;; Check if the major mode derives from `comint-mode' or
;; `compilation-mode'.
(tabbar-buffer-mode-derived-p
major-mode '(comint-mode compilation-mode)))
"Process"
)
((string-equal "*" (substring (buffer-name) 0 1))
"Emacs Buffer"
)
((eq major-mode 'dired-mode)
"Dired"
)
(t
"User Buffer"
))))
(setq tabbar-buffer-groups-function 'my-tabbar-buffer-groups)
键位的设定时我特意改用了tabbar-backward-tab和tabbar-forward-tab 代替tabbar-backward和tabber-forward。效果是使用M-left/right的时候移动不会跨组,也就是只能在当前分组内移动,这样好很多
中间一段设置把标签栏左边的那些按钮都取消掉了
关于分组的问题
http://www.emacswiki.org/emacs/TabBarMode
WIKI给的代码经测试都不能使用(标签栏只剩下一条灰色),我给他做了部分修改就可以了。