Upgrade easyzsh

This commit is contained in:
Frank Qing
2025-05-28 01:26:30 +08:00
parent 038cf2b2c7
commit bf1f1c0cbb
4 changed files with 240 additions and 1776 deletions

99
.zshrc
View File

@@ -1,4 +1,9 @@
# Your original .zshrc is backed up at ~/.zshrc-backup-%y-%m-%d
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export TERM="xterm-256color"
# If you come from bash you might have to change your $PATH.
@@ -11,31 +16,7 @@ export ZSH=$HOME/.oh-my-zsh
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
ZSH_THEME="powerlevel10k/powerlevel10k"
# POWERLEVEL9K_MODE='nerdfont-complete'
# POWERLEVEL9K_OS_ICON_BACKGROUND="white"
# POWERLEVEL9K_OS_ICON_FOREGROUND="blue"
# POWERLEVEL9K_DIR_HOME_FOREGROUND="white"
# POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white"
# POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs ram load rvm time)
# # more prompt elements that are suggested
# # (public_ip docker_machine pyenv nvm) https://github.com/bhilburn/powerlevel9k#prompt-customization
# # Note: using public_ip is cool but when connection is down prompt waits for 10-20 seconds
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh os_icon context dir vcs)
# POWERLEVEL9K_PROMPT_ON_NEWLINE=true
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@@ -80,17 +61,17 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
zsh-completions
zsh-autosuggestions # disable when using marker, otherwise enable
# zsh-completions INSTALL METHOD CHANGED https://github.com/zsh-users/zsh-completions/issues/603
zsh-autosuggestions # Disable if you are using Marker, otherwise enable
zsh-syntax-highlighting
history-substring-search
screen
systemd
web-search
k
extract
z
sudo
fzf-tab
# web-search
# httpie
# git
# python
@@ -99,11 +80,19 @@ plugins=(
# pip
# pyenv
# redis-cli
# screen
# zsh-wakatime # enable if you use wakatime with 'https://github.com/wbingli/zsh-wakatime'
)
# Plugins can be added like into your own config file under ~/.config/zshrc/ like this:
#plugins+=(zsh-nvm)
# source $ZSH/oh-my-zsh.sh # This is now run after importing user configs
# Remove plugins from the default list above in your own config file using:
# plugins=(${plugins:#pluginname})
# plugins=(${plugins:#zsh-autosuggestions})
# fpath+="${ZSH_CUSTOM:-"$ZSH/custom"}/plugins/zsh-completions/src" # install zsh-completions, if you need it
# source $ZSH/oh-my-zsh.sh # This is now run in .zshrc after importing user configs from ~/.config/zshrc/* files
# User configuration
@@ -134,16 +123,20 @@ plugins=(
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Add to PATH to Install and run programs with "pip install --user"
# Add to PATH to run programs installed with pipx or "pip install --user"
# export PATH=$PATH:~/.local/bin
# To give this path preference instead of system paths to run the latest version of tools, add the following to your personal config. Due to security concerns this is not done by default.
# export PATH=~/.local/bin:$PATH
# export PATH=$PATH:~/.config/ezsh/bin
# NPM_PACKAGES="${HOME}/.npm"
# PATH="$NPM_PACKAGES/bin:$PATH"
# [[ -s "$HOME/.marker/marker.sh" ]] && source "$HOME/.marker/marker.sh"
[[ -s "$HOME/.marker/marker.sh" ]] && source "$HOME/.marker/marker.sh"
fpath+=$ZSH/custom/plugins/zsh-completions/src
autoload -U compinit && compinit -C -d ~/.cache/zsh/.zcompdump # zsh-completions
# autoload bashcompinit # bash completions
# bashcompinit
@@ -154,9 +147,12 @@ SAVEHIST=50000 #save upto 50,000 lines in history. oh-my-zsh default is 10,
#setopt hist_ignore_all_dups # dont record duplicated entries in history during a single session
alias myip="wget -qO- https://wtfismyip.com/text" # quickly show external ip address
alias l="ls -lAhrtF" # show all except . .. , sort by recent, / at the end of folders
alias l="ls --hyperlink=auto -lAhrtF" # show all except . .. , sort by recent, / at the end of folders, clickable
alias e="exit"
alias ip="ip --color=auto"
## Install EZA to use this. The better ls command
alias a='eza -la --git --colour-scale all -g --smart-group --icons always --hyperlink' # the new ls; add --hyperlink if you like
alias aa='eza -la --git --colour-scale all -g --smart-group --icons always -s modified -r --hyperlink' # sort by new
# CUSTOM FUNCTIONS
@@ -173,7 +169,6 @@ cheat() {
fi
}
# Matrix screen saver! will run if you have installed "cmatrix"
# TMOUT=900
# TRAPALRM() { if command -v cmatrix &> /dev/null; then cmatrix -sb; fi }
@@ -186,17 +181,6 @@ dadjoke() {
curl https://icanhazdadjoke.com
}
# Find dictionary definition
dict() {
if [ "$3" ]; then
curl "dict://dict.org/d:$1 $2 $3"
elif [ "$2" ]; then
curl "dict://dict.org/d:$1 $2"
else
curl "dict://dict.org/d:$1"
fi
}
# Find geo info from IP
ipgeo() {
# Specify ip or your ip will be used
@@ -207,29 +191,28 @@ ipgeo() {
fi
}
# Any zshrc configurations under the folder ~/.config/ezsh/zshrc/ will override the default ezsh configs.
# To customize prompt look, edit ~/.config/ezsh/p10k.zsh or run `p10k configure`
# [[ ! -f ~/.config/ezsh/p10k.zsh ]] || source ~/.config/ezsh/p10k.zsh # already in ZSH_CONFIGS_DIR
# Any zshrc configurations under the folder ~/.config/zshrc/ will override the default ezsh configs.
# Place all of your personal configurations over there
ZSH_CONFIGS_DIR="$HOME/.config/zshrc"
mkdir -p $ZSH_CONFIGS_DIR
if [ "$(ls -A $ZSH_CONFIGS_DIR)" ]; then
for file in "$ZSH_CONFIGS_DIR"/*; do
for file in "$ZSH_CONFIGS_DIR"/*(DN); do
# Exclude '.' and '..' from being sourced
if [ -f "$file" ]; then
source "$file"
done
fi
fi
done
# Now source oh-my-zsh.sh so that any plugins added in ~/.config/ezsh/zshrc/* files also get loaded
# Now source oh-my-zsh.sh so that any plugins added in ~/.config/zshrc/* files also get loaded
source $ZSH/oh-my-zsh.sh
# Configs that can only work after "source $ZSH/oh-my-zsh.sh", such as Aliases that depend oh-my-zsh plugins
# Autojump configuration
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
[ -f /usr/share/autojump/autojump.sh ] && . /usr/share/autojump/autojump.sh
# Now source fzf.zsh , otherwise Ctr+r is overwritten by ohmyzsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPS="--extended"
alias k="k -h" # show human readable file sizes, in kb, mb etc
alias k="k -h" # show human readable file sizes, in kb, mb etc