individual zsh configuration
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
current_dir=$(dirname "$0")
|
||||
|
||||
# copying $HOME/.zshrc
|
||||
if [ -f "$HOME/.zshrc" ]; then
|
||||
if [ ! -f "$HOME/.zshrc.bkp" ]; then
|
||||
mv "$HOME/.zshrc" "$HOME/.zshrc.bkp"
|
||||
cp "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
else
|
||||
echo "Backup file already exists. Please remove $HOME/.zshrc.bkp and try again."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
cp "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
fi
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
current_dir=$(dirname "$0")
|
||||
|
||||
cp "$current_dir/p10k.zsh" "$HOME/.p10k.zsh"
|
@@ -1,5 +1,22 @@
|
||||
#! /bin/bash
|
||||
|
||||
current_dir=$(dirname "$0")
|
||||
current_dir=$(dirname $(realpath "$0"))
|
||||
starship_config_file="$HOME/.config/starship.toml"
|
||||
|
||||
cp "$current_dir/../starship/starship.toml" "$HOME/.config/"
|
||||
if [[ $(file $starship_config_file) ]]; then
|
||||
if $(file "$starship_config_file" | grep -q "symbolic link") ; then
|
||||
if [[ $(readlink "$starship_config_file") != $(realpath "$current_dir/../starship/starship.toml") ]]; then
|
||||
ln -sf "$current_dir/../starship/starship.toml" "$starship_config_file"
|
||||
fi
|
||||
else
|
||||
if [ ! -f "$starship_config_file.bkp" ]; then
|
||||
mv "$starship_config_file" "$starship_config_file.bkp"
|
||||
ln -s "$current_dir/../starship/starship.toml" "$starship_config_file"
|
||||
else
|
||||
echo "Backup file already exists. Please remove $starship_config_file.bkp and try again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ln -sf "$current_dir/../starship/starship.toml" "$starship_config_file"
|
||||
fi
|
||||
|
@@ -33,9 +33,9 @@ if ! command -v starship >/dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
# Path
|
||||
PATH_OHMYZSH="$HOME"/.oh-my-zsh
|
||||
PATH_OHMYZSH_CUSTOM_PLUGINS="$PATH_OHMYZSH"/custom/plugins
|
||||
PATH_OHMYZSH_CUSTOM_THEMES="$PATH_OHMYZSH"/custom/themes
|
||||
PATH_OHMYZSH="$HOME/.oh-my-zsh"
|
||||
PATH_OHMYZSH_CUSTOM_PLUGINS="$PATH_OHMYZSH/custom/plugins"
|
||||
PATH_OHMYZSH_CUSTOM_THEMES="$PATH_OHMYZSH/custom/themes"
|
||||
|
||||
# git clone oh-my-zsh
|
||||
if [ ! -d "$PATH_OHMYZSH" ]; then
|
||||
@@ -103,17 +103,39 @@ else
|
||||
fi
|
||||
|
||||
# git clone powerlevel10k
|
||||
if [ ! -d "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k ]; then
|
||||
echo "Powerlevel10k is not downloaded. Downloading..."
|
||||
# git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k
|
||||
git clone --depth=1 https://gitee.com/gwbeip/powerlevel10k.git "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k
|
||||
else
|
||||
cd "$PATH_OHMYZSH_CUSTOM_THEMES/powerlevel10k" || exit 1
|
||||
if [ ! -d .git ]; then
|
||||
echo "Zsh Autocomplete is not a git repository. Please remove $PATH_OHMYZSH_CUSTOM_THEMES/powerlevel10k and try again."
|
||||
exit 1
|
||||
# if [ ! -d "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k ]; then
|
||||
# echo "Powerlevel10k is not downloaded. Downloading..."
|
||||
# # git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k
|
||||
# git clone --depth=1 https://gitee.com/gwbeip/powerlevel10k.git "$PATH_OHMYZSH_CUSTOM_THEMES"/powerlevel10k
|
||||
# else
|
||||
# cd "$PATH_OHMYZSH_CUSTOM_THEMES/powerlevel10k" || exit 1
|
||||
# if [ ! -d .git ]; then
|
||||
# echo "Zsh Autocomplete is not a git repository. Please remove $PATH_OHMYZSH_CUSTOM_THEMES/powerlevel10k and try again."
|
||||
# exit 1
|
||||
# else
|
||||
# echo "Powerlevel10k is already exist. Updating..."
|
||||
# git pull
|
||||
# fi
|
||||
# fi
|
||||
|
||||
|
||||
# copying $HOME/.zshrc
|
||||
current_dir=$(dirname $(realpath "$0"))
|
||||
|
||||
if $(file "$HOME/.zshrc"); then
|
||||
if $(file "$HOME/.zshrc" | grep -q "symbolic link") ; then
|
||||
if [[ $(readlink "$HOME/.zshrc") != "$current_dir/zshrc" ]]; then
|
||||
ln -sf "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
fi
|
||||
else
|
||||
echo "Powerlevel10k is already exist. Updating..."
|
||||
git pull
|
||||
if [ ! -f "$HOME/.zshrc.bkp" ]; then
|
||||
mv "$HOME/.zshrc" "$HOME/.zshrc.bkp"
|
||||
ln -s "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
else
|
||||
echo "Backup file already exists. Please remove $HOME/.zshrc.bkp and try again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ln -s "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
fi
|
||||
|
1731
zsh/p10k.zsh
1731
zsh/p10k.zsh
File diff suppressed because it is too large
Load Diff
40
zsh/polyjuice.sh
Normal file
40
zsh/polyjuice.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
current_dir=$(dirname $(realpath "$0"))
|
||||
|
||||
[[ -f "$HOME/.zshenv" ]] || touch "$HOME/.zshenv"
|
||||
if cat "$HOME/.zshenv" | grep -q "TERMINAL_POLYJUICE"; then
|
||||
if [[ "$current_dir" != "$TERMINAL_POLYJUICE" ]]; then
|
||||
line_number=$(grep -n "TERMINAL_POLYJUICE" "$HOME/.zshenv" | cut -d: -f1)
|
||||
sed -i "${line_number}c\\export TERMINAL_POLYJUICE=$current_dir" "$HOME/.zshenv"
|
||||
fi
|
||||
else
|
||||
echo "export TERMINAL_POLYJUICE=$current_dir" >> "$HOME/.zshenv"
|
||||
fi
|
||||
|
||||
for i in "$@"; do
|
||||
if [ "$i" = "install_ohmyzsh" ]; then
|
||||
echo "Installing Oh My Zsh..."
|
||||
zsh "$current_dir/install_ohmyzsh.sh"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Oh My Zsh installation failed."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$i" = "config_starship" ]; then
|
||||
echo "Config Starship..."
|
||||
zsh "$current_dir/config_starship.sh"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Starship configuration failed."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$i" = "check" ]; then
|
||||
echo "chcking uninstalled software..."
|
||||
zsh "$current_dir/check.sh"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Check failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Run \"exec zsh\" to apply changes."
|
||||
# exec zsh
|
Reference in New Issue
Block a user