首先介绍一下我的wsl linux系统: archLinux 终端显示 windowsTerminal
安装zsh
sudo pacman -S zsh 在此之后,修改默认shell为zsh
chsh -s $(which zsh)
安装ohmyzsh
安装 antigen
注:安装 antigen 时会从 github 下载文件,准备好代理软件。
使用 antigen 管理 zsh 的插件:
需要吧yay的源换回自己的,再用翻墙的
yay --aururl "https://aur.archlinux.org" --save
pc yay -S antigen
往~/.zshrc中添加如下内容,以启用历史命令、按键绑定、命令补全、语法高亮、powerlevel10k 主题:
# 初始化 antigen
source /usr/share/zsh/share/antigen.zsh
# Load the oh-my-zsh's library
# oh-my-zsh 会启用历史命令、按键绑定等功能
antigen use oh-my-zsh
# 启用一些 bundle
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle git
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found
antigen bundle z
antigen bundle paulirish/git-open
eval "$(starship init zsh)"
然后pc zsh,antigen 就会给你安装插件,安装完后就会开始让你选择 powerlevel10k 的主题样式,如果没出
配置starship
mkdir -p ~/.config && touch ~/.config/starship.toml
添加到startship.toml
# Inserts a blank line between shell prompts
add_newline = true
# Customizing the prompt
format = """
$username\
$hostname\
$shlvl\
$singularity\
$kubernetes\
$directory\
$vcsh\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$hg_branch\
$docker_context\
$package\
$cmake\
$cobol\
$dart\
$deno\
$dotnet\
$elixir\
$elm\
$erlang\
$golang\
$helm\
$java\
$julia\
$kotlin\
$lua\
$nim\
$nodejs\
$ocaml\
$perl\
$php\
$pulumi\
$purescript\
$python\
$rlang\
$red\
$ruby\
$rust\
$scala\
$swift\
$terraform\
$vlang\
$vagrant\
$zig\
$nix_shell\
$conda\
$memory_usage\
$aws\
$gcloud\
$openstack\
$azure\
$env_var\
$crystal\
$custom\
$sudo\
$cmd_duration\
$line_break\
$jobs\
$battery\
$time\
$status\
$shell\
[$character](bold green)"""
# Configure if and how the time is shown
[time]
disabled = false
time_format = "%T"
format = "🕙[$time ](bold blue)"
[sudo]
disabled = false
style = "bold green"
symbol = "💪"
format = "[<SUDO>$symbol]($style)"
[status]
disabled = false
style = "bg:blue"
symbol = "🔴"
map_symbol = true
format = '[\[$symbol $common_meaning$signal_name$maybe_int\]]($style) '
下面看看效果图