Skip to content

Instantly share code, notes, and snippets.

@fuxialexander
Created June 2, 2018 01:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuxialexander/1d5fcf12bcf96b959c0c43eef15f8dfb to your computer and use it in GitHub Desktop.
Save fuxialexander/1d5fcf12bcf96b959c0c43eef15f8dfb to your computer and use it in GitHub Desktop.
Magit popup
(set! :popup "^\\(?: ?\\*\\)?magit.*: "
'((slot . -1) (side . right) (size . 80))
'((select . t) (quit . nil)))
(set! :popup "^\\*magithub-dash\\*"
'((slot . -3) (side . right) (window-height . 20))
'((select . t)))
(def-modeline-segment! magithub-buffer-info-simple
"striped magithub buffer name"
(substring (buffer-name) 11 -1))
(def-modeline-segment! magit-title
"striped magithub buffer name"
(let* ((str "M A G I T")
(num (max 0 (/ (- (window-width
(selected-window)) (string-width str)) 2))))
(concat +doom-modeline--bar-inactive (propertize (concat (make-string num ? ) str) 'face 'bold))))
(def-modeline-segment! magithub-title
"striped magithub buffer name"
(let* ((str "D A S H B O A R D")
(num (max 0 (/ (- (window-width
(selected-window)) (string-width str)) 2))))
(concat +doom-modeline--bar-inactive (propertize (concat (make-string num ? ) str) 'face 'bold))))
(def-modeline! magit-title
(magit-title))
(def-modeline! magithub-title
(magithub-title))
(def-modeline! magithub
(bar matches " " magithub-buffer-info-simple))
(set! :popup "^\\*magithub: .*\\*"
'((slot . -2) (side . right) (window-height . 0.6))
'((select . t)))
(defun +magithub|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magithub) mode-line-format)
mode-line-format nil))
(add-hook 'magithub-issue-view-mode-hook #'+magithub|switch-mode-and-header-line)
(defun +magit|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magit-title) mode-line-format)
mode-line-format nil))
(add-hook 'magit-status-mode-hook #'+magit|switch-mode-and-header-line)
(defun +magithub-dash|switch-mode-and-header-line ()
(setq header-line-format (or (doom-modeline 'magithub-title) mode-line-format)
mode-line-format nil))
(add-hook 'magithub-dash-mode-hook #'+magithub-dash|switch-mode-and-header-line)
(set! :popup "^\\*magit.*popup\\*"
'((slot . 0) (side . right))
'((select . t)))
(set! :popup "^\\(?: ?\\*\\)?magit-revision:.*"
'((slot . 2) (side . right) (window-height . 0.6))
'((select . t)))
(set! :popup "^\\(?: ?\\*\\)?magit-diff:.*"
'((slot . 2) (side . right) (window-height . 0.6))
'((select . nil))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment