3

如何将 bash 别名移植到 IPython 版本 >= 0.11?

IPython < 0.11 已经回答了这个问题,链接在这里:

http://ipython.scipy.org/Wiki/tips

4

1 回答 1

2

这是我的解决方案。欢迎改进!

在您的 ipython 配置中,添加以下行:(我的在这里:~/.config/ipython/profile_default/ipython_config.py)

c = get_config()

## Port bash aliases to ipython
import os, string
a = os.popen("bash -l -c 'alias'").read()
a = a.translate(string.maketrans("=", ' '), '\'"').split('alias ')
a = [tuple(x.strip().split(' ', 1)) for x in a]
c.AliasManager.user_aliases = [x for x in a if len(x) == 2]
于 2011-10-06T23:40:03.183 回答