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. springboot整合拦截器如何让其不拦截默认的访问路径

    1.注册自定义拦截器2.拦截器3.控制器4.其它说明:我想做控制拦截登陆,将所有的请求拦截下来判断如果当前的session里没有用户名则跳转到登陆页面.问题是目前可以拦截所有请求了,但第一次进入登陆页 ...

  2. Linux学习之路第四天(运行级别)

    linux 实用指令 指定运行级别 运行级别说明 0 :关机 1:单用户(找回丢失密码) 2.多用户状态没有网络服务 3.多用户状态有网络服务 4.系统未保留给用户 5.图形界面 6.系统重启 常用的 ...

  3. hfctfwp(re)

    1.easy python revering 看字节码操作,昂哥直接看直接写exp太强了,我就直接手动写了个源码出来(昂哥永远滴神) arr0=[249,91,149,113,16,91,53,41, ...

  4. 两个有序数组合并为一个有序数组---python

    def merge(a, b): """ 合并2个有序数组,默认a,b都是从小到大的有序数组 """ # 1.临时变量 i, j = 0, ...

  5. STM32笔记四

    1.时钟振荡器:产生时钟信号送给单片机内部各电路,并且控制这些电路,使它们有节拍的工作. 2.ROM是一种具有存储功能的电路,断电后信息不回丢失.RAM也是一种存储电路,断电后信息丢失. 3.串行通信 ...

  6. Ubuntu中Docker的安装与使用

    Ubuntu中安装Docker 更新ubuntu的apt源索引 sudo apt-get update 2.安装包允许apt通过HTTPS使用仓库 sudo apt-get install \ apt ...

  7. Python运行时报错 ModuleNotFoundError: No module named ‘exceptions‘

    踩的坑: 搜教程,很多文章都推荐使用:pip install python_docx‑0.8.10‑py2.py3‑none‑any.whl 但是依旧报错. 成功的示范: 使用命令:pip3 inst ...

  8. Java基础00-第一个程序2

    1. 常用DOS命令 1.1 打开命令提示窗口 按下win+R 输入cmd 按下回车键 得到命令提示窗口 1.2 常用命令 2. Path环境变量的配置 2.1 为什么要配置Path环境变量 2.2 ...

  9. 动态 WebApi 引擎使用教程(3行代码完成动态 WebApi 构建)

    目录 什么是 WebApiEngine? 开源地址 使用方法 使用 [ApiBind] 标签让任何方法变成 WebApi 对 API 进行分类 自定义 API 名称 复制特性 为整个类配置 WebAp ...

  10. Guava - Set集合

    当我们在统计一个字符串中每个单词出现的次数时,通常的做法是分割字符串,遍历字符串,然后放到一个map里面,来进行统计,Guava中提供了类似功能的集合,Multiset String strWorld ...