This commit is contained in:
Steven Hobs 2025-03-27 15:55:35 +08:00
commit a307729742
7 changed files with 1817 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
plugins/

28
README.md Normal file
View File

@ -0,0 +1,28 @@
# LAZYZSH ZSH终端增强懒人包
## 前提
1. zsh
2. git
## 安装
一行命令
```
git clone --depth 1 https://git.unvec.site/stevenhobs/lazyzsh ~/.lazyzsh && echo "source $HOME/.lazyzsh/lazy.zsh" >> ~/.zshrc
```
## 其他
- wsl2关闭Win防火墙拦截
PowerShell管理远模式打开 根据自己的WSL网卡类型执行
```powershell
# 网卡 vEthernet (WSL (Hyper-V firewall))
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" -Action Allow
# 网卡 vEthernet (WSL)
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
```

13
alias.zsh Normal file
View File

@ -0,0 +1,13 @@
alias s=sudo
alias ls="ls --color"
alias l="ls -CF"
alias ll="ls -alhF"
alias la="ls -A"
alias dir="dir --color"
alias grep="grep --color"
alias diff="diff --color"
alias egrep="egrep --color"
alias fgrep="fgrep --color"
alias md="mkdir -p"
alias ip="ip -c"
alias tou=touch

4
init_plugins.zsh Normal file
View File

@ -0,0 +1,4 @@
mkdir -p "$LAZY_ZSH/plugins"
git clone --depth 1 "https://gitcode.com/zsh-users/zsh-syntax-highlighting.git" "$LAZY_ZSH/plugins/syntax-highlighting"
git clone --depth 1 "https://gitcode.com/zsh-users/zsh-autosuggestions.git" "$LAZY_ZSH/plugins/autosuggestions"
git clone --depth 1 "https://gitcode.com/romkatv/powerlevel10k.git" "$LAZY_ZSH/plugins/powerlevel10k"

42
lazy.zsh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/zsh
# [ -z "$PS1" ] && return
# [ ! -z "$LAZY_ZSH" ] && return
# Options
ZSH_PLUGIN_syntax_highlighting=ON
ZSH_PLUGIN_autosuggestions=ON
ZSH_PLUGIN_powerlevel10k=ON
# LazyZSH Config
export LAZY_ZSH="$HOME/.lazyzsh"
# Plugins
[ ! -d "$LAZY_ZSH/plugins" ] && . "$LAZY_ZSH/init_plugins.zsh"
[ "$ZSH_PLUGIN_syntax_highlighting" = ON ] && source "$LAZY_ZSH/plugins/syntax-highlighting/zsh-syntax-highlighting.zsh"
[ "$ZSH_PLUGIN_autosuggestions" = ON ] && source "$LAZY_ZSH/plugins/autosuggestions/zsh-autosuggestions.zsh"
[ "$ZSH_PLUGIN_powerlevel10k" = ON ] && {
source "$LAZY_ZSH/plugins/powerlevel10k/powerlevel10k.zsh-theme"
source "$LAZY_ZSH/p10k_theme.zsh"
}
# ~/.zsh_history
setopt histignorealldups sharehistory
HISTSIZE=1000
SAVEHIST=1000
HISTFILE="$HOME/.zsh_history"
source "$LAZY_ZSH/alias.zsh" # inner custom alias
[ -n $WSL_DISTRO_NAME ] && source "$LAZY_ZSH/wsl2.zsh" # wsl custom
[ -f ~/.profile ] && source ~/.profile # load bash profile
function setproxy() {
local host=${1:-127.0.0.1} # 更改IP为您的代理软件监听IP, 默认127.0.0.1
local port=${2:-7897} # 更改端口为您的代理软件监听端口, 默认7897
export http_proxy=http://$host:$port && export https_proxy=$http_proxy
export no_proxy=localhost,127.0.0.1,::1,.localdomain
echo "- You've set the network proxy! Info: $http_proxy"
}
function unsetproxy() {
unset http_proxy && unset https_proxy && unset no_proxy
echo "- You've unset the network proxy!"
}

1719
p10k_theme.zsh Normal file

File diff suppressed because it is too large Load Diff

10
wsl2.zsh Normal file
View File

@ -0,0 +1,10 @@
# This zsh is for the wsl distro
alias open="/mnt/c/Windows/explorer.exe"
alias notepad="/mnt/c/Windows/notepad.exe"
export NET_GATE="$(/bin/ip r | head -n1 | cut -d' ' -f3)"
# WSLG
export DISPLAY="$NET_GATE:0.0"
export LIBGL_ALWAYS_INDIRECT=true
export LIBGL_ALWAYS_SOFTWARE=true