1
0
Fork 0
mirror of https://gitlab.com/mlunax/dotfiles.git synced 2025-04-12 05:40:17 +00:00

delete ohmyzsh

This commit is contained in:
Luna 2024-04-19 16:05:24 +02:00
parent 269282fe46
commit 1ff498137e
4 changed files with 63 additions and 22 deletions

View file

@ -21,7 +21,7 @@ alias \
gs='git status' \
gst='git stash' \
hx='helix'
alias ls='ls --color=auto'
alias gcl='git clone'
alias history='fc -l 0'
alias ytdlp='yt-dlp `xclip -o`'

13
.zshrc
View file

@ -18,9 +18,14 @@ else
fi
fi
source $ZSH/oh-my-zsh.sh
if [ -d /usr/share/zsh/plugins ] && [ -d /usr/share/zsh/plugins/zsh-autosuggestions ]; then
plugins="/usr/share/zsh/plugins"
else
plugins="$HOME/.local/share/zsh-plugins"
fi
plugins=(git docker docker-compose virtualenv)
source "$plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
## History file configuration
HISTFILE="$HOME/.zsh_history"
@ -53,10 +58,6 @@ if ! iscmd docker && iscmd podman; then
alias c='podman-compose'
fi
if iscmd google-chrome-stable; then
export BROWSER=google-chrome-stable
fi
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
for f in $OTHER/*.zsh; do

View file

@ -4,7 +4,7 @@
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
# for a list of all available themes
--theme="Catppuccin-macchiato"
#--theme="Catppuccin-macchiato"
# Enable this to use italic text on the terminal. This is not supported on all
# terminal emulators (like tmux, by default):

View file

@ -1,6 +1,12 @@
#!/usr/bin/env zsh
# env, because some OSes keep zsh in /bin (I'm looking at you, Alpine)
if [ "$ZSH_EVAL_CONTEXT" = "toplevel" ]; then
echo "[!] this script is meant to be sourced"
echo "source install.zsh" > /dev/stdin
exit 1
fi
iscmd() {
command -v "$1" > /dev/null
}
@ -12,27 +18,52 @@ for cmd in curl git sed install find; do
fi
done
set -e
# migrate legacy
mkdir -p "$HOME"/.config/zsh
touch "$HOME"/.config/zsh/local.zsh
if [ -d "$HOME"/.zsh-custom ]; then
for file in "$HOME"/.zsh-custom/*; do
echo "# $file" >> "$HOME"/.config/zsh/local.zsh
cat "$file" >> "$HOME"/.config/zsh/local.zsh
echo "" >> "$HOME"/.config/zsh/local.zsh
rm "$file"
done
rmdir "$HOME"/.zsh-custom
fi
install() {
# screw you coreutils install and your ugly messages
command install -Dv $@ | grep -v removed
}
if iscmd glow; then
CHANGELOG=$(glow changelog.md)
plugins_dir="$HOME/.local/share/zsh-plugins"
plugins_git="
https://github.com/zsh-users/zsh-syntax-highlighting
https://github.com/zsh-users/zsh-autosuggestions
"
os_id="$( . /etc/os-release && echo "$ID" )"
if [ "$(id -u)" != 0 ]; then
if command -v doas >/dev/null; then
elevate=doas
elif command -v sudo >/dev/null; then
elevate=sudo
else
echo "[!] cannot install zsh plugins system-wide"
elevate=:
fi
fi
if iscmd bat; then
CHANGELOG=$(bat -fp changelog.md 2> /dev/null)
else
CHANGELOG=$(cat changelog.md)
fi
cp -v .zshrc $HOME
if [ ! -d "${HOME}/.oh-my-zsh" ]; then
echo "[*] Installing OMZsh"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
if [ ! -d "${HOME}/.oh-my-zsh/custom/themes/powerlevel10k" ]; then
echo
echo "[*] Installing powerlevel10k"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
fi
if [ -d "${HOME}/.zsh" ]; then
echo
echo "[*] Deleting old .zsh/"
@ -54,7 +85,6 @@ fi
if [ -n "${NPM_CONFIG_PREFIX}" ]; then
sed -i "s%\# export NPM_CONFIG_PREFIX=\"\"%export NPM_CONFIG_PREFIX=\"$NPM_CONFIG_PREFIX\"%g" $HOME/.zsh/env.zsh
fi
cp -v .tmux.conf ~/.tmux.conf
echo
echo "[*] installing homedir files"
@ -76,8 +106,18 @@ find bin -type f | while read -r file; do
install $file $(echo $file | sed "s|bin|$HOME/.local/bin|")
done
unfunction install
for plugin in $=plugins_git; do
name="${plugin/*\//}"
if [ ! -d "$plugins_dir/$name" ]; then
echo "[*] installing $name locally"
git clone --depth=1 "$plugin" "$plugins_dir/$name"
else
echo "[+] $name installed already"
fi
done
unfunction install
echo ""
echo Important changes:
echo $CHANGELOG
exec zsh