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

Oh MyZsh 是什么


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

Zsh 是什么


Zsh 兼容 Bash,据传说 99% 的 Bash 操作 和 Zsh 是相同的
Zsh 官网:http://www.zsh.org/
先看下你的 Linux支持哪些 shell:cat /etc/shells,正常结果应该是这样的:。

Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第1张图片

Zsh 安装


CentOS 安装:

sudo yum install -y zsh

Ubuntu 安装:

sudo apt-get install -y zsh

zsh 虽然功能强大,但刚上手配置比较麻烦。所以我们用 Oh My Zsh 替换掉 Zsh。

安装 Oh My Zsh


sudo apt install -y git
sudo apt install  -y zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
chsh -s /usr/bin/zsh

主题


在Oh My Zsh世界的早期,我们可能已经有点过于主题了。我们现在捆绑了超过一百个主题。他们中的大多数都在维基上有截图。去看一下!


选择主题

Robby的主题是默认主题。这不是最高兴的。这不是最简单的一个。这是正确的(对他来说)。

找到您想要使用的主题后,您需要编辑该~/.zshrc文件。您将在其中看到一个环境变量(全部大写),如下所示:

ZSH_THEME="robbyrussell"

要使用其他主题,只需更改值即可匹配所需主题的名称。例如:

#ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster

注意:许多主题需要安装Powerline字体才能正确显示。

打开一个新的终端窗口,您的提示应如下所示:
Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第2张图片

如果你感觉很活跃,每次打开一个新的终端窗口时,你可以让电脑随机选择一个。

ZSH_THEME="random" # (...please let it be pie... please be some pie..)

如果你想从你最喜欢的主题列表中选择随机主题:

ZSH_THEME_RANDOM_CANDIDATES=(
"robbyrussell"
"agnoster"
)

点击查看更多主题样式

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
 
# Path to your oh-my-zsh installation.
  export ZSH=/home/amoscykl/.oh-my-zsh
 
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# zhs的主题
ZSH_THEME="mikeh"		
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
 
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
 
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
 
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
 
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
 
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
 
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
 
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
 
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
 
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
 
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
 
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
 
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
 
# z命令快速跳转目录     x命令解压一切文件         命令行可以直接google  
plugins=(
  git z zsh-autosuggestions extract web-search zsh-syntax-highlighting 
)
 
source $ZSH/oh-my-zsh.sh
 
# User configuration
 
# export MANPATH="/usr/local/man:$MANPATH"
 
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
 
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi
 
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
 
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
 
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#
# 自动更新的时间间隔,单位是天,这里设置 30 天更新一次
export UPDATE_ZSH_DAYS=1

最终效果:

主题:
Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第3张图片

自动补全
Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第4张图片

z命令快速跳转目录(根据记录):

Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第5张图片

x命令自动解压各种压缩文件,不用再牢记繁杂的解压命令!
Ubuntu 18.04 安装配置Oh My Zsh 主题设置_第6张图片

你可能感兴趣的:(Linux,CentOS,Ubuntu)