blob: bb8f17e3963827eca5935b429eba2ff35c7d89e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;;;; time and date
(require 'time)
(setq display-time-format " %m/%d %H:%M"
display-time-default-load-average nil)
(display-time)
;;;; turn tabs on, undo/redo mode
(setq tab-bar-show t)
(tab-bar-history-mode)
(tab-bar-select-tab 1)
(tab-bar-mode)
;;;; remove useless gui elements
(setopt tab-bar-format
'(tab-bar-format-tabs
tab-bar-format-align-right
tab-bar-format-global)
tab-bar-close-button-show nil
;; size
tab-bar-auto-width-max nil)
;;;; add useless text elements
(setopt tab-bar-tab-hints nil
tab-bar-select-tab-modifiers '(meta))
;; use project name if it exists
(defun bd/tab-bar-name-function ()
(mapconcat (lambda (buffer)
(let* ((file (buffer-file-name buffer))
(project (and file (project-current
nil
(file-name-directory (buffer-file-name buffer))))))
(if project
(car (last
(file-name-split
(directory-file-name
(project-root project)))))
(tab-bar-tab-name-current))))
(delete-dups (mapcar #'window-buffer
(window-list-1 (frame-first-window)
'nomini)))
", "))
(defun bd/get-mode-line-modes (buffer)
(with-current-buffer buffer
(format-mode-line mode-line-modes)))
(defun bd/tab-bar-name-function ()
(concat (tab-bar-tab-name-current)
" "
(bd/get-mode-line-modes (window-buffer (minibuffer-selected-window)))))
(setopt project-switch-commands
'((project-find-file "Find file")
(project-find-regexp "Find regexp")
(project-find-dir "Find directory")
(magit-project-status "Magit")
(project-shell "Shell")))
(keymap-global-set "C-x p v" 'magit-project-status)
(setq tab-bar-tab-name-function #'bd/tab-bar-name-function)
(provide 'bd--tabs)
;;; bd-tabs ends here
|