more zsh configs
This commit is contained in:
parent
d95bca7bc5
commit
87a038f7df
@ -10,9 +10,49 @@ profile-edit () {
|
|||||||
profile
|
profile
|
||||||
}
|
}
|
||||||
|
|
||||||
#--- bat (cat) ---#
|
#--- custom CLI tools ---#
|
||||||
|
|
||||||
|
# Fast run a command in background with no log
|
||||||
|
bg () {
|
||||||
|
eval "$@" &>/dev/null &disown
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute an AppImage and automaticly +x it
|
||||||
|
appimage() {
|
||||||
|
chmod a+x $1
|
||||||
|
$1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set file meta (like icons) in linux fs
|
||||||
|
file-set-icon () {
|
||||||
|
gio set $1 metadata::custom-icon $2
|
||||||
|
}
|
||||||
|
file-rm-icon () {
|
||||||
|
gio set -d $1 metadata::custom-icon
|
||||||
|
}
|
||||||
|
cat-desktop-ini () {
|
||||||
|
cat "$1/desktop.ini"
|
||||||
|
}
|
||||||
|
|
||||||
|
# # where proxy
|
||||||
|
# proxy () {
|
||||||
|
# export http_proxy="http://127.0.0.1:7890"
|
||||||
|
# export https_proxy="http://127.0.0.1:7890"
|
||||||
|
# echo "HTTP Proxy on"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# # where noproxy
|
||||||
|
# noproxy () {
|
||||||
|
# unset http_proxy
|
||||||
|
# unset https_proxy
|
||||||
|
# echo "HTTP Proxy off"
|
||||||
|
# }
|
||||||
|
|
||||||
|
#--- enhanced CLI tools aliases ---#
|
||||||
|
|
||||||
|
# cat is bat
|
||||||
alias cat='bat'
|
alias cat='bat'
|
||||||
#--- lsd ---#
|
# ls is lsd
|
||||||
alias cols='lsd'
|
alias cols='lsd'
|
||||||
alias crls='cols'
|
alias crls='cols'
|
||||||
alias ccls='crls -g'
|
alias ccls='crls -g'
|
||||||
@ -25,8 +65,15 @@ alias l='cl'
|
|||||||
alias ll='cll'
|
alias ll='cll'
|
||||||
alias la='cla'
|
alias la='cla'
|
||||||
alias lgg='ccls --tree'
|
alias lgg='ccls --tree'
|
||||||
|
# cd is zoxide
|
||||||
#--- zoxide (cd) ---#
|
|
||||||
# zoxide must init after compinit is called
|
# zoxide must init after compinit is called
|
||||||
eval "$(zoxide init zsh)"
|
eval "$(zoxide init zsh)"
|
||||||
alias cd='z'
|
alias cd='z'
|
||||||
|
# fuck
|
||||||
|
eval $(thefuck --alias)
|
||||||
|
|
||||||
|
#--- other toolchain alias ---#
|
||||||
|
|
||||||
|
# gcc c++ complier
|
||||||
|
alias gpp="g++"
|
||||||
|
alias gxx="g++"
|
@ -10,6 +10,9 @@
|
|||||||
#- Compilation flags
|
#- Compilation flags
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
# export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
||||||
|
#- Fix ^M when enter Enter
|
||||||
|
# stty icrnl
|
||||||
|
|
||||||
#--- Editor (for normal system local/remote) ---#
|
#--- Editor (for normal system local/remote) ---#
|
||||||
if [[ -n $SSH_CONNECTION ]]; then
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
export EDITOR='code'
|
export EDITOR='code'
|
||||||
@ -37,3 +40,72 @@ export config="$HOME/.config"
|
|||||||
# Workspaces
|
# Workspaces
|
||||||
export ws="$HOME/documents/workspaces"
|
export ws="$HOME/documents/workspaces"
|
||||||
export tests="$data/__test"
|
export tests="$data/__test"
|
||||||
|
|
||||||
|
#--- messing configs ---#
|
||||||
|
|
||||||
|
# jetbrains netfilter vmoption
|
||||||
|
___MY_VMOPTIONS_SHELL_FILE="${HOME}/.jetbrains.vmoptions.sh"; if [ -f "${___MY_VMOPTIONS_SHELL_FILE}" ]; then . "${___MY_VMOPTIONS_SHELL_FILE}"; fi
|
||||||
|
|
||||||
|
# yay别名,用于自定义仿apt命令
|
||||||
|
yat() {
|
||||||
|
|
||||||
|
if [ -z "$1" ];then
|
||||||
|
yay;
|
||||||
|
else
|
||||||
|
if [ "$1" = "install" ];then # 安装软件
|
||||||
|
yay -S $2;
|
||||||
|
elif [ "$1" = "update" ];then # 更新数据库
|
||||||
|
yay -Sy;
|
||||||
|
elif [ "$1" = "upgrade" ];then # 升级整个系统,y是更新数据库,u是升级软件
|
||||||
|
yay -Syu;
|
||||||
|
elif [ "$1" = "search" ];then # 在包数据库中查询软件
|
||||||
|
yay -Ss $2;
|
||||||
|
elif [ "$1" = "show" ];then # 显示软件的详细信息
|
||||||
|
yay -Si $2;
|
||||||
|
elif [ "$1" = "info" ];then # 显示已安装的软件的详细信息 *
|
||||||
|
yay -Qi $2;
|
||||||
|
elif [ "$1" = "path" ];then # 列出已安装的软件使用的文件夹 *
|
||||||
|
yay -Ql $2;
|
||||||
|
elif [ "$1" = "clear" ];then # 清除软件缓存,即/var/cache/pacman/pkg目录下的文件
|
||||||
|
yay -Sc;
|
||||||
|
elif [ "$1" = "clean" ];then # alias ^
|
||||||
|
yay -Sc;
|
||||||
|
elif [ "$1" = "remove" ];then # 删除单个软件
|
||||||
|
yay -R $2;
|
||||||
|
elif [ "$1" = "autoremove" ];then # 删除指定软件及其没有被其他已安装软件使用的依赖关系
|
||||||
|
if [ -z "$2" ]
|
||||||
|
then
|
||||||
|
yay -c;
|
||||||
|
else
|
||||||
|
yay -Rs $2;
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "list" ];then # 查询已安装的软件包
|
||||||
|
yay -Qs $2;
|
||||||
|
elif [ "$1" = "dpkg" ];then # 从本地文件安装
|
||||||
|
yay -U $2;
|
||||||
|
else # 默认命令参数
|
||||||
|
yay $1;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# minecraft
|
||||||
|
minecraft () {
|
||||||
|
pwd_curr = pwd
|
||||||
|
cd /data/Game/Minecraft/
|
||||||
|
java -jar /data/Game/Minecraft/HMCL.jar
|
||||||
|
cd $pwd_curr
|
||||||
|
}
|
||||||
|
|
||||||
|
#--- Welcome Message! ---#
|
||||||
|
# May only works in some system
|
||||||
|
|
||||||
|
if [ -z "$RC_LOADED" ];then
|
||||||
|
lolcat "/etc/motd.backup"
|
||||||
|
else
|
||||||
|
lolcat "$HOME/.config/motd/100-rc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
RC_LOADED=1
|
||||||
|
14
zsh/p10k.zsh
14
zsh/p10k.zsh
@ -35,6 +35,7 @@
|
|||||||
os_icon # os identifier
|
os_icon # os identifier
|
||||||
# cpu_arch # CPU architecture
|
# cpu_arch # CPU architecture
|
||||||
context # user@hostname
|
context # user@hostname
|
||||||
|
disk_usage # disk usage
|
||||||
ip # ip address and bandwidth usage for a specified network interface
|
ip # ip address and bandwidth usage for a specified network interface
|
||||||
# public_ip # public IP address
|
# public_ip # public IP address
|
||||||
# =========================[ Line #2 ]=========================
|
# =========================[ Line #2 ]=========================
|
||||||
@ -52,18 +53,16 @@
|
|||||||
# last prompt line gets hidden if it would overlap with left prompt.
|
# last prompt line gets hidden if it would overlap with left prompt.
|
||||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||||
# =========================[ Line #1 ]=========================
|
# =========================[ Line #1 ]=========================
|
||||||
proxy # system-wide http/https/ftp proxy
|
|
||||||
battery # internal battery
|
|
||||||
ram # free RAM
|
|
||||||
# wifi # wifi speed
|
# wifi # wifi speed
|
||||||
# vpn_ip # virtual private network indicator
|
# vpn_ip # virtual private network indicator
|
||||||
# load # CPU load
|
proxy # system-wide http/https/ftp proxy
|
||||||
# disk_usage # disk usage
|
|
||||||
# swap # used swap
|
|
||||||
todo # todo items (https://github.com/todotxt/todo.txt-cli)
|
todo # todo items (https://github.com/todotxt/todo.txt-cli)
|
||||||
timewarrior # timewarrior tracking status (https://timewarrior.net/)
|
timewarrior # timewarrior tracking status (https://timewarrior.net/)
|
||||||
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
|
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
|
||||||
per_directory_history # Oh My Zsh per-directory-history local/global indicator
|
per_directory_history # Oh My Zsh per-directory-history local/global indicator
|
||||||
|
ram # free RAM
|
||||||
|
# swap # used swap
|
||||||
|
# load # CPU load
|
||||||
time # current time
|
time # current time
|
||||||
newline # \n
|
newline # \n
|
||||||
# =========================[ Line #2 ]=========================
|
# =========================[ Line #2 ]=========================
|
||||||
@ -116,6 +115,7 @@
|
|||||||
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
||||||
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
||||||
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
|
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
|
||||||
|
battery # internal battery
|
||||||
# =========================[ Line #3 ]=========================
|
# =========================[ Line #3 ]=========================
|
||||||
newline
|
newline
|
||||||
# example # example user-defined segment (see prompt_example function below)
|
# example # example user-defined segment (see prompt_example function below)
|
||||||
@ -1710,7 +1710,7 @@
|
|||||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
||||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
||||||
# seen the warning, or if you are unsure what this all means.
|
# seen the warning, or if you are unsure what this all means.
|
||||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
|
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
|
||||||
|
|
||||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
||||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
||||||
|
Loading…
Reference in New Issue
Block a user