From 3195ba6529984b4de3a8586cd7312060ac8976d9 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 3 May 2023 09:04:00 +0300 Subject: emacs: Add eshell-load-bash-aliases --- emacs.org | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'emacs.org') diff --git a/emacs.org b/emacs.org index d367434..42452b8 100755 --- a/emacs.org +++ b/emacs.org @@ -369,11 +369,23 @@ Hook with ~dired-mode~ :config (defvar eshell-path-env (getenv "~/.local/bin"))) + (defun eshell-load-bash-aliases () + "Read Bash aliases and add them to the list of eshell aliases." + ;; Bash needs to be run - temporarily - interactively + ;; in order to get the list of aliases. + (with-temp-buffer + (call-process "bash" nil '(t nil) nil "-ci" "alias") + (goto-char (point-min)) + (while (re-search-forward "alias \\(.+\\)='\\(.+\\)'$" nil t) + (eshell/alias (match-string 1) (match-string 2))))) + + (defalias 'open 'find-file) + (add-hook 'eshell-alias-load-hook 'eshell-load-bash-aliases) (eshell-git-prompt-use-theme 'powerline) (eshell-syntax-highlighting-global-mode 1) - (defalias 'open 'find-file) + ;; (setq eshell-prompt-function 'apollo-eshell-prompt) (setq eshell-highlight-prompt t) -- cgit v1.2.3