summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/init.el54
1 files changed, 33 insertions, 21 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index af4b0b7..4b9c8a6 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -626,17 +626,28 @@
:hook ((shell-mode . (lambda () (display-line-numbers-mode -1)))))
(defvar thanos/aliases
- '((d . dired)
- (o . find-file)
- (oo . find-file-other-window)
- (ll . (lambda () (eshell/ls '-lha)))
- (eshell/clear . eshell/clear-scrollback)))
+ '((ll . "ls -lah")
+ (clear . clear-scrollback)))
(defun thanos/set-eshell-aliases (aliases)
"Set ALIASES as eshell aliases."
+ ;; Remove aliases file
+ (when (and eshell-aliases-file
+ (file-exists-p eshell-aliases-file))
+ (delete-file eshell-aliases-file))
(mapc (lambda (alias)
- (defalias (car alias) (cdr alias)))
- aliases))
+ (let ((name (symbol-name (car alias)))
+ (command (cdr alias)))
+ (eshell/alias name
+ (cond
+ ((stringp command) command)
+ ((symbolp command) (symbol-name command))
+ (t (error "Unsupported alias command type"))))))
+ aliases))
+
+(defun eshell/o (file)
+ "Open FILE."
+ (find-file file))
(defun thanos/eshell-clear ()
"Interactive call for clear-scrollback."
@@ -651,23 +662,26 @@
(use-package esh-mode
:ensure nil
:config
- (defun eshell/git-info ()
- "Return a string with Git information if in a Git repository, or nil otherwise."
- (when (eq (call-process "git" nil nil nil "rev-parse" "--is-inside-work-tree") 0)
- (let* ((branch (string-trim (shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
- (dirty (not (string= "" (string-trim (shell-command-to-string "git status --porcelain")))))
- (branch-info (if (string= branch "HEAD") "" branch))
- (dirty-info (if dirty " ✎" " ✔")))
- (concat (propertize "⎇ " 'face 'modus-themes-fg-green-warmer)
- (propertize branch-info 'face 'modus-themes-fg-magenta-warmer)
- (propertize dirty-info 'face (if dirty 'modus-themes-fg-red 'modus-themes-fg-green))))))
+ (defun eshell-git-info ()
+ "Return a string with git info."
+ (when (eq (call-process "git" nil nil nil "rev-parse" "--is-inside-work-tree") 0)
+ (let* ((branch-raw (shell-command-to-string "git rev-parse --abbrev-ref HEAD"))
+ (branch (if (or (string-match-p "^fatal" branch-raw)
+ (string-match-p "^error" branch-raw))
+ "Unknown"
+ (string-trim branch-raw)))
+ (dirty (not (string= "" (string-trim (shell-command-to-string "git status --porcelain")))))
+ (dirty-info (if dirty " ✎" " ✔")))
+ (concat (propertize "⎇ " 'face 'modus-themes-fg-green-warmer)
+ (propertize branch 'face 'modus-themes-fg-magenta-warmer)
+ (propertize dirty-info 'face (if dirty 'modus-themes-fg-red 'modus-themes-fg-green))))))
(defun eshell-prompt-multiline ()
"Eshell Git prompt inspired by spaceship-prompt."
(let ((separator (propertize " | " 'face 'font-lock-comment-face))
(hr (propertize (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'face 'font-lock-comment-face))
(dir (propertize (format "%s" (abbreviate-file-name (eshell/pwd))) 'face 'modus-themes-fg-yellow-warmer))
- (git-info (eshell/git-info))
+ (git-info (eshell-git-info))
(time (propertize (format-time-string "%H:%M:%S") 'face 'font-lock-comment-face))
(sign (if (= (user-uid) 0)
(propertize "\n#" 'face 'modus-themes-fg-blue-intense)
@@ -701,8 +715,6 @@
("c" . 'password-store-copy)
("s" . 'smtp-get-pass)))
-;; Chat
-
(use-package erc
:ensure t
:config
@@ -853,7 +865,7 @@
("C-c C-o" . thanos/org-open-at-point)))
(use-package org-gnosis-ui
- :load-path "~/Dev/emacs-lisp/org-roam-ui/"
+ :load-path "~/Dev/emacs-lisp/org-gnosis-ui/"
:after org-gnosis
:config
(setf org-gnosis-ui-custom-theme