zsh-oh-my

这篇具有很好参考价值的文章主要介绍了zsh-oh-my。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

#!/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:

ZDOTDIR - path to Zsh dotfiles directory (default: unset). See [1][2]

[1] https://zsh.sourceforge.io/Doc/Release/Parameters.html#index-ZDOTDIR

[2] https://zsh.sourceforge.io/Doc/Release/Files.html#index-ZDOTDIR_002c-use-of

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=KaTeX parse error: Expected '}', got 'EOF' at end of input: {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=“KaTeX parse error: Expected '}', got 'EOF' at end of input: {HOME:-(getent passwd $USER 2>/dev/null | cut -d: -f6)}”

macOS does not have getent, but this works even if $HOME is unset

HOME=“KaTeX parse error: Expected '}', got 'EOF' at end of input: {HOME:-(eval echo ~$USER)}”

Track if $ZSH was provided

custom_zsh=${ZSH:+yes}

Use $zdot to keep track of where the directory is for zsh dotfiles

To check if $ZDOTDIR was provided, explicitly check for $ZDOTDIR

zdot=“KaTeX parse error: Expected '}', got 'EOF' at end of input: {ZDOTDIR:-HOME}”

Default value for $ZSH

a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh

b) otherwise, $HOME/.oh-my-zsh

[ “ Z D O T D I R " = " ZDOTDIR" = " ZDOTDIR"="HOME” ] || ZSH=“KaTeX parse error: Expected '}', got 'EOF' at end of input: {ZSH:-{ZDOTDIR:+KaTeX parse error: Expected 'EOF', got '}' at position 16: ZDOTDIR/ohmyzsh}̲}" ZSH="{ZSH:-$HOME/.oh-my-zsh}”

Default settings

REPO= R E P O : − o h m y z s h / o h m y z s h R E M O T E = {REPO:-ohmyzsh/ohmyzsh} REMOTE= REPO:ohmyzsh/ohmyzshREMOTE={REMOTE:-https://github.com/KaTeX parse error: Expected 'EOF', got '}' at position 11: {REPO}.git}̲ BRANCH={BRANCH:-master}

Other options

CHSH= C H S H : − y e s R U N Z S H = {CHSH:-yes} RUNZSH= CHSH:yesRUNZSH={RUNZSH:-yes}
KEEP_ZSHRC=${KEEP_ZSHRC:-no}

command_exists() {
command -v “$@” >/dev/null 2>&1
}

user_can_sudo() {

Check if sudo is installed

command_exists sudo || return 1

Termux can’t run sudo, so we can detect it and exit the function early.

case “$PREFIX” in
com.termux) return 1 ;;
esac

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 may not run sudo on

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 ]; then
is_tty() {
true
}
else
is_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 © 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 “ F O R C E H Y P E R L I N K " ] ; t h e n [ " FORCE_HYPERLINK" ]; then [ " FORCEHYPERLINK"];then["FORCE_HYPERLINK” != 0 ]
return $?
fi

If stdout is not a tty, it doesn’t support hyperlinks

is_tty || return 1

DomTerm terminal emulator (domterm.org)

if [ -n “$DOMTERM” ]; then
return 0
fi

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 hyperlinks

case “$TERM_PROGRAM” in
Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
esac

kitty supports hyperlinks

if [ “$TERM” = xterm-kitty ]; then
return 0
fi

Windows Terminal also supports hyperlinks

if [ -n “$WT_SESSION” ]; then
return 0
fi

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

fi

return 1
}

Adapted from code and information by Anton Kochkov (@XVilka)

Source: https://gist.github.com/XVilka/8346728

supports_truecolor() {
case “$COLORTERM” in
truecolor|24bit) return 0 ;;
esac

case “$TERM” in
iterm |
tmux-truecolor |
linux-truecolor |
xterm-truecolor |
screen-truecolor) return 0 ;;
esac

return 1
}

fmt_link() {

$1: text, $2: url, $3: fallback mode

if supports_hyperlinks; then
printf ‘\033]8;;%s\033\%s\033]8;;\033\\n’ “$2” “$1”
return
fi

case “$3” in
–text) printf ‘%s\n’ “$1” ;;
–url|*) fmt_underline “$2” ;;
esac
}

fmt_underline() {
is_tty && printf ‘\033[4m%s\033[24m\n’ “ ∗ " ∣ ∣ p r i n t f ′ *" || printf '%s\n' " "∣∣printf*”
}

shellcheck disable=SC2016 # backtick in single-quote

fmt_code() {
is_tty && printf ‘\033[2m%s\033[22m\n’ “ ∗ " ∣ ∣ p r i n t f ′ ‘ *" || printf '`%s`\n' " "∣∣printf*”
}

fmt_error() {
printf ‘%sError: %s%s\n’ “ F M T B O L D {FMT_BOLD} FMTBOLD{FMT_RED}” “ ∗ " " *" " ""FMT_RESET” >&2
}

setup_color() {

Only use colors if connected to a terminal

if ! is_tty; then
FMT_RAINBOW=“”
FMT_RED=“”
FMT_GREEN=“”
FMT_YELLOW=“”
FMT_BLUE=“”
FMT_BOLD=“”
FMT_RESET=“”
return
fi

if supports_truecolor; then
FMT_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’)
"
else
FMT_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’)
"
fi

FMT_RED=KaTeX parse error: Undefined control sequence: \0 at position 10: (printf '\̲0̲33[31m') FMT_…(printf ‘\033[32m’)
FMT_YELLOW=KaTeX parse error: Undefined control sequence: \0 at position 10: (printf '\̲0̲33[33m') FMT_…(printf ‘\033[34m’)
FMT_BOLD=KaTeX parse error: Undefined control sequence: \0 at position 10: (printf '\̲0̲33[1m') FMT_R…(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-w

echo “ F M T B L U E C l o n i n g O h M y Z s h . . . {FMT_BLUE}Cloning Oh My Zsh... FMTBLUECloningOhMyZsh...{FMT_RESET}”

command_exists git || {
fmt_error “git is not installed”
exit 1
}

ostype= ( u n a m e ) i f [ − z " (uname) if [ -z " (uname)if[z"{ostype%CYGWIN*}" ] && git --version | grep -Eq ‘msysgit|windows’; then
fmt_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 1
fi

Manual clone with git config options to support git < v1.7.2

git init --quiet “KaTeX parse error: Expected 'EOF', got '&' at position 6: 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 “KaTeX parse error: Expected 'EOF', got '&' at position 13: BRANCH" \ &̲& git remote ad…REMOTE”
&& git fetch --depth=1 origin
&& git checkout -b “ B R A N C H " " o r i g i n / BRANCH" "origin/ BRANCH""origin/BRANCH” || {
[ ! -d “KaTeX parse error: Expected '}', got 'EOF' at end of input: … rm -rf "ZSH” 2>/dev/null
}
fmt_error “git clone of oh-my-zsh repo failed”
exit 1
}

Exit installation directory

cd -

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 zshrc

echo “ F M T B L U E L o o k i n g f o r a n e x i s t i n g z s h c o n f i g . . . {FMT_BLUE}Looking for an existing zsh config... FMTBLUELookingforanexistingzshconfig...{FMT_RESET}”

Must use this exact name so uninstall.sh can find it

OLD_ZSHRC=“ z d o t / . z s h r c . p r e − o h − m y − z s h " i f [ − f " zdot/.zshrc.pre-oh-my-zsh" if [ -f " zdot/.zshrc.preohmyzsh"if[f"zdot/.zshrc” ] || [ -h “KaTeX parse error: Expected 'EOF', got '#' at position 26: …c" ]; then #̲ Skip this if t…KEEP_ZSHRC” = yes ]; then
echo “${FMT_YELLOW}Found z d o t / . z s h r c . {zdot}/.zshrc. zdot/.zshrc.{FMT_RESET} F M T G R E E N K e e p i n g . . . {FMT_GREEN}Keeping... FMTGREENKeeping...{FMT_RESET}”
return
fi
if [ -e “ O L D Z S H R C " ] ; t h e n O L D O L D Z S H R C = " OLD_ZSHRC" ]; then OLD_OLD_ZSHRC=" OLDZSHRC"];thenOLDOLDZSHRC="{OLD_ZSHRC}- ( d a t e + i f [ − e " (date +%Y-%m-%d_%H-%M-%S)" if [ -e " (date+if[e"OLD_OLD_ZSHRC” ]; then
fmt_error “$OLD_OLD_ZSHRC exists. Can’t back up O L D Z S H R C " f m t e r r o r " r e − r u n t h e i n s t a l l e r a g a i n i n a c o u p l e o f s e c o n d s " e x i t 1 f i m v " {OLD_ZSHRC}" fmt_error "re-run the installer again in a couple of seconds" exit 1 fi mv " OLDZSHRC"fmterror"reruntheinstalleragaininacoupleofseconds"exit1fimv"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}"
fi
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"
mv "$zdot/.zshrc" "$OLD_ZSHRC"

fi

echo “${FMT_GREEN}Using the Oh My Zsh template file and adding it to z d o t / . z s h r c . zdot/.zshrc. zdot/.zshrc.{FMT_RESET}”

Modify $ZSH variable in .zshrc directory to use the literal $ZDOTDIR or $HOME

omz=“ Z S H " i f [ − n " ZSH" if [ -n " ZSH"if[n"ZDOTDIR” ] && [ “ Z D O T D I R " ! = " ZDOTDIR" != " ZDOTDIR"!="HOME” ]; then
omz= ( e c h o " (echo " (echo"omz" | sed “s|^$ZDOTDIR/|$ZDOTDIR/|”)
fi
omz= ( e c h o " (echo " (echo"omz" | sed “s|^$HOME/|$HOME/|”)

sed “s|^export ZSH=.*KaTeX parse error: Expected group as argument to '\"' at end of input: |export ZSH=\"{omz}”|" “ Z S H / t e m p l a t e s / z s h r c . z s h − t e m p l a t e " > " ZSH/templates/zshrc.zsh-template" > " ZSH/templates/zshrc.zshtemplate">"zdot/.zshrc-omztemp”
mv -f “ z d o t / . z s h r c − o m z t e m p " " zdot/.zshrc-omztemp" " zdot/.zshrcomztemp""zdot/.zshrc”

echo
}

setup_shell() {

Skip setup if the user wants or stdin is closed (not running interactively).

if [ “$CHSH” = no ]; then
return
fi

If this user’s login shell is already “zsh”, do not attempt to switch.

if [ “ ( b a s e n a m e − − " (basename -- " (basename"SHELL”)" = “zsh” ]; then
return
fi

If this platform doesn’t provide a “chsh” command, bail out.

if ! command_exists chsh; then
cat <<EOF
I can’t change your shell automatically because this system does not have chsh.
F M T B L U E P l e a s e m a n u a l l y c h a n g e y o u r d e f a u l t s h e l l t o z s h {FMT_BLUE}Please manually change your default shell to zsh FMTBLUEPleasemanuallychangeyourdefaultshelltozsh{FMT_RESET}
EOF
return
fi

echo “ F M T B L U E T i m e t o c h a n g e y o u r d e f a u l t s h e l l t o z s h : {FMT_BLUE}Time to change your default shell to zsh: FMTBLUETimetochangeyourdefaultshelltozsh:{FMT_RESET}”

Prompt for user choice on changing the default login shell

printf '%sDo you want to change your default shell to zsh? [Y/n]%s ’
F M T Y E L L O W " " FMT_YELLOW" " FMTYELLOW""FMT_RESET”
read -r opt
case $opt in
y*|Y*|“”) ;;
n*|N*) echo “Shell change skipped.”; return ;;
*) echo “Invalid choice. Shell change skipped.”; return ;;
esac

Check if we’re running on Termux

case “$PREFIX” in
com.termux) termux=true; zsh=zsh ;;
*) termux=false ;;
esac

if [ “$termux” != true ]; then
# Test for the right location of the “shells” file
if [ -f /etc/shells ]; then
shells_file=/etc/shells
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
shells_file=/usr/share/defaults/etc/shells
else
fmt_error “could not find /etc/shells file. Change your default shell manually.”
return
fi

# 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 exists
if ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; then
  if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; then
    fmt_error "no zsh binary found or not present in '$shells_file'"
    fmt_error "change your default shell manually."
    return
  fi
fi

fi

We’re going to change the default shell, so back up the current one

if [ -n “ S H E L L " ] ; t h e n e c h o " SHELL" ]; then echo " SHELL"];thenecho"SHELL” > “KaTeX parse error: Expected group after '^' at position 45: …else grep "^̲USER:” /etc/passwd | awk -F: '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 7}̲' > "zdot/.shell.pre-oh-my-zsh"
fi

echo “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; then
sudo -k chsh -s “ z s h " " zsh" " zsh""USER” # -k forces the password prompt
else
chsh -s “ z s h " " zsh" " zsh""USER” # run chsh normally
fi

Check if the shell change was successful

if [ ? − n e 0 ] ; t h e n f m t e r r o r " c h s h c o m m a n d u n s u c c e s s f u l . C h a n g e y o u r d e f a u l t s h e l l m a n u a l l y . " e l s e e x p o r t S H E L L = " ? -ne 0 ]; then fmt_error "chsh command unsuccessful. Change your default shell manually." else export SHELL=" ?ne0];thenfmterror"chshcommandunsuccessful.Changeyourdefaultshellmanually."elseexportSHELL="zsh"
echo “ F M T G R E E N S h e l l s u c c e s s f u l l y c h a n g e d t o ′ {FMT_GREEN}Shell successfully changed to ' FMTGREENShellsuccessfullychangedtozsh’.${FMT_RESET}”
fi

echo
}

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_RESET
printf ‘%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n’ $FMT_RAINBOW $FMT_RESET
printf ‘%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ /%s __ \ %s\n’ $FMT_RAINBOW $FMT_RESET
printf '%s/ /
/ /%s / / / %s / / / / / /%s /
/ / %s / /
%s(__ )%s / / / %s\n’ $FMT_RAINBOW $FMT_RESET
printf ‘%s\/%s/ // %s // // //%s\, / %s //%s____/%s_/ // %s\n’ $FMT_RAINBOW $FMT_RESET
printf '%s %s %s %s /
___/ %s %s %s %s…is now installed!%s\n’ $FMT_RAINBOW $FMT_GREEN $FMT_RESET
printf ‘\n’
printf ‘\n’
printf “%s %s %s\n” “Before you scream F M T B O L D {FMT_BOLD} FMTBOLD{FMT_YELLOW}Oh My Zsh! F M T R E S E T l o o k o v e r t h e "   " {FMT_RESET} look over the" \ " FMTRESETlookoverthe" "(fmt_code “ ( f m t l i n k " . z s h r c " " f i l e : / / (fmt_link ".zshrc" "file:// (fmtlink".zshrc""file://zdot/.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 tty

if [ ! -t 0 ]; then
RUNZSH=no
CHSH=no
fi

Parse arguments

while [ $# -gt 0 ]; do
case $1 in
–unattended) RUNZSH=no; CHSH=no ;;
–skip-chsh) CHSH=no ;;
–keep-zshrc) KEEP_ZSHRC=yes ;;
esac
shift
done

setup_color

if ! command_exists zsh; then
echo “ F M T Y E L L O W Z s h i s n o t i n s t a l l e d . {FMT_YELLOW}Zsh is not installed. FMTYELLOWZshisnotinstalled.{FMT_RESET} Please install zsh first.”
exit 1
fi

if [ -d “ Z S H " ] ; t h e n e c h o " ZSH" ]; then echo " ZSH"];thenecho"{FMT_YELLOW}The $ZSH folder already exists ( Z S H ) . ZSH). ZSH).{FMT_RESET}”
if [ “$custom_zsh” = yes ]; then
cat <<EOF

You 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”)

EOF
else
echo “You’ll need to remove it if you want to reinstall.”
fi
exit 1
fi

Create ZDOTDIR folder structure if it doesn’t exist

if [ -n “ Z D O T D I R " ] ; t h e n m k d i r − p " ZDOTDIR" ]; then mkdir -p " ZDOTDIR"];thenmkdirp"ZDOTDIR”
fi

setup_ohmyzsh
setup_zshrc
setup_shell

print_success

if [ R U N Z S H = n o ] ; t h e n e c h o " RUNZSH = no ]; then echo " RUNZSH=no];thenecho"{FMT_YELLOW}Run zsh to try it out.${FMT_RESET}"
exit
fi

exec zsh -l
}

main "$@"�文章来源地址https://www.toymoban.com/news/detail-477330.html

到了这里,关于zsh-oh-my的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • WSL2配置Linux、Docker、VS Code、zsh、oh my zsh

    本篇笔记来自于UP主麦兜搞IT的合集视频Windows10开发环境搭建中的部分内容 按照微软官方文档进行操作,当然也可以直接 wsl --install 也可以按照 旧版手动安装的步骤 来进行操作 选择安装的是 Ubuntu 20.04 LTS 注:WSL默认安装在系统盘下,若长期使用务必注意系统盘大小!! 在

    2024年02月22日
    浏览(50)
  • oh-my-zsh git插件的别名对照表

    git插件是 oh-my-zsh 提供了一些 git 命令的别名,提高了我们在终端使用 git 的效率,下面是一些别名和命令的对照表: Alias Command g git ga git add gaa git add --all gapa git add --patch gb git branch gba git branch -a gbl git blame -b -w gbnm git branch --no-merged gbr git branch --remote gbs git bisect gbsb git bisect b

    2024年02月04日
    浏览(39)
  • iterm2 + homebrew + oh my zsh + powerlevel10k 的安装教程

    对于需要长期与终端打交道的工程师来说,拥有一款称手的终端管理器是很有必要的,对于 Windows 用户来说,最好的选择是   Xshell ,这个大家都没有异议。但对于 MacOS 用户来说,仍然毋庸置疑, iterm2  就是你要的利器,如果你觉得不是,那是你的问题,不是   iterm2  的问

    2024年02月07日
    浏览(112)
  • Mac上的iTerm2和Oh My Zsh 的安装(安装过程和失败详解)

            由于在很多人的安利下,说很好用,作者今天花费了4个小时用血的教训总结出来的安装教程,我在安装过程中遇到的最大的问题就是 1. curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused的这个报错 2. hosts文件无法被修改         好在经过不断的尝试和

    2024年02月06日
    浏览(58)
  • 解决Error: git clone of oh-my-zsh repo failed

    目录 一前言   二解决办法 1-报错截图 2-解决步骤 2.1先查找可以访问github.com的ip地址 2.2其次就是将改ip地址加入我们的电脑中 三访问成功 问题描述:我在进行下载oh-my-zsh的时候,出现了以下错误:Failed to connect to github.com port 443 after 75174 ms: Couldn\\\'t connect to server以及以下 Err

    2024年01月22日
    浏览(49)
  • Mac M1配置iTerm2+oh-my-zsh配色&补全&高亮命令

    2021年10月下旬买了mac之后,就一直想配置成自己要的效果,但最开始买回来之后,配置iTerm2,但相关包没有下载成功,就导致没有配置成自己想要的效果,所以上周不忙的时候又重新配置了一下,终于配置成功了,所以特此记录。安装的前提,最好已经安装了git,如果木有,

    2024年02月01日
    浏览(57)
  • iTerm2+oh-my-zsh+插件集,打造最好用的mac终端

    关注公众号【前端驿站Lite】,一个不止分享前端技术的地方! shell是命令解析器,mac常见的zsh与bash都是shell的一种,zsh基本能兼容bash,加上oh-my-zsh工具,推荐使用zsh。 1.1 查看与切换 1.2 配置文件位置 bash读取的配置文件:~/.bash_profile文件 zsh读取的配置文件:~/.zshrc文件 当从

    2024年02月14日
    浏览(58)
  • PowerShell 美化(oh-my-posh)

    1、 修改默认右键菜单 直接使用这个命令可以将 win11 的右键菜单修改为 win10 的右键菜单: 如果要回复成 win11 默认右键菜单的话: 2、 寻找安装目录 比如说我的安装目录: 3、 修改注册表 将这个路径复制下来,打开注册表: win+r - regedit 在注册表中进入路径: 新建一个项:

    2024年02月10日
    浏览(53)
  • 终端美化方案 FluentTerminal + oh-my-posh

    研究了很久的 windows 平台的终端方案,最终得出了 FluentTerminal 配合 oh-my-posh 的一套终端方案。 一款美观的终端工具,个人感觉比 Windows Terminal 更加美观。 下载方式: 直接去微软自带的应用商店里面去搜索下载。 前往FluentTerminal 项目地址进行下载 设置鼠标右键打开: 新建个

    2024年02月05日
    浏览(38)
  • 搭建自己的搜索引擎——oh-my-search使用

    使用elasticsearch和search-ui搭建自己的搜索引擎,快速查找资源和文件。如果对代码感兴趣,相关代码已在github上开源,欢迎fork代码。 先搭建eleasticsearch再搭建kibana 搭建elasticsearch 编辑docker-compose.yml文件,内容如下: 其中./es/config/elasticsearch.yml的内容如下,可按需修改: 启动

    2024年02月08日
    浏览(41)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包