简体   繁体   中英

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 ie eshell-read-aliases-list , and eshell-aliases-file . So, I even don't know where should my Eshell alias file reside.

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}'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM