ipython repl的流行主题
ipython-agnoster的Python项目详细描述
ipython agnoster(又名ipster)是ipython repl的一个流行主题。 它的设计目的是提供前后一致的终端体验 Agnoster Zsh theme叉子。
ipster是为那些使用:
- 日光配色方案;
- Unicode兼容字体。
对于GNOME GNU/Linux用户,我强烈推荐GNOME Terminal+Solarized Dark+Dejavu Sans Mono Nerd。
对于kde gnu/linux用户,我强烈推荐konsole+Solarized Dark+dejavu sans mono nerd。
对于Mac用户,我强烈推荐Iterm 2+日光暗版。
With some extra hassle this theme works on Windows too.
安装
对于IPython>=5.0,请安装程序包:
pip install -U pip setuptools # update environment markers support pip install ipython-agnoster
对于IPython>=0.11,<5.0,克隆存储库并复制ipster 扩展目录的模块(已弃用):
git clone --depth=1 https://github.com/i5ar/ipster.git cd ipster cp -r ipster "$HOME/.ipython/extensions"
配置
安装模块后,需要对其进行配置。
编辑配置文件 ~/.ipython/profile_default/ipython_config.py:
## Use 24bit colors instead of 256 colors in prompt highlighting. c.TerminalInteractiveShell.true_color = True ## Set the color scheme (NoColor, Neutral, Linux, or LightBG). c.InteractiveShell.colors = 'Linux' ## c.InteractiveShell.separate_in = ''
对于IPython>=5.0,只添加以下行:
from ipster.since_5 import IPsterPrompts, IPsterStyle c.TerminalInteractiveShell.prompts_class = IPsterPrompts highlighting_ipstyle = IPsterStyle().overrides_linux() c.TerminalInteractiveShell.highlighting_style_overrides = highlighting_ipstyle
对于IPython>=0.11,<5.0,只添加以下行(不推荐):
from pygments.token import Token # Define prompt colors style_overrides_linux = { Token.IPsterPromptVirtualenv: 'bg:#859900 #073642', Token.IPsterPowerlinePromptVirtualenv: 'bg:#073642 #859900', Token.Prompt: 'bg:#073642 #839496', Token.PromptNum: 'bg:#073642 #859900 bold', Token.OutPrompt: 'bg:#073642 #839496', Token.OutPromptNum: 'bg:#073642 #dc322f bold', Token.IPsterPowerlinePrompt: '#073642', Token.IPsterPromptSpace: '#839496', } # Override prompt colors c.TerminalInteractiveShell.highlighting_style_overrides = style_overrides_linux # Load extension c.InteractiveShellApp.extensions = [ 'ipster.post_0_11' ]
兼容性
tmux
必须在配置文件中启用真彩色支持 ~/.tmux.conf日光配色方案正常工作:
# Override screen 256 color with true color set-option -ga terminal-overrides ",xterm-256color:Tc"
如果这个修复不起作用,您的tmux版本可能太旧了。
路线图
使用IPython shortcuts时 对于vi模式,当前模式指示可能非常有用。会的 如果ipster能以正确的提示显示vi模式,那就太好了。
贡献
欢迎提出建议和请求。
额外费用
如果您已经为ipython使用了powerline,请在下面安装ipster主题 请输入extras目录。
待办事项
- right prompt; 中的vi模式检测