experiment: custom zsh

This commit is contained in:
Konano 2023-11-30 12:31:06 +08:00
parent 43b4ce4f2f
commit 09b105162f
8 changed files with 30 additions and 16 deletions

View File

@ -1,3 +1,7 @@
# HOST="VM-ubuntu"
command_exists() { command -v "$@" >/dev/null 2>&1; }
# pip3 # pip3
export PATH=$PATH:$HOME/.local/bin export PATH=$PATH:$HOME/.local/bin
command_exists trash-put && alias rm='trash-put' command_exists trash-put && alias rm='trash-put'

View File

@ -1,3 +1,11 @@
if [ "$__ZSH_CUSTOM_INIT_INCLUDED" = "yes" ]; then
return 0
fi
__ZSH_CUSTOM_INIT_INCLUDED="yes"
# ====================================================================================================
zstyle ':omz:update' mode reminder # just remind me to update when it's time zstyle ':omz:update' mode reminder # just remind me to update when it's time
zstyle ':omz:update' frequency 13 zstyle ':omz:update' frequency 13

View File

@ -1,6 +1,6 @@
ZSH_THEME="ys-simple" ZSH_THEME="ys-simple"
HOST="VM-ubuntu" # HOST="VM-ubuntu"
HIST_STAMPS='yyyy-mm-dd' HIST_STAMPS='yyyy-mm-dd'
DISABLE_AUTO_TITLE='true' DISABLE_AUTO_TITLE='true'

View File

@ -50,5 +50,3 @@ __zsh_get_ip() {
__zsh_get_ipv4 __zsh_get_ipv4
__zsh_get_ipv6 __zsh_get_ipv6
} }
alias net='__zsh_get_ip'

View File

@ -30,3 +30,9 @@ if command_exists eza; then
fi fi
command_exists docker && alias gost='docker run --rm -p 9443:9443 --cpus=0.2 --memory=256mb gogost/gost -L socks5://nano:QpuwAqcsP8Xp@:9443' command_exists docker && alias gost='docker run --rm -p 9443:9443 --cpus=0.2 --memory=256mb gogost/gost -L socks5://nano:QpuwAqcsP8Xp@:9443'
# functions from 20-function.zsh
alias net='__zsh_get_ip'
# for Lazy
alias lazy='~/.lazy/run.sh'

View File

@ -2,5 +2,3 @@ _systemctl_unit_state() {
typeset -gA _sys_unit_state typeset -gA _sys_unit_state
_sys_unit_state=( $(__systemctl list-unit-files '$PREFIX*' | awk '{print $1, $2}') ) _sys_unit_state=( $(__systemctl list-unit-files '$PREFIX*' | awk '{print $1, $2}') )
} }
alias lazy='~/.lazy/run.sh'

View File

@ -102,17 +102,17 @@ configure_zsh() {
git_clone paulirish/git-open ~/.oh-my-zsh/custom/plugins/git-open --norecursive git_clone paulirish/git-open ~/.oh-my-zsh/custom/plugins/git-open --norecursive
sudo apt install autojump -y sudo apt install autojump -y
if ! grep -Fxq "source ~/.zsh_init" ~/.zshrc; then if ! grep -Fxq "source ~/.oh-my-zsh/custom/00-init.zsh" ~/.zshrc; then
local line_number=$(grep -n "source \$ZSH/oh-my-zsh.sh" .zshrc | cut -d : -f 1) local line_number=$(grep -n "source \$ZSH/oh-my-zsh.sh" .zshrc | cut -d : -f 1)
sed -i "${line_number}i source ~/.zsh_init\n" .zshrc sed -i "${line_number}i source ~/.oh-my-zsh/custom/00-init.zsh\n" .zshrc
fi fi
echo "\nsource ~/.zsh_user" | sudo tee -a ~/.zshrc >/dev/null
local zsh_scriptdir=$scriptdir/files/zsh cp $scriptdir/files/zsh/.zsh_user ~/.zsh_user
cp $scriptdir/files/zsh/.zsh_init ~/.zsh_init cp $scriptdir/files/zsh/00-init.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/20-alias.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/50-function.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/50-alias.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/80-environment.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/
cp $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ cp $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/
fi fi

View File

@ -78,11 +78,11 @@ configure_nodejs() {
# ============================================================ # ============================================================
update_file $scriptdir/files/zsh/.zsh_init ~/.zsh_init update_file $scriptdir/files/zsh/.zsh_user ~/.zsh_user
update_file $scriptdir/files/zsh/00-init.zsh ~/.oh-my-zsh/custom/00-init.zsh
update_file $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/10-theme.zsh update_file $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/10-theme.zsh
update_file $scriptdir/files/zsh/20-alias.zsh ~/.oh-my-zsh/custom/20-alias.zsh update_file $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/20-function.zsh
update_file $scriptdir/files/zsh/50-function.zsh ~/.oh-my-zsh/custom/50-function.zsh update_file $scriptdir/files/zsh/50-alias.zsh ~/.oh-my-zsh/custom/50-alias.zsh
update_file $scriptdir/files/zsh/80-environment.zsh ~/.oh-my-zsh/custom/80-environment.zsh
update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh
update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme
update_authorized_keys update_authorized_keys