Ubuntu22.04使用zsh+oh my zsh+Powerlevel10k主题

2023-10-25 11:10

本文主要是介绍Ubuntu22.04使用zsh+oh my zsh+Powerlevel10k主题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Ubuntu22.04使用zsh+oh my zsh+Powerlevel10k主题

  • **oh-my-zsh**
  • 1、字体安装
    • 1.1、安装nerd font
  • 2、安装zsh
  • 3、安装oh-my-zsh
  • 4、安装Powerlevel10k主题
    • 4.1、配置Powerlevel10k
  • 5、安装各种插件
  • 参考链接

oh-my-zsh

Oh My Zsh是一款社区驱动的命令行工具,是基于Zsh命令行的一个扩展工具集,提供了丰富的扩展功能,如:主题配置,插件机制,内置的便捷操作等,可以给我们一种全新的命令行使用体验。
本文记录了博主安装Oh My Zsh的方法,博主使用的Linux为Ubuntu20.04,使用的主题为Powerlevel10k,配置的插件有autojump、fasd、zsh-autosuggestions、zsh-syntax-highlighting,对比安装前后效果:
在这里插入图片描述
安装前

安装后

1、字体安装

## 1.1、安装mkfontscale mkfontdir和fc-cache命令
如果运行mkfontscale命令时终端提示mkfontscale: command not found,则需要首先安装这个命令,安装方法如下:

# 使mkfontscale和mkfontdir命令正常运行
sudo apt-get install ttf-mscorefonts-installer
# 使fc-cache命令正常运行
sudo apt-get install fontconfig

## 1.2、下载字体文件

	wget -c https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/SourceCodePro.zip或者:git clone https://github.com/blobject/agave.git

如果运行wget、git命令时终端提示wget、git: command not found,则需要首先安装这个命令,安装方法如下:

sudo apt install wget git -y

## 1.3、然后解压到文件夹

	sudo unzip SourceCodePro -d /usr/share/fonts/SourceCodePro或者:sudo cp agave/*.ttf /usr/share/fonts/

## 1.4、转到/usr/share/fonts/SourceCodePro目录,并安装

	cd /usr/share/fonts/SourceCodePro或者cd /usr/share/fonts/agavesudo mkfontscale # 生成核心字体信息sudo mkfontdir # 生成字体文件夹sudo fc-cache -fv # 刷新系统字体缓存

1.1、安装nerd font

因为以上字体都会缺少符号,nerd font是一个非常棒的字体库,而且对p10k的兼容性非常好,如果不想费事的话,强烈推荐安装这个。

# git 克隆字体库
git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1
# 打开文件夹
cd nerd-fonts
# 安装字体
./install.sh

2、安装zsh

安装Zsh并将Zsh设置为默认shell:

# 安装zsh
sudo apt install zsh
# 然后将zsh设置为默认shell:
chsh -s /bin/zsh

PS:

  • echo $SHELL: 可以通过echo $SHELL查看当前默认的shell,如果没有改为/bin/zsh,需要重启shell。
  • cat /etc/shells: 查看系统内已安装的shell
  • xdg-open fileOrDir: 用GUI文件管理器或编辑器打开指定的的文件或目录

3、安装oh-my-zsh

# 方式一
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
# 方式二
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
bash ./install.sh

如果以上方法都不行就使用第三种方法:

#!/bin/sh
#
# This script should be run via curl:
#   sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via wget:
#   sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via fetch:
#   sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
#   wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
#   sh install.sh
#
# You can tweak the install behavior by setting variables when running the script. For
# example, to change the path to the Oh My Zsh repository:
#   ZSH=~/.zsh sh install.sh
#
# Respects the following environment variables:
#   ZSH     - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
#   REPO    - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
#   REMOTE  - full remote URL of the git repo to install (default: GitHub via HTTPS)
#   BRANCH  - branch to check out immediately after install (default: master)
#
# Other options:
#   CHSH       - 'no' means the installer will not change the default shell (default: yes)
#   RUNZSH     - 'no' means the installer will not run zsh after the install (default: yes)
#   KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
#
# You can also pass some arguments to the install script to set some these options:
#   --skip-chsh: has the same behavior as setting CHSH to 'no'
#   --unattended: sets both CHSH and RUNZSH to 'no'
#   --keep-zshrc: sets KEEP_ZSHRC to 'yes'
# For example:
#   sh install.sh --unattended
# or:
#   sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
#
set -e# Make sure important variables exist if not already defined
#
# $USER is defined by login(1) which is not always executed (e.g. containers)
# POSIX: https://pubs.opengroup.org/onlinepubs/009695299/utilities/id.html
USER=${USER:-$(id -u -n)}
# $HOME is defined at the time of login, but it could be unset. If it is unset,
# a tilde by itself (~) will not be expanded to the current user's home directory.
# POSIX: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html#tag_08_03
HOME="${HOME:-$(getent passwd $USER 2>/dev/null | cut -d: -f6)}"
# macOS does not have getent, but this works even if $HOME is unset
HOME="${HOME:-$(eval echo ~$USER)}"# Track if $ZSH was provided
custom_zsh=${ZSH:+yes}# Default settings
ZSH="${ZSH:-$HOME/.oh-my-zsh}"
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}# Other options
CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes}
KEEP_ZSHRC=${KEEP_ZSHRC:-no}command_exists() {command -v "$@" >/dev/null 2>&1
}user_can_sudo() {# Check if sudo is installedcommand_exists sudo || return 1# The following command has 3 parts:## 1. Run `sudo` with `-v`. Does the following:#    • with privilege: asks for a password immediately.#    • without privilege: exits with error code 1 and prints the message:#      Sorry, user <username> may not run sudo on <hostname>## 2. Pass `-n` to `sudo` to tell it to not ask for a password. If the#    password is not required, the command will finish with exit code 0.#    If one is required, sudo will exit with error code 1 and print the#    message:#    sudo: a password is required## 3. Check for the words "may not run sudo" in the output to really tell#    whether the user has privileges or not. For that we have to make sure#    to run `sudo` in the default locale (with `LANG=`) so that the message#    stays consistent regardless of the user's locale.#! LANG= sudo -n -v 2>&1 | grep -q "may not run sudo"
}# The [ -t 1 ] check only works when the function is not called from
# a subshell (like in `$(...)` or `(...)`, so this hack redefines the
# function at the top level to always return false when stdout is not
# a tty.
if [ -t 1 ]; thenis_tty() {true}
elseis_tty() {false}
fi# This function uses the logic from supports-hyperlinks[1][2], which is
# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0.
# [1] https://github.com/zkat/supports-hyperlinks
# [2] https://crates.io/crates/supports-hyperlinks
#
# Copyright (c) 2021 Kat Marchán
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
supports_hyperlinks() {# $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass)if [ -n "$FORCE_HYPERLINK" ]; then[ "$FORCE_HYPERLINK" != 0 ]return $?fi# If stdout is not a tty, it doesn't support hyperlinksis_tty || return 1# DomTerm terminal emulator (domterm.org)if [ -n "$DOMTERM" ]; thenreturn 0fi# VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc)if [ -n "$VTE_VERSION" ]; then[ $VTE_VERSION -ge 5000 ]return $?fi# If $TERM_PROGRAM is set, these terminals support hyperlinkscase "$TERM_PROGRAM" inHyper|iTerm.app|terminology|WezTerm) return 0 ;;esac# kitty supports hyperlinksif [ "$TERM" = xterm-kitty ]; thenreturn 0fi# Windows Terminal also supports hyperlinksif [ -n "$WT_SESSION" ]; thenreturn 0fi# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected# https://github.com/ohmyzsh/ohmyzsh/issues/10964# if [ -n "$KONSOLE_VERSION" ]; then#   return 0# fireturn 1
}# Adapted from code and information by Anton Kochkov (@XVilka)
# Source: https://gist.github.com/XVilka/8346728
supports_truecolor() {case "$COLORTERM" intruecolor|24bit) return 0 ;;esaccase "$TERM" initerm           |\tmux-truecolor  |\linux-truecolor |\xterm-truecolor |\screen-truecolor) return 0 ;;esacreturn 1
}fmt_link() {# $1: text, $2: url, $3: fallback modeif supports_hyperlinks; thenprintf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"returnficase "$3" in--text) printf '%s\n' "$1" ;;--url|*) fmt_underline "$2" ;;esac
}fmt_underline() {is_tty && printf '\033[4m%s\033[24m\n' "$*" || printf '%s\n' "$*"
}# shellcheck disable=SC2016 # backtick in single-quote
fmt_code() {is_tty && printf '`\033[2m%s\033[22m`\n' "$*" || printf '`%s`\n' "$*"
}fmt_error() {printf '%sError: %s%s\n' "${FMT_BOLD}${FMT_RED}" "$*" "$FMT_RESET" >&2
}setup_color() {# Only use colors if connected to a terminalif ! is_tty; thenFMT_RAINBOW=""FMT_RED=""FMT_GREEN=""FMT_YELLOW=""FMT_BLUE=""FMT_BOLD=""FMT_RESET=""returnfiif supports_truecolor; thenFMT_RAINBOW="$(printf '\033[38;2;255;0;0m')$(printf '\033[38;2;255;97;0m')$(printf '\033[38;2;247;255;0m')$(printf '\033[38;2;0;255;30m')$(printf '\033[38;2;77;0;255m')$(printf '\033[38;2;168;0;255m')$(printf '\033[38;2;245;0;172m')"elseFMT_RAINBOW="$(printf '\033[38;5;196m')$(printf '\033[38;5;202m')$(printf '\033[38;5;226m')$(printf '\033[38;5;082m')$(printf '\033[38;5;021m')$(printf '\033[38;5;093m')$(printf '\033[38;5;163m')"fiFMT_RED=$(printf '\033[31m')FMT_GREEN=$(printf '\033[32m')FMT_YELLOW=$(printf '\033[33m')FMT_BLUE=$(printf '\033[34m')FMT_BOLD=$(printf '\033[1m')FMT_RESET=$(printf '\033[0m')
}setup_ohmyzsh() {# Prevent the cloned repository from having insecure permissions. Failing to do# so causes compinit() calls to fail with "command not found: compdef" errors# for users with insecure umasks (e.g., "002", allowing group writability). Note# that this will be ignored under Cygwin by default, as Windows ACLs take# precedence over umasks except for filesystems mounted with option "noacl".umask g-w,o-wecho "${FMT_BLUE}Cloning Oh My Zsh...${FMT_RESET}"command_exists git || {fmt_error "git is not installed"exit 1}ostype=$(uname)if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -Eq 'msysgit|windows'; thenfmt_error "Windows/MSYS Git is not supported on Cygwin"fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"exit 1fi# Manual clone with git config options to support git < v1.7.2git init --quiet "$ZSH" && cd "$ZSH" \&& git config core.eol lf \&& git config core.autocrlf false \&& git config fsck.zeroPaddedFilemode ignore \&& git config fetch.fsck.zeroPaddedFilemode ignore \&& git config receive.fsck.zeroPaddedFilemode ignore \&& git config oh-my-zsh.remote origin \&& git config oh-my-zsh.branch "$BRANCH" \&& git remote add origin "$REMOTE" \&& git fetch --depth=1 origin \&& git checkout -b "$BRANCH" "origin/$BRANCH" || {[ ! -d "$ZSH" ] || {cd -rm -rf "$ZSH" 2>/dev/null}fmt_error "git clone of oh-my-zsh repo failed"exit 1}# Exit installation directorycd -echo
}setup_zshrc() {# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones# with datestamp of installation that moved them aside, so we never actually# destroy a user's original zshrcecho "${FMT_BLUE}Looking for an existing zsh config...${FMT_RESET}"# Must use this exact name so uninstall.sh can find itOLD_ZSHRC=~/.zshrc.pre-oh-my-zshif [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then# Skip this if the user doesn't want to replace an existing .zshrcif [ "$KEEP_ZSHRC" = yes ]; thenecho "${FMT_YELLOW}Found ~/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}"returnfiif [ -e "$OLD_ZSHRC" ]; thenOLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"if [ -e "$OLD_OLD_ZSHRC" ]; thenfmt_error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"fmt_error "re-run the installer again in a couple of seconds"exit 1fimv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"echo "${FMT_YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \"${FMT_GREEN}Backing up to ${OLD_OLD_ZSHRC}${FMT_RESET}"fiecho "${FMT_YELLOW}Found ~/.zshrc.${FMT_RESET} ${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"mv ~/.zshrc "$OLD_ZSHRC"fiecho "${FMT_GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${FMT_RESET}"# Replace $HOME path with '$HOME' in $ZSH variable in .zshrc fileomz=$(echo "$ZSH" | sed "s|^$HOME/|\$HOME/|")sed "s|^export ZSH=.*$|export ZSH=\"${omz}\"|" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztempmv -f ~/.zshrc-omztemp ~/.zshrcecho
}setup_shell() {# Skip setup if the user wants or stdin is closed (not running interactively).if [ "$CHSH" = no ]; thenreturnfi# If this user's login shell is already "zsh", do not attempt to switch.if [ "$(basename -- "$SHELL")" = "zsh" ]; thenreturnfi# If this platform doesn't provide a "chsh" command, bail out.if ! command_exists chsh; thencat <<EOF
I can't change your shell automatically because this system does not have chsh.
${FMT_BLUE}Please manually change your default shell to zsh${FMT_RESET}
EOFreturnfiecho "${FMT_BLUE}Time to change your default shell to zsh:${FMT_RESET}"# Prompt for user choice on changing the default login shellprintf '%sDo you want to change your default shell to zsh? [Y/n]%s ' \"$FMT_YELLOW" "$FMT_RESET"read -r optcase $opt iny*|Y*|"") ;;n*|N*) echo "Shell change skipped."; return ;;*) echo "Invalid choice. Shell change skipped."; return ;;esac# Check if we're running on Termuxcase "$PREFIX" in*com.termux*) termux=true; zsh=zsh ;;*) termux=false ;;esacif [ "$termux" != true ]; then# Test for the right location of the "shells" fileif [ -f /etc/shells ]; thenshells_file=/etc/shellselif [ -f /usr/share/defaults/etc/shells ]; then # Solus OSshells_file=/usr/share/defaults/etc/shellselsefmt_error "could not find /etc/shells file. Change your default shell manually."returnfi# Get the path to the right zsh binary# 1. Use the most preceding one based on $PATH, then check that it's in the shells file# 2. If that fails, get a zsh path from the shells file, then check it actually existsif ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; thenif ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; thenfmt_error "no zsh binary found or not present in '$shells_file'"fmt_error "change your default shell manually."returnfififi# We're going to change the default shell, so back up the current oneif [ -n "$SHELL" ]; thenecho "$SHELL" > ~/.shell.pre-oh-my-zshelsegrep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zshfiecho "Changing your shell to $zsh..."# Check if user has sudo privileges to run `chsh` with or without `sudo`## This allows the call to succeed without password on systems where the# user does not have a password but does have sudo privileges, like in# Google Cloud Shell.## On systems that don't have a user with passwordless sudo, the user will# be prompted for the password either way, so this shouldn't cause any issues.#if user_can_sudo; thensudo -k chsh -s "$zsh" "$USER"  # -k forces the password promptelsechsh -s "$zsh" "$USER"          # run chsh normallyfi# Check if the shell change was successfulif [ $? -ne 0 ]; thenfmt_error "chsh command unsuccessful. Change your default shell manually."elseexport SHELL="$zsh"echo "${FMT_GREEN}Shell successfully changed to '$zsh'.${FMT_RESET}"fiecho
}# shellcheck disable=SC2183  # printf string has more %s than arguments ($FMT_RAINBOW expands to multiple arguments)
print_success() {printf '%s         %s__      %s           %s        %s       %s     %s__   %s\n'      $FMT_RAINBOW $FMT_RESETprintf '%s  ____  %s/ /_    %s ____ ___  %s__  __  %s ____  %s_____%s/ /_  %s\n'      $FMT_RAINBOW $FMT_RESETprintf '%s / __ \\%s/ __ \\  %s / __ `__ \\%s/ / / / %s /_  / %s/ ___/%s __ \\ %s\n'  $FMT_RAINBOW $FMT_RESETprintf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s   / /_%s(__  )%s / / / %s\n'      $FMT_RAINBOW $FMT_RESETprintf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s   /___/%s____/%s_/ /_/  %s\n'    $FMT_RAINBOW $FMT_RESETprintf '%s    %s        %s           %s /____/ %s       %s     %s          %s....is now installed!%s\n' $FMT_RAINBOW $FMT_GREEN $FMT_RESETprintf '\n'printf '\n'printf "%s %s %s\n" "Before you scream ${FMT_BOLD}${FMT_YELLOW}Oh My Zsh!${FMT_RESET} look over the" \"$(fmt_code "$(fmt_link ".zshrc" "file://$HOME/.zshrc" --text)")" \"file to select plugins, themes, and options."printf '\n'printf '%s\n' "• Follow us on Twitter: $(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)"printf '%s\n' "• Join our Discord community: $(fmt_link "Discord server" https://discord.gg/ohmyzsh)"printf '%s\n' "• Get stickers, t-shirts, coffee mugs and more: $(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"printf '%s\n' $FMT_RESET
}main() {# Run as unattended if stdin is not a ttyif [ ! -t 0 ]; thenRUNZSH=noCHSH=nofi# Parse argumentswhile [ $# -gt 0 ]; docase $1 in--unattended) RUNZSH=no; CHSH=no ;;--skip-chsh) CHSH=no ;;--keep-zshrc) KEEP_ZSHRC=yes ;;esacshiftdonesetup_colorif ! command_exists zsh; thenecho "${FMT_YELLOW}Zsh is not installed.${FMT_RESET} Please install zsh first."exit 1fiif [ -d "$ZSH" ]; thenecho "${FMT_YELLOW}The \$ZSH folder already exists ($ZSH).${FMT_RESET}"if [ "$custom_zsh" = yes ]; thencat <<EOFYou ran the installer with the \$ZSH setting or the \$ZSH variable is
exported. You have 3 options:1. Unset the ZSH variable when calling the installer:$(fmt_code "ZSH= sh install.sh")
2. Install Oh My Zsh to a directory that doesn't exist yet:$(fmt_code "ZSH=path/to/new/ohmyzsh/folder sh install.sh")
3. (Caution) If the folder doesn't contain important information,you can just remove it with $(fmt_code "rm -r $ZSH")EOFelseecho "You'll need to remove it if you want to reinstall."fiexit 1fisetup_ohmyzshsetup_zshrcsetup_shellprint_successif [ $RUNZSH = no ]; thenecho "${FMT_YELLOW}Run zsh to try it out.${FMT_RESET}"exitfiexec zsh -l
}main "$@"

手动将上面的代码写进install.sh文件,命令如下

#创建install.sh文件
nano install.sh
#运行install.sh文件
bash install.sh

4、安装Powerlevel10k主题

github仓库安装:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

gitee仓库安装(国内用户建议使用该安装方法):

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

4.1、配置Powerlevel10k

使用sudo nano ~/.zshrc编辑.zshrc,将ZSH_THEME项改为:

ZSH_THEME="powerlevel10k/powerlevel10k"

5、安装各种插件

5.1、autojump
更快地切换目录,不受当前所在目录的限制。
项目地址:https://github.com/wting/autojump

sudo apt install autojump

用法:

# 跳转到目录
j dir
# 可以通过GUI文件管理器打开指定目录,执行命令:
jo dir

5.2、zsh-autosuggestions
命令行命令键入时的历史命令建议插件

项目地址:https://github.com/zsh-users/zsh-autosuggestions
按照官方文档提示,直接执行如下命令安装:
国内使用gitee安装

git clone https://gitee.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

5.3、zsh-syntax-highlighting
命令行语法高亮插件

项目地址:https://github.com/zsh-users/zsh-syntax-highlighting

按照官方文档提示,国内直接执行如下命令安装:

 git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

5.4、使插件生效
上述插件安装完成后,需要修改.zshrc文件,编辑plugins项,修改如下:

# 值得注意的是,根据官方文档,zsh-syntax-highlighting 插件需放在最后
plugins=(git extract autojump zsh-autosuggestions zsh-syntax-highlighting
)

使用source ~/.zshrc命令更新。
6、总结
.zshrc配置文件最终修改内容如下:

# 设置主题
ZSH_THEME="powerlevel10k/powerlevel10k"
# 启动错误命令自动更正
ENABLE_CORRECTION="true"
# 在命令执行过程中,使用小红点进行提示
COMPLETION_WAITING_DOTS="true"
# 启用已安装的主题
plugins=(git extract autojump zsh-autosuggestions zsh-syntax-highlighting
)

参考链接

  • ubuntu 字体安装 —— 以nerd font为例
  • Ubuntu20.04 配置Oh My Zsh(Powerlevel10k主题)

这篇关于Ubuntu22.04使用zsh+oh my zsh+Powerlevel10k主题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/282162

相关文章

C++使用栈实现括号匹配的代码详解

《C++使用栈实现括号匹配的代码详解》在编程中,括号匹配是一个常见问题,尤其是在处理数学表达式、编译器解析等任务时,栈是一种非常适合处理此类问题的数据结构,能够精确地管理括号的匹配问题,本文将通过C+... 目录引言问题描述代码讲解代码解析栈的状态表示测试总结引言在编程中,括号匹配是一个常见问题,尤其是在

Java中String字符串使用避坑指南

《Java中String字符串使用避坑指南》Java中的String字符串是我们日常编程中用得最多的类之一,看似简单的String使用,却隐藏着不少“坑”,如果不注意,可能会导致性能问题、意外的错误容... 目录8个避坑点如下:1. 字符串的不可变性:每次修改都创建新对象2. 使用 == 比较字符串,陷阱满

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

使用C++实现链表元素的反转

《使用C++实现链表元素的反转》反转链表是链表操作中一个经典的问题,也是面试中常见的考题,本文将从思路到实现一步步地讲解如何实现链表的反转,帮助初学者理解这一操作,我们将使用C++代码演示具体实现,同... 目录问题定义思路分析代码实现带头节点的链表代码讲解其他实现方式时间和空间复杂度分析总结问题定义给定

Linux使用nload监控网络流量的方法

《Linux使用nload监控网络流量的方法》Linux中的nload命令是一个用于实时监控网络流量的工具,它提供了传入和传出流量的可视化表示,帮助用户一目了然地了解网络活动,本文给大家介绍了Linu... 目录简介安装示例用法基础用法指定网络接口限制显示特定流量类型指定刷新率设置流量速率的显示单位监控多个

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

如何使用Java实现请求deepseek

《如何使用Java实现请求deepseek》这篇文章主要为大家详细介绍了如何使用Java实现请求deepseek功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1.deepseek的api创建2.Java实现请求deepseek2.1 pom文件2.2 json转化文件2.2

python使用fastapi实现多语言国际化的操作指南

《python使用fastapi实现多语言国际化的操作指南》本文介绍了使用Python和FastAPI实现多语言国际化的操作指南,包括多语言架构技术栈、翻译管理、前端本地化、语言切换机制以及常见陷阱和... 目录多语言国际化实现指南项目多语言架构技术栈目录结构翻译工作流1. 翻译数据存储2. 翻译生成脚本

C++ Primer 多维数组的使用

《C++Primer多维数组的使用》本文主要介绍了多维数组在C++语言中的定义、初始化、下标引用以及使用范围for语句处理多维数组的方法,具有一定的参考价值,感兴趣的可以了解一下... 目录多维数组多维数组的初始化多维数组的下标引用使用范围for语句处理多维数组指针和多维数组多维数组严格来说,C++语言没

在 Spring Boot 中使用 @Autowired和 @Bean注解的示例详解

《在SpringBoot中使用@Autowired和@Bean注解的示例详解》本文通过一个示例演示了如何在SpringBoot中使用@Autowired和@Bean注解进行依赖注入和Bean... 目录在 Spring Boot 中使用 @Autowired 和 @Bean 注解示例背景1. 定义 Stud