mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 03:33:03 +03:00
feat(emacs): tab-bar
This commit is contained in:
parent
483af5e3c4
commit
e4edc119e6
3 changed files with 80 additions and 1 deletions
|
|
@ -34,4 +34,6 @@
|
|||
'(epe-pipeline-delimiter-face ((t (:foreground "#c3e88d"))))
|
||||
'(epe-pipeline-host-face ((t (:foreground "#82aaff"))))
|
||||
'(epe-pipeline-time-face ((t (:foreground "#ffcb6b"))))
|
||||
'(epe-pipeline-user-face ((t (:foreground "#f07178")))))
|
||||
'(epe-pipeline-user-face ((t (:foreground "#f07178"))))
|
||||
'(tab-bar ((t (:background "#242837" :foreground "#242837"))))
|
||||
'(tab-bar-tab ((t (:background "#292D3E" :foreground "#ffcb6b" :underline "#ffcb6b")))))
|
||||
|
|
|
|||
|
|
@ -1112,6 +1112,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
))
|
||||
#+end_src
|
||||
** Tab bar
|
||||
*** Setup
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
:keymaps 'override
|
||||
|
|
@ -1129,6 +1130,42 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
(general-nmap "gn" 'tab-new)
|
||||
(general-nmap "gN" 'tab-close)
|
||||
#+end_src
|
||||
*** My title
|
||||
#+begin_src emacs-lisp
|
||||
(setq my/project-title-separators "[-_ ]")
|
||||
|
||||
(defun my/shorten-project-name-elem (elem crop)
|
||||
(if (string-match "^\\[.*\\]$" elem)
|
||||
(concat "["
|
||||
(my/shorten-project-name-elem (substring elem 1 (- (length elem) 1)) crop)
|
||||
"]")
|
||||
(let ((prefix (car (s-match my/project-title-separators elem))))
|
||||
(let ((rest
|
||||
(substring
|
||||
(if prefix
|
||||
(substring elem (length prefix))
|
||||
elem)
|
||||
0 (if crop 1 nil))
|
||||
))
|
||||
(concat prefix rest))
|
||||
)))
|
||||
|
||||
(defun my/shorten-project-name (project-name)
|
||||
(let ((elems (s-slice-at my/project-title-separators project-name)))
|
||||
(concat
|
||||
(apply
|
||||
#'concat
|
||||
(cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems)))
|
||||
(my/shorten-project-name-elem (car (last elems)) nil))))
|
||||
|
||||
(defun my/tab-bar-name-function ()
|
||||
(let ((project-name (projectile-project-name)))
|
||||
(if (string= "-" project-name)
|
||||
(tab-bar-tab-name-current-with-count)
|
||||
(concat "[" (my/shorten-project-name project-name) "] " (tab-bar-tab-name-current-with-count)))))
|
||||
|
||||
(setq tab-bar-tab-name-function #'my/tab-bar-name-function)
|
||||
#+end_src
|
||||
** Modeline
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-modeline
|
||||
|
|
@ -1759,6 +1796,10 @@ pip install qtconsole markdown qrcode[pil] PyQt5 PyQtWebEngine
|
|||
:mode "\\.clj[sc]?\\'"
|
||||
:straight t)
|
||||
#+end_src
|
||||
** Elisp
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'lisp-interaction-mode-hook #'smartparens-mode)
|
||||
#+end_src
|
||||
** Go
|
||||
#+begin_src emacs-lisp
|
||||
(use-package go-mode
|
||||
|
|
|
|||
|
|
@ -910,6 +910,40 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
(general-nmap "gn" 'tab-new)
|
||||
(general-nmap "gN" 'tab-close)
|
||||
|
||||
(setq my/project-title-separators "[-_ ]")
|
||||
|
||||
(defun my/shorten-project-name-elem (elem crop)
|
||||
(if (string-match "^\\[.*\\]$" elem)
|
||||
(concat "["
|
||||
(my/shorten-project-name-elem (substring elem 1 (- (length elem) 1)) crop)
|
||||
"]")
|
||||
(let ((prefix (car (s-match my/project-title-separators elem))))
|
||||
(let ((rest
|
||||
(substring
|
||||
(if prefix
|
||||
(substring elem (length prefix))
|
||||
elem)
|
||||
0 (if crop 1 nil))
|
||||
))
|
||||
(concat prefix rest))
|
||||
)))
|
||||
|
||||
(defun my/shorten-project-name (project-name)
|
||||
(let ((elems (s-slice-at my/project-title-separators project-name)))
|
||||
(concat
|
||||
(apply
|
||||
#'concat
|
||||
(cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems)))
|
||||
(my/shorten-project-name-elem (car (last elems)) nil))))
|
||||
|
||||
(defun my/tab-bar-name-function ()
|
||||
(let ((project-name (projectile-project-name)))
|
||||
(if (string= "-" project-name)
|
||||
(tab-bar-tab-name-current-with-count)
|
||||
(concat "[" (my/shorten-project-name project-name) "] " (tab-bar-tab-name-current-with-count)))))
|
||||
|
||||
(setq tab-bar-tab-name-function #'my/tab-bar-name-function)
|
||||
|
||||
(use-package doom-modeline
|
||||
:straight t
|
||||
:init
|
||||
|
|
@ -1328,6 +1362,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
:mode "\\.clj[sc]?\\'"
|
||||
:straight t)
|
||||
|
||||
(add-hook 'lisp-interaction-mode-hook #'smartparens-mode)
|
||||
|
||||
(use-package go-mode
|
||||
:straight t
|
||||
:mode "\\.go\\'")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue