emacsaliaszsheshellemacs-prelude

How to copy Zsh aliases to Eshell


I'm trying to copy using the command provided in here. That is,

alias | sed -E "s/^alias ([^=]+)='(.*)'$/alias \1 \2 \$*/g; s/'\\\''/'/g;" >~/.emacs.d/eshell/alias

This worked with Bash, I was using Emacs-Starter-Kit; but not working with Zsh -- not working means it copied things but to no effect.

[As a side note]

It seems like, I don't have few Eshell default variables i.e. eshell-read-aliases-list, and eshell-aliases-file. So, I even don't know where should my Eshell alias file reside.


Solution

  • Got it working after setting

    (setq eshell-directory-name (expand-file-name "./" (expand-file-name "eshell" prelude-personal-dir)))
    

    in post.el (my personal .el file for post-processing) under prelude/personal

    ... and modified the given bash command to

    alias | awk '{print "alias "$0}' | sed -E "s/^alias ([^=]+)='(.*)'$/alias \1 \2 \$*/g; s/'\\\''/'/g;" > ~/.emacs.d/personal/eshell/alias
    

    ... and appended that to .zshrc.

    Found that alias command, in zsh, prints aliases without prefix alias<space>, unlike bash. Therefore this part

    | awk '{print "alias "$0}'