跳到主要内容

常用配置

.zshrc 配置

# 配置~/.zshrc
# ==============================================
# 高性能 Zsh 配置 (zinit + Powerlevel10k)
# 适用于新设备,无 OMZ 依赖
# 最后更新: 2026-05-31
# ==============================================

# ---- 1. 自动安装 zinit (如果缺失) ----
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"

export FNM_LOGLEVEL=quiet


# ===== 1. zinit 自启动(必须放在最顶部) =====
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"

export HISTFILE="$HOME/.zsh_history"
export HISTSIZE=10000
export SAVEHIST=10000
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt SHARE_HISTORY

# 智能提示
zinit light zsh-users/zsh-completions

# 现在初始化补全系统(compdef 将在这之后可用)
autoload -Uz compinit
compinit -u # -u 跳过不安全目录的提示,避免产生额外输出

# ===== 2. Powerlevel10k 瞬时提示(Instant Prompt) =====
# 必须紧挨着 zinit 加载之后,且在加载主题之前
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. 加载插件(全部使用轻量的独立项目或 OMZ 片段) =====
# Git 别名(OMZ git 插件片段)
zinit snippet OMZP::git

# 自动补全建议
zinit light zsh-users/zsh-autosuggestions

# 语法高亮(必须尽可能晚加载,所以先标记为 defer)
zinit ice wait lucid
zinit light zsh-users/zsh-syntax-highlighting

# 目录跳转(z),使用更快的 rust 版本 zoxide,或保留原版 rupa/z
# 如果不想装 zoxide,可以用原版 rupa/z:
# zinit light rupa/z

# extract 万能解压命令
zinit snippet OMZP::extract

# 历史子字符串搜索
zinit light zsh-users/zsh-history-substring-search

# 浏览器搜索命令
zinit snippet OMZP::web-search

# ===== 4. Powerlevel10k 主题 =====
zinit ice depth=1
zinit light romkatv/powerlevel10k

# 加载 p10k 配置
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# ===== 5. 你的自定义别名 =====
alias tp="cd ~/Desktop/project"
alias ts="cd ~/Desktop/static"

alias arm="ssh root@hzy777.eu.org"
alias nas="ssh admin1@cao.us.kg"
alias tx="ssh tx"

alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF --color=auto'
alias l.='ls -d .* --color=auto'
alias la='ls -A --color=auto'
alias ll='ls -alFh --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'

# ===== 6. 历史子字符串搜索的按键绑定 =====
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down

# ===== 7. NVM 配置 =====
# ===== 7. fnm 配置 =====
eval "$(fnm env --use-on-cd)"


# ===== 8. Bun 配置 =====
[ -s "/Users/scorpion/.bun/_bun" ] && source "/Users/scorpion/.bun/_bun"
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"

# 其他环境
. "$HOME/.local/bin/env"
. "$HOME/.cargo/env"

# Added by codebase-memory-mcp install
export PATH="/Users/scorpion/.local/bin:$PATH"

.vimrc 配置

let mapleader = ' '

no <leader>y "*y
no <leader>p "*p
nm <leader>q :qa!<cr>
nm <leader>v :e $MYVIMRC<cr>
" nm <leader>s :%s/\s\+$//g<cr>
nm <leader><leader> :FZF<cr>
no! <c-a> <HOME>
no! <c-e> <END>

" 符号补全
inoremap ( ()<Esc>i
inoremap { {}<Esc>i
inoremap [ []<Esc>i
inoremap " ""<Esc>i


set number " 显示行号
" set relativenumber " 显示相对行号
set incsearch " 实时开启搜索高亮
set hlsearch " 搜索结果高亮
set autoindent " 自动缩进
set smartindent " 智能缩进
set tabstop=4 " 设置tab制表符号所占宽度为4
set softtabstop=4 " 设置按tab时缩进宽度为4
set shiftwidth=4 " 设置自动缩进宽度为4
set expandtab " 缩进时将tab制表服转为空格
set smartcase " 开启智能大小写查找
set encoding=utf-8 " Use UTF-8.
set showcmd " Display incomplete commands.
set clipboard^=unnamed,unnamedplus " 开启系统剪切板
set cursorline " 高亮当前行
set ignorecase " 设置忽略大小写
set smartcase " 设置智能大小写
set ruler " 设置显示当前位置
" set autoread
filetype on " 开启文件类型检测
filetype plugin indent on " 开启文件类型插件检测
syntax on " 开启语法高亮


" 插件管理
call plug#begin('~/.vim/plugged')

" style start
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

Plug 'mhinz/vim-startify'

"Plug 'morhetz/gruvbox'
Plug 'w0ng/vim-hybrid'

" style end

" markdown start
Plug 'suan/vim-instant-markdown'
Plug 'tpope/vim-markdown'
" markdown end

" syntax start
" 语法补全插件
" Plug 'valloric/youcompleteme'
" syntax end

" code start
Plug 'yggdroot/indentline'
Plug 'pangloss/vim-javascript'
Plug 'junegunn/fzf' " 代码对齐
Plug 'tpope/vim-commentary' " 注释插件 gcc 注释当行,gc注释多行
Plug 'lifepillar/vim-mucomplete' " 代码不全
Plug 'vim-scripts/SearchComplete' " 搜索补全
" code end
call plug#end()

" 设置主题
set background=dark
"let g:gruvbox_italic=1
"colorscheme gruvbox
colorscheme hybrid

" vim-instant-markdown
let g:instant_markdown_allow_unsafe_content = 1
let g:instant_markdown_autoscroll = 0 " 自动滚动到输入位置

" tpope/vim-markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh','javascript','css','java','c']
let g:markdown_minlines = 100

" airline
let g:airline#extensions#tabline#enabled = 1 " 设置允许修改默认tab样式
let g:airline#extensions#tabline#formatter = 'jsformatter' " 设置默认tab栏样式

" airline-theme
"let g:airline_theme='solarized'
let g:airline_theme='angr' " 好像还是比较喜欢这个颜色

~/.ssh/config 配置

# Codeup 示例用户1
Host codeup.aliyun.com
HostName codeup.aliyun.com
IdentitiesOnly yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/for_ali
User hezy

Host codeup-chat
HostName codeup.aliyun.com
IdentitiesOnly yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/for_chat_demo
User hezhiyang

Host github.com
IdentitiesOnly yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/for_gitee
User Scorpion777


Host gitee.com
IdentitiesOnly yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/for_gitee
User Scorpion777

Host hzy777.eu.org
IdentitiesOnly yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/for_armbian
User root

Host tx
HostName 3o3.top
User root
IdentityFile ~/.ssh/for_tx_ecs
IdentitiesOnly yes
PreferredAuthentications publickey

Host *
ServerAliveInterval 60
ServerAliveCountMax 3

docker daemon.json 配置

{
"dns": ["8.8.8.8","114.114.114.114"],
"registry-mirrors": [
"https://docker.1ms.run",
"https://docker.xuanyuan.me"
],
"ipv6": true,
"data-root": "/mnt/cdisk/docker_vol",
"log-driver": "json-file",
"log-opts":{
"max-size":"100m",
"max-file":"3",
"compress":"true"
}
}

zed 配置

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"edit_predictions": {
"provider": "zed",
},
"proxy": "",
"diff_view_style": "unified",
"cli_default_open_behavior": "new_window",
"language_models": {
"openai_compatible": {},
},
"buffer_line_height": "comfortable",
"buffer_font_weight": 400.0,
"context_servers": {
"mcp-server-context7": {
"enabled": true,
"remote": false,
"settings": {
"context7_api_key": "",
},
},
"mcp-server-github": {
"enabled": true,
"remote": false,
"settings": {
"github_personal_access_token": "GITHUB_PERSONAL_ACCESS_TOKEN",
},
},
},
"agent": {
"sidebar_side": "right",
"dock": "right",
"default_profile": "write",
"tool_permissions": {
"tools": {
"mcp:mcp-server-context7:query-docs": {
"default": "allow",
},
"write_file": {
"default": "allow",
},
"delete_path": {
"always_allow": [
{
"pattern": "^docs/linux相关/",
},
],
},
"terminal": {
"default": "allow",
},
"edit_file": {
"default": "allow",
},
},
},
"default_model": {
"effort": "high",
"provider": "deepseek",
"model": "deepseek-v4-flash",
"enable_thinking": true,
},
"favorite_models": [],
"model_parameters": [],
},
"agent_servers": {
"gemini": {
"type": "registry",
},
"codex-acp": {
"default_config_options": {
"model": "gpt-5.3-codex",
"reasoning_effort": "high",
"mode": "full-access",
},
"type": "registry",
},
"qwen-code": {
"type": "registry",
},
"claude-acp": {
"default_config_options": {
"fast": true,
"agent": "Frontend Developer",
"mode": "plan",
"effort": "high",
"model": "sonnet",
},
"type": "registry",
},
"opencode": {
"type": "registry",
},
},
"base_keymap": "VSCode",
"icon_theme": {
"mode": "dark",
"light": "Zed (Default)",
"dark": "Material Icon Theme",
},
"vim_mode": true,
"ui_font_size": 20,
"buffer_font_family": "Hack Nerd Font Mono",
"buffer_font_size": 18.0,
"theme": {
"mode": "dark",
"light": "One Light",
"dark": "One Dark Pro",
},
"show_completions_on_input": true, // 输入时显示补全
"show_edit_predictions": true, // 内联补全
"auto_update": true, // 自动更新
// "autosave": "on_window_change", // 自动保存

"tabs": {
"file_icons": true,
"git_status": true,
"show_diagnostics": "errors",
},
"toolbar": {
// Whether to show breadcrumbs.
"breadcrumbs": true,
// Whether to show quick action buttons.
"quick_actions": false,
// Whether to show the Selections menu in the editor toolbar
"selections_menu": false,
},

"git": {
"git_gutter": "tracked_files", // 文件左边显示 git gutter,修改黄色,新增绿色,删除红色等
"inline_blame": {
// 在聚焦行显示 git blame
"enabled": false, // 是否显示
"delay_ms": 2000, // 延迟显示
"show_commit_summary": true, // 显示摘要
},
},
"preview_tabs": {
"enabled": true, // 文件预览,双击正式打开
"enable_preview_from_file_finder": true, // 代码查找器中打开
"enable_keep_preview_on_code_navigation": true, // 代码导航时打开
},
"telemetry": {
// 遥测
"diagnostics": false, // 诊断
"metrics": false, // 指标
},
"terminal": {
"env": {
// 设置终端的环境变量
"key": "value",
"EDITOR": "zed --wait",
},
"shell": "system", // 使用系统默认的shell,通常是 /etc/passwd 文件
"button": true,
"copy_on_select": true,
"blinking": "on",
"font_family": "Hack Nerd Font Mono",
},
"project_panel": {
"dock": "left", // 文件目录位置
"git_status": true, // git 状态
"indent_size": 20, // 缩进尺寸,像素为单位
"indent_guides": {
// 缩进线
"show": "always",
},
"scrollbar": {
"show": "never", // 滚动条,
},
},
"outline_panel": {
// 大纲面板
"dock": "left",
"button": true, // 是否显示按钮
},
"collaboration_panel": {
// 协作面板
"dock": "left",
"button": false,
},
"git_panel": {
"tree_view": true,
"button": true,
"dock": "left",
},
"format_on_save": "on",
"formatter": "prettier",
"prettier": {
"allowed": true,
"tabWidth": 2,
"bracketSpacing": true,
"semi": false,
"jsxSingleQuote": true,
"singleQuote": true,
"useTabs": false,
"printWidth": 100,
"trailingComma": "all"
},
"languages": {
"Python": {
"tab_size": 4,
"format_on_save": "on",
"language_servers": ["ty", "!basedpyright", "..."],
"code_actions_on_format": {
"source.organizeImports.ruff": true,
},
"formatter": {
"language_server": {
"name": "ruff",
},
},
},
"JavaScript": {
"tab_size": 2,
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}"],
},
},
},
"Rust": {
"formatter": "language_server",
"format_on_save": "on",
},
"Markdown": {
"enable_language_server": false,
},
},
"lsp": {
"vtsls": {
"settings": {
"typescript": {
"updateImportsOnFileMove": {
"enabled": "always",
},
},
"javascript": {
"updateImportsOnFileMove": {
"enabled": "always",
},
},
},
"enable_lsp_tasks": true,
},
"typescript-language-server": {
"initialization_options": {
// These are not supported (VSCode dotted style):
// "preferences.strictNullChecks": true,
// "preferences.target": "ES2020"
//
// These is correct (nested notation):
"preferences": {
"strictNullChecks": true,
"target": "ES2020",
},
},
},
"rust-analyzer": {
"initialization_options": {
"check": {
"command": "clippy",
},
},
},
"tailwindcss-language-server": {
"settings": {
"tailwindCSS": {
"emmetCompletions": true,
},
},
},
"basedpyright": {
"settings": {
"basedpyright.analysis": {
"diagnosticMode": "workspace",
"inlayHints": {
"callArgumentNames": false,
},
},
},
},

},

"unnecessary_code_fade": 0.7, // 淡化未使用的代码
"current_line_highlight": "all", // 当前行高亮
"lsp_highlight_debounce": 75, // LSP 提示防抖延迟,ms
}

ghostty 配置

# ============================================
# 👻 Ghostty 开发者配置 - 专为写代码优化
# ============================================

# --- 字体与外观 ---
font-family = "Hack Nerd Font Mono"
font-size = 16
# 明确指定斜体所用的字体
# font-family-italic = "Hack Nerd Font Mono Italic"
font-style = italic
# 启用连字特性 (calt)
font-feature = calt

theme = One Dark Two
background-opacity = 0.88
background-blur = 20
window-save-state = always

# --- 开发效率配置 ---
cursor-style = block
cursor-style-blink = true

# shell-integration = none
shell-integration = detect
# shell-integration-features = sudo,title
# 多个功能用逗号分隔
shell-integration-features = cursor,sudo,title
# shell-integration-features = sudo,title

mouse-scroll-multiplier = 2.5
link-url = true
copy-on-select = clipboard

# --- 快捷键定制 (修正了语法) ---
# 分屏 (沿用 VSCode 习惯)
keybind = cmd+d=new_split:right
keybind = cmd+shift+d=new_split:down

# 标签页切换 (沿用浏览器习惯)
keybind = cmd+shift+[=previous_tab
keybind = cmd+shift+]=next_tab

# 新建与缩放
keybind = cmd+t=new_tab
keybind = cmd+n=new_window
keybind = cmd+plus=increase_font_size:1
keybind = cmd+minus=decrease_font_size:1

# --- 原生感细节 ---
window-decoration = auto
macos-titlebar-style = tabs

# 自动处理SSH terminfo 兼容性
shell-integration-features = sudo, title, ssh-env, ssh-terminfo