Compare commits
4 Commits
1502872174
...
3294ba546e
Author | SHA1 | Date | |
---|---|---|---|
3294ba546e | |||
2de038abaf | |||
5d0f344d59 | |||
71bf2d1cca |
40
p11k.el
40
p11k.el
@ -1,8 +1,8 @@
|
|||||||
;;; p11k.el --- PowerLevel10k prompt for Eshell -*- lexical-binding: t; -*-
|
;;; 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
|
;; Keywords: terminals, convenience, faces
|
||||||
;; Package-Requires: ((dash) (all-the-icons) (eshell-prompt-extras) (f) (shrink-path))
|
;; 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)))
|
it) nil)))
|
||||||
(branch (--> "git branch"
|
(branch (--> "git branch"
|
||||||
(shell-command-to-string it)
|
(shell-command-to-string it)
|
||||||
(split-string it "\n" 'omit-nulls search-whitespace-regexp)
|
(split-string it)
|
||||||
(if it (progn
|
(cadr it)
|
||||||
(--filter (string-match-p (rx bol "* " (+ word)) it) it)
|
;; (split-string it "\n" 'omit-nulls search-whitespace-regexp)
|
||||||
(split-string (car it))
|
;; (if it (progn
|
||||||
(cadr it))
|
;; (--filter (string-match-p (rx bol "* " (+ word)) it) it)
|
||||||
"")))
|
;; (split-string (car it))
|
||||||
|
;; (cadr it))
|
||||||
|
;; "")
|
||||||
|
))
|
||||||
(modcount (--> status-alist
|
(modcount (--> status-alist
|
||||||
(--map (car it) it)
|
(--map (car it) it)
|
||||||
(--count (string-match-p "M" it) it)
|
(--count (string-match-p "M" it) it)
|
||||||
@ -262,7 +265,7 @@ Use 'window-width' to calculate the total final width."
|
|||||||
nil))))
|
nil))))
|
||||||
(p11k/spaced-concat
|
(p11k/spaced-concat
|
||||||
(if (eq p11k/prompt-flow 'fluent) "on" "")
|
(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 modcount (propertize modcount 'face 'p11k/yellow) "")
|
||||||
(if untracked (propertize untracked 'face 'p11k/blue) "")))
|
(if untracked (propertize untracked 'face 'p11k/blue) "")))
|
||||||
""))
|
""))
|
||||||
@ -300,15 +303,16 @@ Use 'window-width' to calculate the total final width."
|
|||||||
"Toggle the direction that the prompt points according to `p11k/get-modal-status'."
|
"Toggle the direction that the prompt points according to `p11k/get-modal-status'."
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(save-mark-and-excursion
|
(save-mark-and-excursion
|
||||||
(let ((inhibit-read-only t)
|
(if (re-search-backward eshell-prompt-regexp nil 'no-error)
|
||||||
(new-caret
|
(let ((inhibit-read-only t)
|
||||||
(p11k/caret-color-status
|
(new-caret
|
||||||
eshell-last-command-status)))
|
(p11k/caret-color-status
|
||||||
(goto-char (point-max))
|
eshell-last-command-status)))
|
||||||
(re-search-backward eshell-prompt-regexp)
|
(goto-char (point-max))
|
||||||
(goto-char (point-at-bol))
|
(re-search-backward eshell-prompt-regexp)
|
||||||
(delete-forward-char 1)
|
(goto-char (point-at-bol))
|
||||||
(insert new-caret))
|
(delete-forward-char 1)
|
||||||
|
(insert new-caret)))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
(defun p11k/esh-transient-prompt ()
|
(defun p11k/esh-transient-prompt ()
|
||||||
|
Loading…
Reference in New Issue
Block a user