• Stars
    star
    364
  • Rank 117,101 (Top 3 %)
  • Language
    Emacs Lisp
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emacs package to provide out-of-the-box configuration to use tabs.

Table of Contents

What is it?

Emacs package to provide out-of-the-box configuration to use tabs.

Installation

  1. Clone this repository
git clone --depth=1 https://github.com/manateelazycat/awesome-tab.git
  1. Move awesome-tab.el to your load-path.

    The load-path is usually ~/elisp/.

    It's set in your ~/.emacs or ~/.emacs.d/init.el like this:

(add-to-list 'load-path (expand-file-name "~/elisp"))

(require 'awesome-tab)

(awesome-tab-mode t)
  1. If you are using Use-package, the configuration will look like this
(use-package awesome-tab
  :load-path "path/to/your/awesome-tab"
  :config
  (awesome-tab-mode t))
  1. Reload your emacs configuration using M-x eval-buffer or restarting emacs

Usage

Command Description
awesome-tab-switch-group Switch awesome-tab group by ido fuzz match
awesome-tab-select-beg-tab Select first tab of current group
awesome-tab-select-end-tab Select last tab of current group
awesome-tab-forward-tab-other-window Select next tab in other window
awesome-tab-backward-tab-other-window Select previous tab in other window
awesome-tab-backward-tab Select the previous available tab
awesome-tab-forward-tab Select the next available tab
awesome-tab-backward-group Go to selected tab in the previous available group
awesome-tab-forward-group Go to selected tab in the next available group
awesome-tab-backward Select the previous available tab, depend on setting of awesome-tab-cycle-scope
awesome-tab-forward Select the next available tab, depend on setting of awesome-tab-cycle-scope
awesome-tab-kill-other-buffers-in-current-group Kill other buffers of current group
awesome-tab-kill-all-buffers-in-current-group Kill all buffers of current group
awesome-tab-kill-match-buffers-in-current-group Kill buffers match extension of current group
awesome-tab-keep-match-buffers-in-current-group Keep buffers match extension of current group
awesome-tab-move-current-tab-to-left Move current tab to left
awesome-tab-move-current-tab-to-right Move current tab to right
awesome-tab-move-current-tab-to-beg Move current tab to the first position
awesome-tab-select-visible-tab Select visible tab with given index
awesome-tab-ace-jump Jump to visible tab with 1 or 2 characters press

Tip: When jumping to a tab far away, think if it will be frequently used. If the answer is yes, move it to the first position. By doing so you keep all your frequently used tabs to be in the first screen, so you have easy access to them.

AceJump

Call command awesome-tab-ace-jump, and a sequence of 1 or 2 characters will show on tabs in the current tab group. Type them to jump to that tab.

Customize awesome-tab-ace-keys to specify the used characters. The default value is j, k, l, s, d, f. Notice that this variable has the custom-set attribute, so setq won't work. Use customize-set-variable instead.

Customize awesome-tab-ace-str-style to specify the position of ace sequences on the tab. You can choose 'replace-icon, 'left or 'right.

Customize awesome-tab-ace-quit-keys to specify keys used to quit from ace jumping. The default value is '(?\C-g ?q ?\s), you can press C-g q or SPC to quit from ace jumping. Anyway, you can customize any other keys you like.

(setq awesome-tab-ace-quit-keys '(?\C-g))

If you are a hydra user, you can use this to do consecutive moves between tabs and windows:

(defhydra awesome-fast-switch (:hint nil)
  "
 ^^^^Fast Move             ^^^^Tab                    ^^Search            ^^Misc
-^^^^--------------------+-^^^^---------------------+-^^----------------+-^^---------------------------
   ^_k_^   prev group    | _C-a_^^     select first | _b_ search buffer | _C-k_   kill buffer
 _h_   _l_  switch tab   | _C-e_^^     select last  | _g_ search group  | _C-S-k_ kill others in group
   ^_j_^   next group    | _C-j_^^     ace jump     | ^^                | ^^
 ^^0 ~ 9^^ select window | _C-h_/_C-l_ move current | ^^                | ^^
-^^^^--------------------+-^^^^---------------------+-^^----------------+-^^---------------------------
"
  ("h" awesome-tab-backward-tab)
  ("j" awesome-tab-forward-group)
  ("k" awesome-tab-backward-group)
  ("l" awesome-tab-forward-tab)
  ("0" my-select-window)
  ("1" my-select-window)
  ("2" my-select-window)
  ("3" my-select-window)
  ("4" my-select-window)
  ("5" my-select-window)
  ("6" my-select-window)
  ("7" my-select-window)
  ("8" my-select-window)
  ("9" my-select-window)
  ("C-a" awesome-tab-select-beg-tab)
  ("C-e" awesome-tab-select-end-tab)
  ("C-j" awesome-tab-ace-jump)
  ("C-h" awesome-tab-move-current-tab-to-left)
  ("C-l" awesome-tab-move-current-tab-to-right)
  ("b" ivy-switch-buffer)
  ("g" awesome-tab-counsel-switch-group)
  ("C-k" kill-current-buffer)
  ("C-S-k" awesome-tab-kill-other-buffers-in-current-group)
  ("q" nil "quit"))

where my-select-window is a command that automatically recognizes the number in your keystroke and switch to that window. Below is an implementation using ace-window:

;; winum users can use `winum-select-window-by-number' directly.
(defun my-select-window-by-number (win-id)
  "Use `ace-window' to select the window by using window index.
WIN-ID : Window index."
  (let ((wnd (nth (- win-id 1) (aw-window-list))))
    (if wnd
        (aw-switch-to-window wnd)
      (message "No such window."))))

(defun my-select-window ()
  (interactive)
  (let* ((event last-input-event)
         (key (make-vector 1 event))
         (key-desc (key-description key)))
    (my-select-window-by-number
     (string-to-number (car (nreverse (split-string key-desc "-"))))))))

SwitchTabByIndex

You can bind the number keys to the command awesome-tab-select-visible-tab, such as s-1, s-2, s-3 ... etc.

(global-set-key (kbd "s-1") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-2") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-3") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-4") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-5") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-6") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-7") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-8") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-9") 'awesome-tab-select-visible-tab)
(global-set-key (kbd "s-0") 'awesome-tab-select-visible-tab)

This function automatically recognizes the number at the end of the keystroke and switches to the tab of the corresponding index.

Note that this function switches to the visible range, not the actual logical index position of the current group.

To show the current index on tabs, set awesome-tab-show-tab-index to non-nil. You can also change its format by customizing awesome-tab-index-format-str.

Plugins

If you're a helm fan, you need to add below code in your helm config,

(awesome-tab-build-helm-source)

Ivy fans can use the awesome-tab-counsel-switch-group function instead.

Customize

Icon

If you have install AllTheIcons successfully. AwesomeTab will render file icon in tab automatically.

If you dislike icon render in tab and still need use all-the-icons plugin, you can set variable awesome-tab-display-icon with nil.

Theme

Tab color will change with current theme, you don't need customize the color tab.

Emacs may not detect your theme style (light/dark) in the terminal correctly. You may need to set frame-background-mode manually to have correct tab (and text) colors:

(when (not (display-graphic-p))
  (setq frame-background-mode 'dark))

or you like light theme more:

(when (not (display-graphic-p))
  (setq frame-background-mode light))

You can customize terminal tab face by below options:

  • awesome-tab-terminal-dark-select-background-color
  • awesome-tab-terminal-dark-select-foreground-color
  • awesome-tab-terminal-dark-unselect-background-color
  • awesome-tab-terminal-dark-unselect-foreground-color
  • awesome-tab-terminal-light-select-background-color
  • awesome-tab-terminal-light-select-foreground-color
  • awesome-tab-terminal-light-unselect-background-color
  • awesome-tab-terminal-light-unselect-foreground-color
HideRules

Awesome tab hide some tabs with regular expression that controller by function awesome-tab-hide-tab-function

Default hide function is awesome-hide-tab

(defun awesome-tab-hide-tab (x)
  (let ((name (format "%s" x)))
    (or
     (string-prefix-p "*epc" name)
     (string-prefix-p "*helm" name)
     (string-prefix-p "*Compile-Log*" name)
     (string-prefix-p "*lsp" name)
     (and (string-prefix-p "magit" name)
               (not (file-name-extension name)))
     )))

Tab will hide if awesome-tab-hide-tab-function return t, you can write your own code to customize hide rules.

GroupRules

Awesome tab use awesome-tab-buffer-groups-function to control tab group. Default group function is awesome-tab-buffer-groups

(defun awesome-tab-buffer-groups ()
  "`awesome-tab-buffer-groups' control buffers' group rules.

Group awesome-tab with mode if buffer is derived from `eshell-mode' `emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'.
All buffer name start with * will group to \"Emacs\".
Other buffer group by `awesome-tab-get-group-name' with project name."
  (list
   (cond
    ((or (string-equal "*" (substring (buffer-name) 0 1))
         (memq major-mode '(magit-process-mode
                            magit-status-mode
                            magit-diff-mode
                            magit-log-mode
                            magit-file-mode
                            magit-blob-mode
                            magit-blame-mode
                            )))
     "Emacs")
    ((derived-mode-p 'eshell-mode)
     "EShell")
    ((derived-mode-p 'emacs-lisp-mode)
     "Elisp")
    ((derived-mode-p 'dired-mode)
     "Dired")
    ((memq major-mode '(org-mode org-agenda-mode diary-mode))
     "OrgMode")
    (t
     (awesome-tab-get-group-name (current-buffer))))))

This function is very simple switch logic, you can write your own code to group tabs.

FixedWidth

If you'd like all the tab labels using the same length, such as 14, use:

(setq awesome-tab-label-fixed-length 14)
DisplayFunctionName

If the implementation of the function where the cursor is located is longer than the screen, it is difficult to know what the current function.

You can set variable awesome-tab-display-sticky-function-name with t, then function name will display in current tab.

Default this feature is disable.

ShowTabIndex

If you want show index in tab, you can use below setting:

(setq awesome-tab-show-tab-index t)

You can also display a personalized index by change option awesome-tab-index-format-str

AdjustTabHeight

You can use below code adjust tab height:

(setq awesome-tab-height 150)
AdjustTabContrast

If you think the contrast between the label is too low, can lower both values, increase the contrast:

awesome-tab-dark-unselected-blend and awesome-tab-light-unselected-blend

AdjustActiveBar

You can customize active bar with change awesome-tab-active-bar-width and awesome-tab-active-bar-height

More Repositories

1

lazycat-emacs

Andy Stewart's emacs
Emacs Lisp
425
star
2

aweshell

Awesome shell extension base on eshell with wonderful features!
Emacs Lisp
395
star
3

snails

A modern, easy-to-expand fuzzy search framework
Emacs Lisp
386
star
4

deepin-terminal

Deepin Terminal written by vala
Vala
257
star
5

awesome-tray

Hide mode-line, display necessary information at right of minibuffer.
Emacs Lisp
233
star
6

nox

Nox is a lightweight, high-performance LSP client for Emacs
Emacs Lisp
206
star
7

color-rg

Search and refactoring tool based on ripgrep.
Emacs Lisp
149
star
8

popweb

Show popup web window for Emacs
JavaScript
142
star
9

mind-wave

Emacs AI plugin based on ChatGPT API
Emacs Lisp
137
star
10

company-english-helper

English helper base on Emacs company-mode
Emacs Lisp
99
star
11

insert-translated-name

Insert translated string as variable or function name
Emacs Lisp
87
star
12

awesome-pair

Auto parenthesis pairing with syntax table
Emacs Lisp
76
star
13

auto-save

Automatically save files without temporary files to protect your finger. ;)
Emacs Lisp
73
star
14

blink-search

In the blink of an eye, the search is complete
Emacs Lisp
72
star
15

sdcv

Emacs interface for sdcv (Stardict console version)
Emacs Lisp
64
star
16

deno-bridge

Build bridge between Emacs and Deno, execution of JavaScript and Typescript within Emacs.
Emacs Lisp
59
star
17

deepin-software-center

Software center for linux deepin.
Python
51
star
18

manateelazycat.github.io

My personal blog
HTML
50
star
19

deepin-screen-recorder

Deepin screen recorder
C++
50
star
20

holo-layer

HoloLayer is a multimedia layer plugin designed specifically for Emacs
Emacs Lisp
48
star
21

grammatical-edit

Grammatical edit base on tree-sitter
Emacs Lisp
47
star
22

hammerspoon-config

My config for Hammerspoon Window Manager
Lua
46
star
23

thing-edit

Copy and paste anything under cursor.
Emacs Lisp
46
star
24

sort-tab

Smarter tab solution for Emacs, sort tab with using frequency.
Emacs Lisp
44
star
25

deepin-system-monitor

System monitor for deepin
C++
41
star
26

instant-rename-tag

Instant rename tag
Emacs Lisp
32
star
27

python-bridge

Write Emacs Plugin by Python, split code from EAF.
Emacs Lisp
32
star
28

lazy-load

Lazy load keys for speed ​​up Emacs startup.
Emacs Lisp
30
star
29

deepin-pinyin-assistant

Deepin pinyin assistant
C
27
star
30

fingertip

Fingertip is struct edit plugin that base on treesit
Emacs Lisp
26
star
31

deepin-editor

Simple note application for deepin
C++
24
star
32

markmacro

Keyboard macro for marked regions
Emacs Lisp
21
star
33

one-key

Many commands share one key.
Emacs Lisp
20
star
34

mrkeyboard

Mr. Keyboard
Vala
17
star
35

grep-dired

Find name with given regexp, and show in dired.
Emacs Lisp
16
star
36

lazycat-theme

Cool hacker's emacs theme, but won't hurt your eye
Emacs Lisp
16
star
37

nova

Nova is a multi-threaded remote access plugin designed specifically for Emacs, with outstanding file synchronization performance.
Emacs Lisp
16
star
38

multi-term

Managing multiple terminal buffers in Emacs.
Emacs Lisp
15
star
39

corfu-english-helper

English helper for Emacs, base on corfu-mode
Emacs Lisp
15
star
40

deepin-voice-recorder

Voice recorder application for deepin
C++
15
star
41

lazy-search

Mark current symbol and jump in all matching symbols.
Emacs Lisp
15
star
42

lsp-bridge

Fastest LSP client for Emacs, work in progress...
Python
14
star
43

deepin-picker

Color picker tool for deepin
C++
13
star
44

css-sort

An Emacs extension you can sort CSS attributables automatically.
Emacs Lisp
13
star
45

tower-ng

Use rails write web todo-list tool like https://tower.im, this project is just a learning project
Ruby
12
star
46

smart-align

Smart align block around cursor
Emacs Lisp
11
star
47

delete-block

Delete block effectively
Emacs Lisp
10
star
48

recursive-search-references

Find function references in directory
Emacs Lisp
9
star
49

deepin-desktop-monitor

Deepin Desktop Monitor
C++
8
star
50

key-echo

Key-Echo is an Emacs plugin that uses XRecord technology to listen to system key events
Emacs Lisp
8
star
51

highlight-matching-tag

This plugin will highlight matching tag instantaneously.
Emacs Lisp
8
star
52

bison

Mode to editing bision source code in Emacs
Emacs Lisp
8
star
53

wraplish

Wraplish 是一个在 Unicode 与英文之间加上空格的Emacs插件,
Emacs Lisp
7
star
54

duplicate-line

Duplicate line or region, don't need move cursor.
Emacs Lisp
7
star
55

flex

It's a mode for flex files that provide better syntax highlight than flex-mode.el
Emacs Lisp
7
star
56

watch-other-window

Scroll other window and keep current window's position.
Emacs Lisp
7
star
57

find-define

Jump to the definition of a function or variable
Emacs Lisp
6
star
58

deepin-gnome-shell-3.4.1

Deepin gnome shell 3.4.1
C
6
star
59

move-text

Move current line or region
Emacs Lisp
6
star
60

deepin-translate-tools

Translate tools for deepin linux.
Python
6
star
61

vi-navigate

Navigate read-only buffer like vi behavior.
Emacs Lisp
6
star
62

html-to-word

This is a HTML to Word conversion library for Rails.
Ruby
6
star
63

manateelazycat

Github profile repo
5
star
64

cache-path-from-shell

Provide a chache mechanism make sure exec-path-from-shell just execute once.
Emacs Lisp
5
star
65

find-orphan

Find orphan function that need remove
Emacs Lisp
5
star
66

open-newline

Open newline like vi.
Emacs Lisp
4
star
67

toggle-one-window

Toggle between window layout and one window.
Emacs Lisp
4
star
68

lazycat-gs-theme

Gnome shell for my own use
Shell
3
star
69

manatee

Manatee Integrate Live Environment
Haskell
3
star
70

deb2po

Convert format between *.debian and *.po file.
Python
3
star
71

effortless-indent

Indent paste code without additional selection operations
Emacs Lisp
3
star
72

lazycat-emacs-time-machine

The elisp code that has been tossed, no longer used, archived to commemorate
Emacs Lisp
3
star
73

deno-bridge-ts

Build bridge between Emacs and Deno, execution of JavaScript and Typescript within Emacs, this repo is TypeScript part for deno-bridge
TypeScript
1
star