2023年7月4日 星期二

powerline

20230704 powerline

ref: link

$ pip3 install --user powerline-status
$ git clone https://github.com/powerline/fonts.git
$ cd fonts; ./install.sh
$ cd -
$ rm -rf fonts
$ python3 -m site --user-site
  • output as ${PYTHON_SITE_PACKAGE_PATH}
$ cd ${PYTHON_SITE_PACKAGE_PATH}
$ mkdir -p scripts
$ cp ../../../bin/* ./scripts/
  • add to ~/.bash_profile
POWERLINE_PATH=`python3 -m site --user-site`
POWERLINE_SCRIPT=$POWERLINE_PATH/powerline/bindings/bash/powerline.sh
if [ -f $POWERLINE_SCRIPT ]; then
$POWERLINE_PATH/scripts/powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source $POWERLINE_SCRIPT
fi

設定

  • ~/.config/powerline/config.json
{
"ext": {
"shell": {
"theme": "elvis"
}
}
}
  • ~/.config/powerline/themes/shell/main.json
{
"segment_data": {
"hostname": {
"args": {
"only_if_ssh": true
}
},
"cwd": {
"args": {
"dir_limit_depth": 10
}
}
}
}
  • ~/.config/powerline/themes/shell/elvis.json
{
"segments": {
"left": [
{
"function": "powerline.segments.common.net.hostname",
"priority": 10
},
{
"function": "powerline.segments.common.env.user",
"priority": 30
},
{
"function": "powerline.segments.common.time.date",
"args": {
"format": "%H:%M",
"istime": true
},
"priority": 50
},
{
"function": "powerline.segments.common.vcs.branch",
"priority": 40
},
{
"function": "powerline.segments.common.env.virtualenv",
"priority": 50
},
{
"function": "powerline.segments.shell.cwd",
"priority": 10
},
{
"function": "powerline.segments.shell.jobnum",
"priority": 20
},
{
"function": "powerline.segments.shell.last_status",
"priority": 10
}
]
}
}

vim

安裝 vim-airline

  • ~/.vimrc
let g:Powerline_symbols = 'fancy'
let g:airline_powerline_fonts = 1