-
-
Save SvenZhao/fc2e492c1a0c4a3fc2a0f4f8427a5cd9 to your computer and use it in GitHub Desktop.
linux设置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 设置前缀键为 Alt + ` | |
| set -g prefix M-` | |
| # 取消默认的前缀键绑定 | |
| unbind C-b | |
| # 绑定 Alt + ` 作为新的前缀键 | |
| bind M-` send-prefix | |
| set -g mouse on | |
| setw -g mode-keys vi | |
| bind '"' split-window -c '#{pane_current_path}' | |
| bind '%' split-window -h -c '#{pane_current_path}' | |
| set-option -g escape-time 50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================ | |
| # Zsh 配置 | |
| # ============================================================ | |
| typeset -U PATH | |
| # ============================================================ | |
| # [1] p10k 之前 - 只放有输出的初始化 | |
| # p10k instant prompt 启动后不允许任何输出到终端 | |
| # ============================================================ | |
| # fnm(eval 会产生输出,必须在 p10k 前) | |
| FNM_PATH="/Users/sven/Library/Application Support/fnm" | |
| if [[ -d "$FNM_PATH" ]]; then | |
| export PATH="$FNM_PATH:$PATH" | |
| eval "$(fnm env --use-on-cd 2>/dev/null)" | |
| fi | |
| # ============================================================ | |
| # [2] p10k instant prompt(启动加速器,让提示符秒出) | |
| # ============================================================ | |
| 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 | |
| # ============================================================ | |
| # [3] p10k 之后 - 插件、工具、PATH、别名全在这里 | |
| # ============================================================ | |
| # --- zinit 插件 --- | |
| # 新增插件:zinit ice wait lucid / zinit light <用户名>/<仓库名> | |
| # 加载 omz 插件:zinit snippet OMZP::<插件名> | |
| source /opt/homebrew/opt/zinit/zinit.zsh | |
| unalias zi 2>/dev/null # zi 留给 zoxide 的交互式跳转,zinit 直接用全名 | |
| # p10k 主题 + 外观配置(放一起) | |
| zinit light romkatv/powerlevel10k | |
| [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
| # 语法高亮(异步) | |
| zinit ice wait lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" | |
| zinit light zdharma-continuum/fast-syntax-highlighting | |
| # 命令自动补全建议(异步) | |
| zinit ice wait lucid | |
| zinit light zsh-users/zsh-autosuggestions | |
| # git 别名和补全(gst/gco/gp 等,异步) | |
| zinit ice wait lucid | |
| zinit snippet OMZP::git | |
| # zoxide - 智能 cd(z 命令) | |
| eval "$(zoxide init zsh)" | |
| DISABLE_UNTRACKED_FILES_DIRTY="true" | |
| # --- 别名--- | |
| alias n="npm run" | |
| alias rmdir='rm -rf' | |
| alias o2d='o2 p -d' | |
| alias o2p='o2 p -o' | |
| alias vim='nvim' | |
| alias vi='nvim' | |
| alias proxy='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890' | |
| # --- PATH 和系统工具环境 --- | |
| # 本地环境 - uv/pipx 等 Python 工具的环境变量(如果文件存在就加载) | |
| [[ -f "$HOME/.local/bin/env" ]] && . "$HOME/.local/bin/env" | |
| # bun - JavaScript 运行时和包管理器 | |
| export BUN_INSTALL="$HOME/.bun" | |
| export PATH="$BUN_INSTALL/bin:$PATH" | |
| [ -s "$BUN_INSTALL/_bun" ] && source "$BUN_INSTALL/_bun" # bun 补全 | |
| # golang - Go 语言环境 | |
| export GOPATH=$HOME/go # Go 工作目录 | |
| export GOBIN=$GOPATH/bin # Go 编译产物目录 | |
| export PATH=$PATH:$GOBIN | |
| # 鸿蒙 SDK - HarmonyOS 开发工具 | |
| export PATH=~/Library/OpenHarmony/Sdk/20/toolchains:$PATH | |
| export HDC_SERVER_PORT=7035 # HDC 调试端口 | |
| if [[ "$(launchctl getenv HDC_SERVER_PORT 2>/dev/null)" != "$HDC_SERVER_PORT" ]]; then | |
| launchctl setenv HDC_SERVER_PORT $HDC_SERVER_PORT | |
| fi | |
| # npm 全局包 - Node.js 全局安装的命令 | |
| export PATH="/Users/sven/.npm_global/bin:$PATH" | |
| # brew - macOS 包管理器(使用中科大镜像加速) | |
| export HOMEBREW_PREFIX="/opt/homebrew" | |
| export HOMEBREW_CELLAR="/opt/homebrew/Cellar" | |
| export HOMEBREW_REPOSITORY="/opt/homebrew" | |
| export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" | |
| export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git" | |
| export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api" | |
| export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/bottles" | |
| export PATH="$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment