Powerline Go用 Go 编写的低延迟 Shell 提示
用于 shell 且具有 Powerline 样式的提示
-
显示关于 git/hg 分支的一些重要细节
-
如果最后一个命令以失败代码退出,则更改颜色
-
如果对目录树过于深入,请使用省略号缩短显示的路径
-
显示当前的 Python virtualenv 环境
-
使用 rbenv 显示当前的 Ruby 版本
-
显示您是否在 nix shell 中
-
很容易定制和扩展
安装
需要 Go 1.12+
powerline-go
使用 ANSI 颜色代码,但是可能需要将 $TERM 设置为xterm-256color
才能工作。
预编译的二进制文件
在 release 选项卡中为 x64 Linux 和 macOS 提供了预编译的二进制文件
其他平台
- 安装(和更新)包
go install github.com/justjanne/powerline-go@latest
- 默认情况下它将在
$GOPATH/bin
中,如果想更改它,可以设置$GOPATH
和/或$GOBIN
,但也需要更改以下脚本中的路径。
Bash
将以下内容添加到.bashrc
中(Mac 上为.profile
):
function _update_ps1() { PS1="$($GOPATH/bin/powerline-go -error $? -jobs $(jobs -p | wc -l))" # Uncomment the following line to automatically clear errors after showing # them once. This not only clears the error for powerline-go, but also for # everything else you run in that shell. Don't enable this if you're not # sure this is what you want. #set "?" } if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi
目前,使用 bash 时不支持右键提示。
ZSH
将以下内容添加到.zshrc
:
function powerline_precmd() { PS1="$($GOPATH/bin/powerline-go -error $? -jobs ${${(%):%j}:-0})" # Uncomment the following line to automatically clear errors after showing # them once. This not only clears the error for powerline-go, but also for # everything else you run in that shell. Don't enable this if you're not # sure this is what you want. #set "?" } function install_powerline_precmd() { for s in "${precmd_functions[@]}"; do if [ "$s" = "powerline_precmd" ]; then return fi done precmd_functions+=(powerline_precmd) } if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then install_powerline_precmd fi
Fish
重新在~/.config/fish/config.fish
中定义fish_prompt
:
function fish_prompt eval $GOPATH/bin/powerline-go -error $status -jobs (count (jobs -p)) end
评论
goldmark用 Go 语言编写的 markdown 解析器
goldmark是用Go语言编写的markdown解析器。易于扩展,符合标准(CommonMark),结构合理。特性:符合标准:goldmark完全符合最新的CommonMark规范可扩展:可以轻松地
goldmark用 Go 语言编写的 markdown 解析器
0
GoAWK用 Go 编写的 AWK 解释器
GoAWK是一个用Go编写的符合POSIX标准的AWK解释器。AWK是一种文本处理语言,GoAWK作者受《AWK编程语言》这本书启发,用Go为它编写了一个解释器。目前,其功能已经完善,并经过了"the
GoAWK用 Go 编写的 AWK 解释器
0
Ponzu用 Go 编写的开源 HTTP 服务器框架
Ponzu 是一个强大而高效的开源 HTTP 服务器框架和 CMS。它提供自动、免费和安全的基于 T
Ponzu用 Go 编写的开源 HTTP 服务器框架
0
Ponzu用 Go 编写的开源 HTTP 服务器框架
Ponzu是一个强大而高效的开源HTTP服务器框架和CMS。它提供自动、免费和安全的基于TLS的HTTP/2(通过 Let'sEncrypt 获得的证书 )、一个有用的CMS和脚手架来生成内容编辑器,
Ponzu用 Go 编写的开源 HTTP 服务器框架
0