Selection Criteria

  • double line;

  • provide username, hostname, current directory;

  • provide information of git branch and commit status;

  • provide command exit code;

  • prompt is easy to distinguished from command results;

  • optional: provide command order number, current time;

Customize zsh prompt

Some important escape sequences in zsh prompt:

  • %n: username;

  • %m: hostname;

  • %~: current directory;

  • %t: current time;

  • %?: return code of last command;

Customization of font and color see the following demonstration.

Ref:

Put it together

  1. Create a new file: ~/.oh-my-zsh/themes/lichao.zsh-theme:

    rc=$reset_color
    cy=$fg_bold[cyan]
    bl=$fg_bold[blue]
    re=$fg_bold[red]
    wh=$fg_bold[white]
    ye=$fg_bold[yellow]
    gr=$fg_bold[green]
    ma=$fg_bold[magenta]

    ZSH_THEME_GIT_PROMPT_PREFIX="git("
    ZSH_THEME_GIT_PROMPT_SUFFIX="):"
    ZSH_THEME_GIT_PROMPT_CLEAN=""
    ZSH_THEME_GIT_PROMPT_DIRTY="✗"
    ZSH_THEME_GIT_PROMPT_ADDED="added"
    ZSH_THEME_GIT_PROMPT_MODIFIED="modified"
    ZSH_THEME_GIT_PROMPT_DELETED="deleted"
    ZSH_THEME_GIT_PROMPT_RENAMED="renamed"
    ZSH_THEME_GIT_PROMPT_UNMERGED="unmerged"
    ZSH_THEME_GIT_PROMPT_UNTRACKED="untracked"

    PROMPT='$ye%n$rc @ $cy%m $gr%~ $re$(git_prompt_info)$(git_prompt_status)$rc $wh%t$rc
    ${wh}[%?]${rc} '

  2. Modify "ZSH_THEME" in ~/.zshrc as:

    ZSH_THEME="lichao"

Recommended Themes

kphoen: double line, display user, host, CWD, command exit code when it's nonzero, git branch and status, no time, its title line is darker than "ys", but the command and command output is the same;

ys: double line, display user, host, CWD, time, partial git information, no exit code;

bureau: double line, display user, host, CWD, time, complete git information, no exit code;

steeef: double line, display user, host, CWD, complete git information, no exit code;

rkj: double line, display user, host, CWD, time, command exit code, no git information;

duellj: double line, display user, host, CWD, command order number, time, no git information;

some other good themes includes: frisk, candy, blinks

Build a Beautiful oh-my-zsh Themes的更多相关文章

  1. [poj1113][Wall] (水平序+graham算法 求凸包)

    Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall ...

  2. 7 Must Read Python Books

    7 Must Read Python Books I started learning Python just two years ago. Coming from a C++ and Java ba ...

  3. POJ 1113:Wall

    原文链接:https://www.dreamwings.cn/poj1113/2832.html Wall Time Limit: 1000MS   Memory Limit: 10000K Tota ...

  4. hdu 1348 Wall (凸包)

    Wall Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  5. 彩色的Shell

    我常在命令行下工作,以前老被同事说"你整天在那个黑窗口上倒腾什么?" 现在这个问题变成了"你这个花花绿绿的窗口是什么东西?" 其实都是同一个东西:一个兼容于xterm的终端窗口,要么是PuTTY/Ki ...

  6. 计算几何--求凸包模板--Graham算法--poj 1113

    Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28157   Accepted: 9401 Description ...

  7. poj 1113:Wall(计算几何,求凸包周长)

    Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28462   Accepted: 9498 Description ...

  8. 【POJ】1113 Wall(凸包)

    http://poj.org/problem?id=1113 答案是凸包周长+半径为l的圆的周长... 证明?这是个坑.. #include <cstdio> #include <c ...

  9. Wall(凸包POJ 1113)

    Wall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 32360 Accepted: 10969 Description On ...

随机推荐

  1. 非静态的字段、方法或属性“System.Web.UI.Page.ClientScript.get”要求对象引用

    解决Response.Write("<script>alert('修改失败,请稍后再试!');</script>");布局错误的问题 在后台CS代码(不是C ...

  2. Docker学不会?不妨看看这篇文章

    大家好,我是辰哥! 上一篇文章(2300+字!在不同系统上安装Docker!)教大家如何在系统上安装docker,今天咱们来学习docker的基本使用. 辰哥将在本文里详细介绍docker的各种使用命 ...

  3. Docker:如何修改Docker0网桥的默认网段

    1. 背景 Docker 服务启动后默认会创建一个 docker0 网桥(其上有一个 docker0 内部接口),它在内核层连通了其他的物理或虚拟网卡,这就将所有容器和本地主机都放到同一个物理网络. ...

  4. 使用 Cron4j 表达式 在 Solon 里开发定时任务

    cron4j 是一个轻量级的Java任务调度工具.cron4j-solon-plugin 是 solon 对 cron4j 的适配插件 添加 maven 引用 <dependency> & ...

  5. http、tcp和socket简单理解

    1.Http属于应用层,主要解决如何包装数据. 2.Tcp属于传输层,主要解决数据如何在网络上传输. 3.Socket是对TCP/IP协议的封装,Socket本身并不是协议,而是一个调用接口(API) ...

  6. 小哈学Python ----XML

    XML XML是实现不同语言或程序之间进行数据交换的协议,XML文件格式如下: <data> <country name="Liechtenstein"> ...

  7. Java程序设计(2021春)——第三章类的重用笔记与思考

    Java程序设计(2021春)--第三章类的重用笔记与思考 本章概览: 3.1 类的继承(概念与语法) 3.2 Object类(在Java继承最顶层的类) 3.3 终结类和终结方法(只能拿来用,不可以 ...

  8. 华为:harmonyos 鸿蒙

    鸿蒙 1.设置--更新 2.华为搜索--抢鲜体验-下载描述文件--同意 3.更新-安装

  9. C语言:进制表示

    二进制由 0 和 1 两个数字组成,使用时必须以0b或0B(不区分大小写)开头 八进制由 0~7 八个数字组成,使用时必须以0开头(注意是数字 0,不是字母 o) 十六进制由数字 0~9.字母 A~F ...

  10. c语言字符串存储方式

    #include <stdio.h> // C 语言中,任何数据类型都不可以直接存储一个字符串.那么字符串如何存储? //在 C 语言中,字符串有两种存储方式,一种是通过字符数组存储,另一 ...