Compare commits

...

4 Commits

24
p11k.el
View File

@ -1,8 +1,8 @@
;;; p11k.el --- PowerLevel10k prompt for Eshell -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Mitchell Marquez
;; Copyright (C) 2023 Miranda Marquez
;; Author: Mitchell Marquez <dr.m.perseos@gmail.com>
;; Author: Miranda Marquez <mirmarq428@gmail.com>
;; Keywords: terminals, convenience, faces
;; Package-Requires: ((dash) (all-the-icons) (eshell-prompt-extras) (f) (shrink-path))
@ -242,12 +242,15 @@ Use 'window-width' to calculate the total final width."
it) nil)))
(branch (--> "git branch"
(shell-command-to-string it)
(split-string it "\n" 'omit-nulls search-whitespace-regexp)
(if it (progn
(--filter (string-match-p (rx bol "* " (+ word)) it) it)
(split-string (car it))
(cadr it))
"")))
(split-string it)
(cadr it)
;; (split-string it "\n" 'omit-nulls search-whitespace-regexp)
;; (if it (progn
;; (--filter (string-match-p (rx bol "* " (+ word)) it) it)
;; (split-string (car it))
;; (cadr it))
;; "")
))
(modcount (--> status-alist
(--map (car it) it)
(--count (string-match-p "M" it) it)
@ -262,7 +265,7 @@ Use 'window-width' to calculate the total final width."
nil))))
(p11k/spaced-concat
(if (eq p11k/prompt-flow 'fluent) "on" "")
(propertize branch 'face 'p11k/green)
(if branch (propertize branch 'face 'p11k/green) "")
(if modcount (propertize modcount 'face 'p11k/yellow) "")
(if untracked (propertize untracked 'face 'p11k/blue) "")))
""))
@ -300,6 +303,7 @@ Use 'window-width' to calculate the total final width."
"Toggle the direction that the prompt points according to `p11k/get-modal-status'."
(save-match-data
(save-mark-and-excursion
(if (re-search-backward eshell-prompt-regexp nil 'no-error)
(let ((inhibit-read-only t)
(new-caret
(p11k/caret-color-status
@ -308,7 +312,7 @@ Use 'window-width' to calculate the total final width."
(re-search-backward eshell-prompt-regexp)
(goto-char (point-at-bol))
(delete-forward-char 1)
(insert new-caret))
(insert new-caret)))
)))
(defun p11k/esh-transient-prompt ()