Powerline 的安装
安装 Powerline
Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, fish, tmux, IPython, Awesome, i3 and Qtile.
进阶版本:https://github.com/b-ryan/powerline-shell A beautiful and useful prompt generator for Bash, ZSH, Fish, and tcsh
pip3 install wheel powerline-status #或 pip3 install git+git://github.com/powerline/powerline # pip3 install git+git://gitee.com/mirrors/Powerline # 确认包路径 pip3 show powerline-status # /usr/local/python3/lib/python3.8/site-packages # 查看支持的终端 ls /usr/local/python3/lib/python3.8/site-packages/powerline/bindings/ # awesome bar bash config.py fish i3 ipython lemonbar pdb qtile rc shell tcsh tmux vim wm zsh # 查看本地配置 gedit /usr/local/python3/lib/python3.8/site-packages/powerline/config_files/config.json
安装配套字体,并修改终端界面的显示字体(才会生效)
#git clone https://github.com/powerline/fonts.git --depth=1 git clone https://gitee.com/efluent/fonts.git --depth=1 # install cd fonts ./install.sh # 在相应的账户下安装,就安装到响应账户的文件夹中 /root/.local/share/fonts /home/herc/.local/share/fonts cp -pr fonts/ /usr/share/fonts/powerline cd .. rm -rf fonts
以下方法测试未成功,原因不明
#安装字体 # cd /usr/share/fonts/SourceCodePro # chmod +x *.otf cp -pr SourceCodePro/ /usr/share/fonts cd /usr/share/fonts wget https://github.com/powerline/powerline/blob/develop/font/PowerlineSymbols.otf chmod +x PowerlineSymbols.otf # 下述方法无效 #cd /etc/fonts/conf.d/ #wget https://github.com/powerline/powerline/blob/develop/font/10-powerline-symbols.conf #wget https://github.com/justrajdeep/fonts/blob/master/10-powerline-symbols.conf mkdir -p ~/.config/fontconfig/conf.d cd ~/.config/fontconfig/conf.d wget https://github.com/powerline/fonts/blob/master/fontconfig/50-enable-terminess-powerline.conf # 在各个用户下执行 fc-cache -fv
查看字体
# 查看中文字体清单 fc-list :lang=zh # 终端字体保存在 find / -name consolefonts cd /lib/kbd/consolefonts setfont -h
centos 6安装中文字体(不含文泉驿)
yum install bitmap-fonts bitmap-fonts-cjk
Powerline 的配置
确认 Python 已关联到系统的各个 shell
# 添加到 Python 程序到系统中 #ln -s /usr/local/python3/bin/powerline /usr/local/bin #ln -s /usr/local/python3/bin/powerline-config /usr/local/bin #ln -s /usr/local/python3/bin/powerline-daemon /usr/local/bin echo 'export PATH=$PATH:/usr/local/python3/bin' >> /etc/profile echo 'export PATH=$PATH:/usr/local/python3/bin' >> /etc/zprofile
bash开启 powerline(全局),参考 https://powerline.readthedocs.io/en/latest/usage/shell-prompts.html
cd /usr/local/python3/lib/python3.8/site-packages/powerline gedit /etc/bashrc # 或 gedit /etc/profile.d/powerline.sh # powerline,hhj-20210220 export PATH=$PATH:/usr/local/python3/bin if [ -f "`which powerline-daemon`" ]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/local/python3/lib/python3.8/site-packages/powerline/bindings/bash/powerline.sh fi . /etc/profile.d/powerline.sh # 当前用户生效
zsh 配置 powerline(全局)
cd /usr/local/python3/lib/python3.8/site-packages/powerline/bindings/zsh/ cp /etc/profile.d/powerline.sh /etc/profile.d/powerline.zsh gedit /etc/profile.d/powerline.zsh # hhj-20210220 if [ -f "`which powerline-daemon`" ]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/local/python3/lib/python3.8/site-packages/powerline/bindings/zsh/powerline.zsh fi . /etc/profile.d/powerline.zsh
vim(全局配置)
vim /etc/vimrc " hhj-20210220 set rtp+=/usr/local/python3/lib/python3.8/site-packages/powerline/bindings/vim/ set laststatus=2 set t_Co=256
ipython 配置
gedit ~/.ipython/profile_default/ipython_config.py from powerline.bindings.ipython.since_5 import PowerlinePrompts c = get_config() c.TerminalInteractiveShell.simple_prompt = False c.TerminalInteractiveShell.prompts_class = PowerlinePrompts
tmux 配置
gedit ~/.tmux.conf source "/usr/local/python3/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf"
解决不能显示git分支问题(未配置)
mkdir -p ~/.config/powerline cat <<-'EOF' > ~/.config/powerline/config.json { "ext": { "shell": { "theme": "default_leftonly" } } } EOF powerline-daemon --replace
csh 配置(不成功)
gedit /etc/zprofile export PATH="$PATH:/usr/local/python3/bin" . /usr/local/python3/lib/python3.8/site-packages/powerline/bindings/tcsh/powerline.tcsh
参考文献
不记得了,之前安装的时候查阅了多个文档,改天补上来了!
最后更新: 2021/04/17 19:31:26
作者: David Faraday
主用链接: https://faradays-studio.gitee.io/202104102207/
备用链接: https://faradays-studio.github.io/202104102207/
引用、演绎等请注明出处,共创和谐社会,谢谢你的合作!