发布于 2026-01-05 1 阅读
0

安装和配置 Zsh 和 Oh My Zsh DEV 的全球展示挑战赛,由 Mux 呈现:展示你的项目!

安装和配置 Zsh 和 Oh My Zsh

由 Mux 主办的 DEV 全球展示挑战赛:展示你的项目!

Oh My Zsh 是一个开源框架,可以为 Zsh 的解释器配置提供支持。

Zsh é um shell projetado para uso interativo,embora seja também uma poderosa linguagem de script。 bash、ksh 和 tcsh 论坛中包含 ao zsh 的多个递归项; Muitas 特征起源于论坛 adicionadas。

可以选择使用 shell padrão oferecido pelo sistema operacional。您可以使用多个命令的终端来进行操作。 Linux 和 macOS 操作系统的主要指示。 Iremos 安装并配置无 WSL。

前提条件

Oh My Zsh 的安装需要满足以下先决条件:

  • 安装 Zsh;
  • 安装curl后,请使用curl;
  • 在 WSL2 上安装 git;

Instalando o Zsh

sudo apt-get install zsh
Enter fullscreen mode Exit fullscreen mode

GIF instalação do ZSH

安装 Zsh 并执行以下操作:

zsh --version
Enter fullscreen mode Exit fullscreen mode

zsh 5.8.1 (x86_64-ubuntu-linux-gnu) 的接收算法

安装卷发

sudo apt-get install curl
Enter fullscreen mode Exit fullscreen mode

GIF instalação do curl

请安装并执行以下命令:

curl --version
Enter fullscreen mode Exit fullscreen mode

重新使用curl 7.81.0 (x86_64-pc-linux-gnu)来接收算法

安装 Git

在 Ubuntu 上,执行命令,启动 Ubuntu 存储库,并使用 PPA 与最新的 GIT 版本进行竞争,下载包列表并安装 GIT 版本

sudo add-apt-repository ppa:git-core/ppa ; sudo apt update ; sudo apt-get install git
Enter fullscreen mode Exit fullscreen mode

com o git install deve ser possível você executar:

git --version
Enter fullscreen mode Exit fullscreen mode

接收算法来自git 版本 2.39.1

Instalando o Oh My Zsh?

通过CurlWget安装Oh My Zsh程序,最好使用 curl。

无终端的数字或连续命令:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Oh My Zsh 的 GIF 安装

集市上的部分配置包括环境变量、环境变量或配置终端,使用~/.zshrc~/.bash_profile或衍生工具。

Reinicie o seu terminal.

Configurando o tema Spaceship no Oh My Zsh!

宇宙飞船是一款极简主义、简约和极致个性化的游戏。 Prompt é o que você vê quando digitala um comando。最重要的是,经济、经济和龙卷风是一种温和和缓慢的体验。这些组合可以使您的工作更加便捷,但所需的一切却很复杂,而且非常真实。

Primeiro、vamos 克隆或 GitHub 存储库:

git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
Enter fullscreen mode Exit fullscreen mode

Criar um 链接到 oh-my-zsh:spaceship.zsh-theme 个性化主题的直接链接

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
Enter fullscreen mode Exit fullscreen mode

定义和配置主题,无需使用 .zshrc,只需使用 seu 文本编辑器即可,无需使用 VSCode

code . ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

获取不同的 ZSH_THEME 和 ZSH_THEME=”spaceship” 的更改

ZSH_THEME 变量配置示例

没有最终的副本或后续文本:

SPACESHIP_PROMPT_ORDER=(
  user # Username section
  dir # Current directory section
  host # Hostname section
  git # Git section (git_branch + git_status)
  hg # Mercurial section (hg_branch + hg_status)
  exec_time # Execution time
  line_sep # Line break
  jobs # Background jobs indicator
  exit_code # Exit code section
  char # Prompt character
)

SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_CHAR_SYMBOL="❯"
SPACESHIP_CHAR_SUFFIX=" "
Enter fullscreen mode Exit fullscreen mode

您可以将链接配置为自定义的各种操作的链接,以自定义提示符或宇宙飞船。

包括 Oh My Zsh 在内的主题,请先配置不同的 ZSH_THEME,然后继续链接主题。

主题 · ohmyzsh/ohmyzsh Wiki (github.com)

Instalando alguns 插件特别

如果您想修改终端的相关主题,请使用其他功能。此外,还存在一些插件,可以作为命令的解释器,以便于执行命令、实现自动完成等。

Confira alguns deles a seguir。

Zsh 语法高亮

zsh-syntax-highlighting插件可用于数字化操作。准备好,我们将在今年的圣诞节前夕,与您的家人一起度过美好的时光,并与您的家人一起度过美好的时光。请修改执行前的命令,特别是捕获错误的信息。

安装 esse 插件需要先克隆或 Github 存储库

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode

编辑 arquivo .zshrc 和 ativar 插件:

plugins=( [plugins...] zsh-syntax-highlighting)
Enter fullscreen mode Exit fullscreen mode

O arquivo ficará da seguinte maneira:

ZSH 插件配置示例

Zsh-autosuggestions

为指挥官提供建议的插件基于美国指挥官的历史记录。在数字命令中,您可以得出结论,光标将保持沉默。

安装 Zsh-syntax-highlighting 插件。

Github 存储库和插件克隆。

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

plugins=( [plugins...] zsh-autosuggestions)
Enter fullscreen mode Exit fullscreen mode

Para outros puglins:

插件 · ohmyzsh/ohmyzsh Wiki (github.com)

最后,重新配置 Zsh 并在 seu 终端上重新配置新配置:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

我没有购买 LinkedIn 的任何评论

拥抱!

文章来源:https://dev.to/henriquemsimoes/instalando-e-configurando-zsh-e-oh-my-zsh-4bem