Bash aliases support
This commit is contained in:
parent
d0cc4ec8d3
commit
3a99cd3660
19
init.el
19
init.el
|
|
@ -422,6 +422,25 @@
|
|||
(add-hook 'completion-at-point-functions
|
||||
'bash-completion-capf-nonexclusive nil t)))
|
||||
)
|
||||
; Import bash aliases to eshell
|
||||
(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))
|
||||
|
||||
; Bash aliases to exclude
|
||||
(flush-lines "^alias magit\\|^alias oc\\|^alias z\\|^alias zi\\|^alias cd\\|^alias cdi\\|^alias sudo")
|
||||
|
||||
(while (re-search-forward "alias \\(.+\\)='\\(.+\\)'$" nil t)
|
||||
(add-to-list 'eshell-command-aliases-list (list (match-string 1) (match-string 2))))))
|
||||
|
||||
;; We only want Bash aliases to be loaded when Eshell loads its own aliases,
|
||||
;; rather than every time `eshell-mode' is enabled.
|
||||
(add-hook 'eshell-first-time-mode-hook 'eshell-load-bash-aliases t)
|
||||
|
||||
; Eat is a terminal emulator that can integrate nicely with eshell, allows us to run full ncurses applications inside eshell.
|
||||
(use-package eat
|
||||
:ensure t
|
||||
|
|
|
|||
Loading…
Reference in New Issue