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

最新文章

  1. 转的: 重绘ListView 修改标题颜色
  2. [SharePoint] SharePoint 错误集 3
  3. Git 怎样保证fork出来的project和原project(上游项目)同步更新
  4. spring配置详解
  5. 大型网站的 HTTPS 实践(四)——协议层以外的实践
  6. SQLite 删除表(http://www.w3cschool.cc/sqlite/sqlite-drop-table.html)
  7. 《DenseNet Models for Tiny ImageNet Classification》课程设计论文
  8. 重定向printf
  9. 揭秘IT人才特点:中美印日四国程序员比较
  10. sublime text3 批量查找替换文件夹或项目中的字符
  11. odoo 开发基础 -- 视图之xpath语法
  12. 《网路对抗》Exp8 WEB基础实践
  13. play framework系列之maven 构建
  14. tableView删除功能小记
  15. 关于不同应用程序存储IO类型的描述
  16. zabbix_get :command not found 解决办法
  17. 解决 command not found: express
  18. WPF-MVVM学习心德(WinForm转WPF心德)
  19. greenplum导数据
  20. Problem J: 求方程的解——C语言初学者百题大战之十五

热门文章

  1. hdu 6025 前缀 后缀 gcd
  2. XML:使用cxf调用WebService接口时报错:编码GBK的不可映射字符(设置UTF-8字符集)
  3. Spring:Spring-AOP简介
  4. python之struct详解
  5. [心得体会]mysql复习
  6. shell 中的for循环
  7. [转]CURL常用命令
  8. js--ES6新特性之解构
  9. 「BZOJ2839」集合计数
  10. C++11 左值引用和右值引用与引用折叠和完美转发