先看效果:

(如果你好奇这个和mobaxterm自带的终端极其相像那就对了,我就是按那个样子改的)

1.安装

1.1先安装zsh shell:

输入以下命令:

sudo apt-get install zsh

1.2安装oh-my-zsh:

1.2.1 情况1:

你可以流畅的访问github

你需要访问这个网址正常来说你会看到这个:

你应该复制这个命令,直接输入到终端里,应该就可以安装oh-my-zsh

1.2.2 情况2:

上述情况在你那里不存在

Ps:也就是克隆不下来

输入以下命令:

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
#这一步是克隆项目到“~/”位置
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
#这一步是将配置文件复制到指定位置

然后将zsh设为默认:

chsh -s /bin/zsh

3.更该主题

安装了oh-my-zsh后,你会发现:哇!我的shell竟然变得这么好看!但是,事实上,有更多更好看的主题在等着你呢!一起来看看吧!

编辑~/.zshrc文件输入以下命令:

vim ~/.zshrc

其内容是这样的:(除去了注释)

export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh

其中的第二行的引号里就是主题的名称。如果大家打开~/.oh-my-zsh/themes文件夹,就能够看到各个主题的名称。Ps:因为比较多,我就不列出来了。比如我改成了:

ZSH_THEME="agnoster"

4.查看当前主题

echo$ZSH_THEME

2.修改主题(围绕agnoster做修改)

2.1安装插件

也许有人在开始的地方注意到了我的终端中出现了自动补全。这是安装了autojump插件的原因,下面是安装教程:输入以下命令:

sudo apt-get install autojump

然后把~/.zshrc文件中的

plugins=(git)

改为

plugins=(git autojump)

并在文件末尾添加

. /usr/share/autojump/autojump.sh

和主题一样,oh-my-zsh预装了一些插件,详情可以打开~/.oh-my-zsh/plugins文件夹查询。

如果想安装其他插件,可以修改plugins=()这一行,将插件名称用空格隔开。推荐插件:

https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins https://github.com/unixorn/awesome-zsh-plugins https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins-Overview

2.2其他小功能

2.2.1终端显示时间

2.2.2终端显示日期

2.2.3终端显示小图标及分块颜色调整

上述小功能已整理成现成配置文件(~/.oh-my-zsh/themes/agnoster.zsh-theme)如下,仅需替换你系统里的对应文件即可:

# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
# uses changed in 2012, and older versions will display incorrectly,
# in confusing ways.
#
# In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
# using it on Mac OS X, [iTerm 2](https://iterm2.com/) over Terminal.app -
# it has significantly better color fidelity.
#
# If using with "light" variant of the Solarized color schema, set
# SOLARIZED_THEME variable to "light". If you don't specify, we'll assume
# you're using the "dark" variant.
#
# # Goals
#
# The aim of this theme is to only show you *relevant* information. Like most
# prompts, it will only show git information when in a git working directory.
# However, it goes a step further: everything from the current user and
# hostname to whether the last call exited with an error to whether background
# jobs are running in this shell will all be displayed automatically when
# appropriate.
​
### Segment drawing
# A few utility functions to make it easy and re-usable to draw segmented prompts
​
CURRENT_BG='NONE'
​
case ${SOLARIZED_THEME:-dark}inlight) CURRENT_FG='white';;*)     CURRENT_FG='black';;
esac
​
# Special Powerline characters
​
() {local LC_ALL=""LC_CTYPE="en_US.UTF-8"# NOTE: This segment separator character is correct.  In 2012, Powerline changed# the code points they use for their special characters. This is the new code point.# If this is not working for you, you probably have an old version of the# Powerline-patched fonts installed. Download and install the new version.# Do not submit PRs to change this unless you have reviewed the Powerline code point# history and have new information.# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of# what font the user is viewing this source code in. Do not replace the# escape sequence with a single literal character.# Do not change this! Do not make it '\u2b80'; that is the old, wrong code point.SEGMENT_SEPARATOR=$'\ue0b0'
}
​
# Begin a segment
# Takes two arguments, background and foreground. Both can be omitted,
# rendering default background/foreground.
prompt_segment() {local bg fg[[ -n$1 ]] && bg="%K{$1}" || bg="%k"[[ -n$2 ]] && fg="%F{$2}" || fg="%f"if [[ $CURRENT_BG !='NONE' && $1 !=$CURRENT_BG ]]; thenecho-n" %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "elseecho-n"%{$bg%}%{$fg%} "fiCURRENT_BG=$1[[ -n$3 ]] && echo-n$3
}
​
# End the prompt, closing any open segments
prompt_end() {if [[ -n$CURRENT_BG ]]; thenecho-n" %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"elseecho-n"%{%k%}"fiecho-n"%{%f%}"CURRENT_BG=''
}
​
### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown
​
# Context: user@hostname (who am I and where am I)
prompt_context() {if [[ "$USERNAME" !="$DEFAULT_USER" || -n"$SSH_CLIENT" ]]; thenprompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"fi
}
​
# Git: branch/detached head, dirty status
prompt_git() {(( $+commands[git] )) || returnif [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)"=1 ]]; thenreturnfilocal PL_BRANCH_CHAR() {local LC_ALL=""LC_CTYPE="en_US.UTF-8"PL_BRANCH_CHAR=$'\ue0a0'         # }local ref dirty mode repo_path
​if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)"="true" ]]; thenrepo_path=$(git rev-parse --git-dir 2>/dev/null)dirty=$(parse_git_dirty)ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"if [[ -n$dirty ]]; thenprompt_segment yellow blackelseprompt_segment green $CURRENT_FGfi
​local ahead behindahead=$(git log --oneline @{upstream}.. 2>/dev/null)behind=$(git log --oneline ..@{upstream} 2>/dev/null)if [[ -n"$ahead" ]] && [[ -n"$behind" ]]; thenPL_BRANCH_CHAR=$'\u21c5'elif [[ -n"$ahead" ]]; thenPL_BRANCH_CHAR=$'\u21b1'elif [[ -n"$behind" ]]; thenPL_BRANCH_CHAR=$'\u21b0'fi
​if [[ -e"${repo_path}/BISECT_LOG" ]]; thenmode=" <B>"elif [[ -e"${repo_path}/MERGE_HEAD" ]]; thenmode=" >M<"elif [[ -e"${repo_path}/rebase" || -e"${repo_path}/rebase-apply" || -e"${repo_path}/rebase-merge" || -e"${repo_path}/../.dotest" ]]; thenmode=" >R>"fi
​setopt promptsubstautoload -Uz vcs_info
​zstyle ':vcs_info:*' enable gitzstyle ':vcs_info:*' get-revision truezstyle ':vcs_info:*' check-for-changes truezstyle ':vcs_info:*' stagedstr '✚'zstyle ':vcs_info:*' unstagedstr '±'zstyle ':vcs_info:*' formats ' %u%c'zstyle ':vcs_info:*' actionformats ' %u%c'vcs_infoecho-n"${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"fi
}
​
prompt_bzr() {(( $+commands[bzr] )) || return
​# Test if bzr repository in directory hierarchylocal dir="$PWD"while [[ ! -d"$dir/.bzr" ]]; do[[ "$dir"="/" ]] && returndir="${dir:h}"done
​local bzr_status status_mod status_all revisionifbzr_status=$(bzr status 2>&1); thenstatus_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}if [[ $status_mod-gt0 ]] ; thenprompt_segment yellow black "bzr@$revision ✚"elseif [[ $status_all-gt0 ]] ; thenprompt_segment yellow black "bzr@$revision"elseprompt_segment green black "bzr@$revision"fififi
}
​
prompt_hg() {(( $+commands[hg] )) || returnlocal rev st branchif$(hg id >/dev/null 2>&1); thenif$(hg prompt >/dev/null 2>&1); thenif [[ $(hg prompt "{status|unknown}")="?" ]]; then# if files are not addedprompt_segment red whitest='±'elif [[ -n$(hg prompt "{status|modified}") ]]; then# if any modificationprompt_segment yellow blackst='±'else# if working copy is cleanprompt_segment green $CURRENT_FGfiecho-n${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%}$stelsest=""rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')branch=$(hg id -b 2>/dev/null)if`hg st | grep -q "^\?"`; thenprompt_segment red blackst='±'elif`hg st | grep -q "^[MA]"`; thenprompt_segment yellow blackst='±'elseprompt_segment green $CURRENT_FGfiecho-n"☿ ${rev:gs/%/%%}@${branch:gs/%/%%}"$stfifi
}
​
# Dir: current working directory
prompt_dir() {prompt_segment blue $CURRENT_FG'%~'
}
​
# Virtualenv: current working virtualenv
prompt_virtualenv() {if [[ -n"$VIRTUAL_ENV" && -n"$VIRTUAL_ENV_DISABLE_PROMPT" ]]; thenprompt_segment blue black "(${VIRTUAL_ENV:t:gs/%/%%})"fi
}
​
# Status:
# - was there an error
# - am I root
# - are there background jobs?
prompt_status() {local -a symbols
​#[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘												

ubuntu终端美化之zsh/oh-my-zsh相关推荐

  1. linux终端界面美化,Ubuntu 18.04系统美化记录:Grub2\主题\登录界面\终端美化

    初装Ubuntu 18.04系统后想美化操作系统,该怎么做?以下为你介绍Ubuntu 18.04美化一体化:Grub2美化.主题美化.登录界面美化.终端美化.以下美化仅是初级介绍,如果需要更多请看Li ...

  2. 【Ubuntu】Ubuntu16.04的主题和终端美化

    1 主题美化 1.1 安装 unity-tweak-tool 首先安装桌面管理工具unity-tweak-tool: sudo apt-get install unity-tweak-tool 1.2 ...

  3. Ubuntu 18.04 安装配置Oh My Zsh 主题设置

    Oh MyZsh 是什么 Oh My Zsh 是一个开源的,社区驱动的框架,用于管理zsh配置 Oh My Zsh,官网地址 Oh My Zsh ,GitHub 地址 Zsh 是什么 Zsh 兼容 B ...

  4. linux ubuntu 22.04 搜狗输入法 无法输入中文 zsh 冲突 解决方案

    linux ubuntu 22.04 搜狗输入法 无法输入中文 zsh 冲突 解决方案 今天在 Linux 系统 Ubuntu 22.04 环境下部署开发环境,发现搜狗输入法突然无法输入中文,切换到搜 ...

  5. 我的 Mac 终端配置(Mac OSX + iTerm2 + Zsh + Oh-My-Zsh)

    相关工具介绍 iTerm2:Mac 下 Terminal 终端的替代品,拥有更多强大的功能,想了解更多请戳 iTerm2 官网: zsh:Linux 的一种 shell 外壳,和 bash 属于同类产 ...

  6. proteus虚拟终端窗口不显示_Linux终端美化工具(ohmyzsh)

    先上一张自己终端的图片. https://ohmyz.sh/ 安装方法在最后 先明确几个概念 这些概念本身有着非常浓厚的历史气息,随着时代的发展,他们的含义也在发生改变,它们有些已经失去了最初的含义, ...

  7. centos7花里胡哨之终端美化

    centos7花里胡哨之终端美化 只想整天学习 2019-10-06 17:57:03  4872  收藏 27 分类专栏: RHEL7 文章标签: zsh主题设置 centos7终端美化 版权 很多 ...

  8. macos终端美化_关于macOS终端美化的最轻松的指南Z Shell中的速成课程

    macos终端美化 Speeding it up more than the standard bash terminal that comes with your MacOS by using iT ...

  9. Linux终端美化工具(oh-my-zsh)

    先上一张自己终端的图片. https://ohmyz.sh/ 安装方法在最后 先明确几个概念 这些概念本身有着非常浓厚的历史气息,随着时代的发展,他们的含义也在发生改变,它们有些已经失去了最初的含义, ...

最新文章

  1. C#字节数组与值类型变量的互相转换,以及注意事项
  2. 学会这个技能,副业加 1 万不是问题,30 本理财秘籍免费领取(速领)
  3. android ListView适配器之SimpleAdapter的用法
  4. 谈谈这些年前端的变化
  5. Linux 下如何查询 tomcat 的安装目录
  6. 微软Visual Studio2005开发工具路线图详解
  7. springboot a service调用b service_CaaS: 内容是新的基础设施 Content-as-a-Service
  8. ORA-27101 shared memory realm does not exist 错误处理
  9. [HDFS Manual] CH4 HDFS High Availability Using the Quorum Journal Manager
  10. Java设计模式学习总结(11)——结构型模式之装饰器模式
  11. 【转】larbin的设计原理
  12. mysql查询数据教程_mysql数据库的查询
  13. pytorch编写cuda/c++ extention 方法
  14. React基础-React中发送Ajax请求以及Mock数据
  15. 【Java】绘图入门和机制,绘图方法演示(绘制坦克)
  16. ubuntu18下载utuntu18镜像
  17. PDF阅读软件里面的小手工具打开/关闭
  18. SSMS安装失败及解决
  19. gif图怎么压缩大小?在线压缩gif技巧
  20. 计算机网络中删除自己的共享,如何删除我的电脑中共享文档

热门文章

  1. Linux - 易错知识点整理(待更新)
  2. 2022年在uniapp中引入vant Weapp
  3. 小程序接入vant Weapp组件的详细步骤
  4. android 提示样式,我怎样才能让android spinner提示样式
  5. 三相桥式全控整流电路 matlab,三相全控桥式整流电路Matlab仿真
  6. 100、网页端的人脸识别
  7. Windows 安装,配置Tomcat
  8. Telegram计划于3月推出区块链平台
  9. ssm毕设项目民宿平台bwla1(java+VUE+Mybatis+Maven+Mysql+sprnig)
  10. 如何将图片转换jpg格式?详细步骤