前面在 第 4 篇 打通了桌面與基礎 CLI 底座,又在 第 7 篇 將經典 Vim 9 + vimplus 改造成了暗色毛玻璃編輯器。但真正在主力開發機上連續寫一天程式碼,你很快就會發現還差最後一塊拼圖——那些每天高頻切換的主力開發軟體:

  • VS Code 與 Cursor 雖然換了佈景主題,但行高偏擠、空白字元點陣太雜亂,兩端的 clangd 自動補全與格式化還各做各的;
  • 一進 tmux 分割視窗,Vim 9 裡的 24-bit 真彩色與 LSP 診斷波浪底線瞬間降級,複製文字跨 X11/SSH 時好時壞;
  • git diff 還是原始單調的紅綠行,找檔案和切換目錄全靠手敲 find + cd;
  • 順手打開 Typora 寫文件、按快捷鍵呼出 Guake 下拉終端機或用 gedit 瞄一眼設定檔,視覺風格又瞬間出戲。

這篇把上述四大模組一次性拉齊到整套專欄的統一視覺語言——**Catppuccin Mocha + Fluent-round-Dark + 強調藍 #89b4fa + Inter / HarmonyOS Sans SC / Sarasa Term SC Nerd**,全部已在 Ubuntu 22.04 LTS(Vim 9.2 / tmux 3.2a) 與 Ubuntu 24.04 LTS(Vim 9.1 / tmux 3.4) 雙機實測通過,所有避坑細節都已直接融入最終設定中,拿來即用。

先看全篇改造總覽表:

模組 涉及工具 核心落地內容 存放位置
雙端 IDE 精修 VS Code / Cursor 主題範疇高亮、中英 2:1 呼吸排版、大檔案保護、內建終端機 GPU 加速、雙端統一 clangd ~/.config/{Code,Cursor}/User/settings.json
零外掛終端機多工 tmux(3.2a / 3.4) 原生 Catppuccin Mocha 膠囊狀態列、TrueColor + 波浪底線透傳、xclip / OSC 52 雙通道剪貼簿 ~/.tmux.conf
Git & 搜尋效率鏈 delta / fzf / fd / zoxide / bat 免 sudo 靜態二進位、Catppuccin git diff、Ctrl+T/Alt+C 語法樹預覽、z 智慧跳目錄 ~/.local/bin/、~/.gitconfig、~/.zshrc、~/.config/bat/config
輕量工具視覺收尾 Typora / Guake / gedit Catppuccin Mocha 主題 + 系統三字型覆寫 + 18 色 16-bit 調色盤 + GtkSourceView 樣式 ~/.config/Typora/、dconf、~/.local/share/gtksourceview-4/styles/

一、VS Code & Cursor:從「換了佈景主題」到細節精修與雙端對齊

在第 4 篇裝好 Catppuccin Mocha 與 Material Icon Theme 之後,把下面這組細節精修同步寫入 ~/.config/Code/User/settings.json 與 ~/.config/Cursor/User/settings.json,即可把閱讀舒適度與雙端 C/C++ 工程行為徹底拉齊:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
// 1. 主題與作用域限定突顯(用 "[Catppuccin Mocha]" 鎖死作用域,避免日後切主題串色)
"workbench.colorTheme": "Catppuccin Mocha",
"workbench.iconTheme": "material-icon-theme",
"catppuccin.accentColor": "blue",
"workbench.colorCustomizations": {
"[Catppuccin Mocha]": {
"editor.lineHighlightBackground": "#31324488",
"editor.lineHighlightBorder": "#45475a66"
}
},

// 2. 排版、游標動態效果與大檔案保護
"editor.fontFamily": "'Sarasa Term SC Nerd', 'JetBrains Mono', Consolas, monospace",
"editor.fontLigatures": true,
"editor.fontSize": 16,
"editor.lineHeight": 1.5,
"editor.cursorSmoothCaretAnimation": "on",
"editor.smoothScrolling": true,
"editor.cursorSurroundingLines": 5,
"editor.stickyScroll.enabled": true,
"editor.renderWhitespace": "boundary",
"editor.largeFileOptimizations": true,

// 3. 內建終端機效能與對比度保底
"terminal.integrated.fontFamily": "'Sarasa Term SC Nerd', monospace",
"terminal.integrated.gpuAcceleration": "on",
"terminal.integrated.minimumContrastRatio": 4.5,

// 4. Markdown 預覽深色對齊(如安裝了 Markdown Preview Enhanced)
"markdown-preview-enhanced.previewTheme": "github-dark.css",

// 5. 雙端 C/C++ 統一交由 clangd + clang-format(停用 C_Cpp 內建引擎避免雙份診斷衝突)
"C_Cpp.intelliSenseEngine": "disabled",
"C_Cpp.autocomplete": "disabled",
"C_Cpp.formatting": "disabled",
"clangd.arguments": [
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--header-insertion=iwyu",
"--pch-storage=memory"
]
}

幾個立竿見影的細節取捨:

  • **editor.lineHeight: 1.5 + fontSize: 16**:為 Sarasa Term SC Nerd 的中英 2:1 漢字留出充足上下呼吸空間,長時間看長函式不累眼;
  • **editor.renderWhitespace: "boundary"**:相比 "all" 拿掉了英文單字之間密密麻麻的點陣噪點,同時依然清晰標出縮排空白與行尾多餘空白;
  • 背景圖(按需):如果你給編輯器疊了背景圖擴充功能,務必改為本機桌布路徑並把 "opacity" 控制在 **0.1**,既避免外部連結失效,又不影響深色程式碼對比度。

實機效果(Catppuccin Mocha 範疇高亮 + Sarasa Term SC Nerd 連字與 lineHeight: 1.5 + boundary 空白標記 + clangd 語意著色與 Inlay Hints):

VS Code Catppuccin Mocha 主題精修、Sarasa 連字排版與 clangd 語意高亮實機效果

快速驗收:開啟同一個 C++ 專案,在底部狀態列確認語言服務顯示 clangd 且無 C/C++ 重複警告;開啟一個超長日誌或大 JSON,頂部會自動提示大檔案最佳化模式生效,不掉幀。


二、tmux:零外掛原生 Catppuccin Mocha 膠囊狀態列與全鏈路透傳

許多人為了美化 tmux 會引入 TPM + 一堆 Shell 外掛,結果不僅多出一層維護成本,每次重新整理狀態列還要 fork 多個子程序。其實僅靠一份純原生的 ~/.tmux.conf(零外部外掛、零啟動開銷、相容 tmux 3.2a / 3.4),就能實現 Catppuccin Mocha 膠囊狀態列 + Vim 9 真彩色/波浪線透傳 + 本機/SSH 雙通道剪貼簿:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# ~/.tmux.conf(零外掛原生方案,相容 tmux 3.2a / 3.4)

# ─── 前綴鍵 ───────────────────────────────────────────────
set -g prefix C-b
bind C-b send-prefix

# ─── 基礎與真彩色 / 彎波浪線透傳(確保 tmux 內 Vim 9 + coc.nvim 零降級)───
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
set -ga terminal-overrides ",*256col*:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'

set -g focus-events on
set -sg escape-time 10
set -g history-limit 50000
set -g mouse on
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
set -g set-titles on

# ─── 高頻分割窗格與無前綴切換快速鍵 ────────────────────────────
bind r source-file ~/.tmux.conf \; display "tmux 設定已重新載入"
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n S-Left previous-window
bind -n S-Right next-window

# ─── 複製模式與系統剪貼簿雙通道相容(本機 X11 走 xclip,SSH 無 $DISPLAY 回退 OSC 52)───
setw -g mode-keys vi
set -g set-clipboard on
bind -T copy-mode-vi v send-keys -X begin-selection
if-shell "command -v xclip >/dev/null 2>&1 && [ -n \"\$DISPLAY\" ]" \
"bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'" \
"bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel"

# ─── Catppuccin Mocha 原生膠囊狀態列(需 Nerd Font,按下 Ctrl+B 時左側膠囊變桃橘色 #fab387)───
set -g status-position bottom
set -g status-interval 5
set -g status-justify left
set -g status-style "bg=#181825,fg=#cdd6f4"

set -g status-left-length 40
set -g status-left "#{?client_prefix,#[fg=#fab387]#[bg=#181825]#[fg=#1e1e2e]#[bg=#fab387]#[bold] 󰘳 #S #[fg=#fab387]#[bg=#181825] ,#[fg=#89b4fa]#[bg=#181825]#[fg=#1e1e2e]#[bg=#89b4fa]#[bold]  #S #[fg=#89b4fa]#[bg=#181825] }"

set -g status-right-length 80
set -g status-right "#[fg=#313244,bg=#181825]#[fg=#cdd6f4,bg=#313244] 󰒋 #H #[fg=#313244,bg=#181825] #[fg=#cba6f7,bg=#181825]#[fg=#1e1e2e,bg=#cba6f7,bold] 󰥔 %m-%d %H:%M #[fg=#cba6f7,bg=#181825]"

set -g window-status-separator " "
setw -g window-status-format "#[fg=#313244,bg=#181825]#[fg=#a6adc8,bg=#313244]#I:#W#[fg=#313244,bg=#181825]"
setw -g window-status-current-format "#[fg=#a6e3a1,bg=#181825]#[fg=#1e1e2e,bg=#a6e3a1,bold]#I:#W#[fg=#a6e3a1,bg=#181825]"

# ─── 窗格邊框與命令列提示樣式 ──────────────────────────────
set -g pane-border-style "fg=#313244"
set -g pane-active-border-style "fg=#89b4fa"
set -g message-style "bg=#313244,fg=#89b4fa,bold"
set -g message-command-style "bg=#313244,fg=#fab387,bold"
setw -g mode-style "bg=#45475a,fg=#cdd6f4,bold"

提示:上述設定中膠囊兩端(/)與圖示字元仰賴終端機已啟用 Sarasa Term SC Nerd(或任意 Nerd Font v3)。本機 X11 剪貼簿需安裝 xclip(sudo apt install -y xclip),無 $DISPLAY 的遠端 SSH 會自動回退原生 OSC 52,不報錯。

實機效果(左:git-delta 彩色 diff,右:bat Catppuccin Mocha + eza 目錄樹,底:tmux 零外掛原生膠囊狀態列):

tmux 零外掛原生 Catppuccin Mocha 膠囊狀態列、git-delta 語法高亮 diff 與 bat/eza 分割畫面實機效果

快速驗收:

1
2
3
4
5
# 重新載入設定(或在 tmux 內按 Ctrl+B 後按 r)
tmux source-file ~/.tmux.conf

# 在 tmux 內驗證 24-bit 真彩色與紅色彎波浪底線透傳
printf '\x1b[4:3m\x1b[58:2::243:139:168mCurly Undercurl OK\x1b[59m\x1b[4:0m\n'

預期看到帶紅色波浪底線的 Curly Undercurl OK,且按下 Ctrl+B 時左下角藍色 Session 膠囊即時切為桃橙色 #fab387。


三、Git 與現代終端機搜尋跳轉效率鏈(delta + fzf + fd + zoxide + bat)

Ubuntu 22.04 / 24.04 官方 apt 套件庫裡的終端機工具普遍版本老舊(甚至缺 fzf --zsh 整合選項)。統一採用**預編譯靜態二進位安裝到 ~/.local/bin/**,免 sudo、零系統污染,且兩代 Ubuntu 行為 100% 一致。

1. 免 sudo 安裝最新靜態二進位與 bat 主題對齊

以本機實測版本(delta 0.23.0、fzf 0.75.0、fd 10.5.2、zoxide 0.11.0、bat 0.27.0)為例,確保 ~/.local/bin 已在 PATH 前列,從各專案 GitHub Releases 下載對應 x86_64-unknown-linux-musl(fzf 為 linux_amd64)壓縮檔解壓縮二進位至 ~/.local/bin/ 並賦予可執行權限:

1
2
3
4
5
6
7
8
9
10
11
12
13
mkdir -p ~/.local/bin ~/.config/delta ~/.config/bat

# 下載官方 Catppuccin delta 配色清單
curl -fsSL https://raw.githubusercontent.com/catppuccin/delta/main/catppuccin.gitconfig \
-o ~/.config/delta/catppuccin.gitconfig

# 統一 bat 主題為內建 Catppuccin Mocha(與 delta 的 syntax-theme 完美契合)
cat > ~/.config/bat/config << 'EOF'
# Modern dark bat configuration
--theme="Catppuccin Mocha"
--style="numbers,changes,header"
--italic-text=always
EOF

裝完核驗版本:

1
delta --version && fzf --version && fd --version && zoxide --version && bat --version

2. 設定 ~/.gitconfig 接入 git-delta

在 ~/.gitconfig 中加入以下區塊,同時順手開啟 zdiff3 合併衝突上下文與移動程式碼區塊高亮:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[core]
autocrlf = input
pager = delta

[interactive]
diffFilter = delta --color-only

[include]
path = ~/.config/delta/catppuccin.gitconfig

[delta]
features = catppuccin-mocha
navigate = true
line-numbers = true
side-by-side = false

[diff]
tool = vimdiff
colorMoved = default

[merge]
conflictStyle = zdiff3

啟用 navigate = true 後,在長 git diff 或 git log -p 裡直接按 n / N 就能在檔案與改動區塊之間快速跳轉。

3. 在 ~/.zshrc 串聯 fzf + fd + bat + eza + zoxide

將下面這段追加到 ~/.zshrc 末尾(所有工具均帶 command -v 存在性守護,缺項也不會在啟動 Shell 時報錯):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# >>> modern-cli-efficiency >>>
if command -v fzf >/dev/null 2>&1; then
export FZF_DEFAULT_OPTS="\
--height=60% --layout=reverse --border=rounded --margin=1 --padding=1 \
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a,border:#6c7086,label:#cdd6f4"

if command -v fd >/dev/null 2>&1; then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
fi
if command -v bat >/dev/null 2>&1; then
export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :300 {}'"
fi
if command -v eza >/dev/null 2>&1; then
export FZF_ALT_C_OPTS="--preview 'eza --tree --level=2 --icons=always --color=always {}'"
fi

source <(fzf --zsh)
fi

if command -v zoxide >/dev/null 2>&1; then
# 先清掉 Oh-My-Zsh 舊 zsh-z 外掛可能遺留的 alias z='zshz 2>&1',避免遮蔽 zoxide 函式
unalias z 2>/dev/null
eval "$(zoxide init zsh)"
fi
# <<< modern-cli-efficiency <<<

設定完成後立刻解鎖 4 個高頻肌肉記憶:

  • **Ctrl+T**:用 fd 瞬時模糊檢索檔案(自動跳過 .git),右側即時用 bat 展示 Catppuccin Mocha 語法高亮程式碼預覽;
  • **Alt+C**:模糊檢索子目錄,右側即時用 eza --tree 預覽目錄樹,按下 Enter 直接 cd 進去;
  • **Ctrl+R**:圓角暗色浮窗模糊搜尋全部 Zsh 指令歷史紀錄;
  • **z <關鍵字> / zi**:按存取頻率與最近度直達任意深層專案目錄,zi 彈出 fzf 互動清單。

實機效果(fzf Catppuccin Mocha 圓角浮窗 + fd 模糊篩選 + bat 即時程式碼預覽):

fzf Catppuccin Mocha 圓角浮窗聯動 fd 篩選與 bat 語法高亮預覽實機效果

快速驗收:

1
2
3
4
5
source ~/.zshrc
# 確認 z 由 zoxide 函式接管(預期輸出 z: function,而不是 alias)
whence -w z
# 在任意有變動的 Git 儲存庫驗證 delta 生效
git diff

四、常用桌面工具視覺收尾(Typora / Guake / gedit)

把最後 3 個日常偶爾點開的桌面軟體也順手收尾到同一套色盤與字型,徹底消滅「突然蹦出白底或割裂字形」的體驗斷點。

1. Typora:Catppuccin Mocha + 系統三字型覆寫

  1. 從官方 catppuccin/typora 下載 catppuccin-mocha.css 與 catppuccin/{catppuccin-base,mocha}.css 放到 ~/.config/Typora/themes/;
  2. 在 ~/.config/Typora/themes/catppuccin-mocha.css 末尾追加系統字型覆寫,讓內文與程式碼區塊完全對齊桌面三字型:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@import url('./catppuccin/catppuccin-base.css');
@import url('./catppuccin/mocha.css');

/* 對齊系統桌面與程式碼字型:Inter + HarmonyOS Sans SC + Sarasa Term SC Nerd */
:root {
--font-family-sans: "Inter", "HarmonyOS Sans SC", "Noto Sans CJK SC", sans-serif;
--font-family-mono: "Sarasa Term SC Nerd", "JetBrains Mono", monospace;
}

body,
#write {
font-family: var(--font-family-sans) !important;
line-height: 1.75;
}

code,
pre,
tt,
.CodeMirror,
.md-fences {
font-family: var(--font-family-mono) !important;
}
  1. 同步更新 ~/.config/Typora/conf/conf.user.json 中的 defaultFontFamily 區塊:
1
2
3
4
5
6
7
8
{
"defaultFontFamily": {
"standard": "Inter",
"serif": "HarmonyOS Sans SC",
"sansSerif": "Inter",
"monospace": "Sarasa Term SC Nerd"
}
}
  1. 重新啟動 Typora,在選單列選擇 主題 → Catppuccin Mocha 即可生效。

實機效果(Typora Catppuccin Mocha + Inter / HarmonyOS Sans SC 內文表格與 Sarasa Term SC Nerd 程式碼區塊):

Typora Catppuccin Mocha 暗色主題與系統三字型覆寫實機效果

2. Guake(下拉終端機):一鍵寫入 dconf 主題與 18 色盤

Guake 使用 GTK 16-bit hex 格式儲存 18 色盤(16 個 ANSI 色 + 前景 #cdd6f4 + 背景 #1e1e2e)。直接執行下面這組實機驗證通過的 dconf write 指令,一條不漏地同步完畢:

1
2
3
4
5
6
dconf write /apps/guake/general/gtk-theme-name "'Fluent-round-Dark'"
dconf write /apps/guake/general/use-default-font false
dconf write /apps/guake/style/background/transparency 77
dconf write /apps/guake/style/font/style "'Sarasa Term SC Nerd 13'"
dconf write /apps/guake/style/font/palette-name "'Catppuccin Mocha'"
dconf write /apps/guake/style/font/palette "'#454547475A5A:#F3F38B8BA8A8:#A6A6E3E3A1A1:#F9F9E2E2AFAF:#8989B4B4FAFA:#F5F5C2C2E7E7:#9494E2E2D5D5:#BABAC2C2DEDE:#58585B5B7070:#F3F38B8BA8A8:#A6A6E3E3A1A1:#F9F9E2E2AFAF:#8989B4B4FAFA:#F5F5C2C2E7E7:#9494E2E2D5D5:#A6A6ADADC8C8:#CDCDD6D6F4F4:#1E1E1E1E2E2E'"

驗收:dconf dump /apps/guake/style/ 應準確輸出 palette-name='Catppuccin Mocha' 與 style='Sarasa Term SC Nerd 13'。

3. gedit(輕量文字編輯器):GtkSourceView 4 Catppuccin 樣式

安裝官方 catppuccin/gedit 配色方案並對齊等寬字型:

1
2
3
4
5
6
7
mkdir -p ~/.local/share/gtksourceview-4/styles
curl -fsSL https://raw.githubusercontent.com/catppuccin/gedit/main/themes/catppuccin-mocha.xml \
-o ~/.local/share/gtksourceview-4/styles/catppuccin-mocha.xml

dconf write /org/gnome/gedit/preferences/editor/use-default-font false
dconf write /org/gnome/gedit/preferences/editor/editor-font "'Sarasa Term SC Nerd 13'"
dconf write /org/gnome/gedit/preferences/editor/scheme "'catppuccin-mocha'"

驗收:dconf dump /org/gnome/gedit/preferences/editor/ 應顯示 scheme='catppuccin-mocha' 與 editor-font='Sarasa Term SC Nerd 13'。

4. 補充避坑:半透明 GTK3 主題(Fluent-round-Dark)下的兩處同源對比度問題

在使用 Fluent-round-Dark 這類內建半透明背景的 GTK3 主題時,以下兩個 GUI 應用程式會出現同源渲染問題,建議直接按最佳實踐設定從源頭避開:

  1. gedit / GNOME Text Editor 透明穿透與跨版本目錄差異

    • 根因:上游 catppuccin/gedit XML 缺少 version="1.0" 屬性,Ubuntu 22.04 的 libgtksourceview-4 會靜默拒載並回退亮色 classic 主題;疊加 Fluent-round-Dark 的 0.5 透明度 textview 後,編輯區會透出底層視窗且目前行發白刺眼。
    • Ubuntu 22.04 vs 24.04 目錄差異:
      • Ubuntu 22.04(gedit 41):配色 XML(含 version="1.0")放入 ~/.local/share/gtksourceview-4/styles/;
      • Ubuntu 24.04(gedit 46 + GNOME Text Editor):gedit 46 實際連結 libgedit-gtksourceview-300,需放入 ~/.local/share/libgedit-gtksourceview-300/styles/;gnome-text-editor 需將帶 kind="dark" version="1.0" 的 XML 放入 ~/.local/share/gtksourceview-5/styles/。
    • 實底保底:在 ~/.config/gtk-3.0/gtk.css 追加 window.gedit-window 及 textview 的 #1e1e2e 不透明背景覆蓋,徹底杜絕透底。
  2. Chrome 分頁列變灰、未啟用分頁文字看不清

    • 根因:在半透明 GTK3 主題下給 Chrome 開啟 GTK 主題整合(system_theme = 1),Chrome 會把 GTK3 headerbar 的半透明色錯誤映射為灰底暗字,導致非啟用分頁與分頁群組文字對比度崩壞。
    • 最佳實踐:Chrome 外觀保持 Classic(經典主題,system_theme = 0)+ 深色模式(color_scheme2 = 2),只同步網頁字型(Inter / HarmonyOS Sans SC / Sarasa Term SC Nerd),不開啟 GTK 外殼整合。

五、一鍵備份、還原與 Ubuntu 22.04 / 24.04 雙機同步

本篇所有改動 100% 落在使用者家目錄,無須觸碰任何系統級套件檔案,備份、還原與跨機復刻都可以一條指令收尾。

1. 改前一鍵快照與無損還原

1
2
3
4
5
6
7
8
9
10
11
12
13
# 一鍵備份
BACKUP_DIR=~/.local/share/devtools-beautify-backup
mkdir -p "$BACKUP_DIR"
cp -a ~/.tmux.conf ~/.gitconfig ~/.zshrc ~/.config/bat/config "$BACKUP_DIR/" 2>/dev/null || true
cp -a ~/.config/Code/User/settings.json "$BACKUP_DIR/vscode-settings.json" 2>/dev/null || true
cp -a ~/.config/Cursor/User/settings.json "$BACKUP_DIR/cursor-settings.json" 2>/dev/null || true
dconf dump /apps/guake/ > "$BACKUP_DIR/guake.dconf" 2>/dev/null || true
dconf dump /org/gnome/gedit/ > "$BACKUP_DIR/gedit.dconf" 2>/dev/null || true

# 需要局部或整體回滾時,依需求還原對應檔案與 dconf 即可:
# cp -a "$BACKUP_DIR/.tmux.conf" ~/.tmux.conf && tmux source-file ~/.tmux.conf
# dconf load /apps/guake/ < "$BACKUP_DIR/guake.dconf"
# dconf load /org/gnome/gedit/ < "$BACKUP_DIR/gedit.dconf"

2. Ubuntu 22.04 / 24.04 雙機一鍵對齊

因為靜態二進位(~/.local/bin/{delta,fzf,fd,zoxide,bat})與所有設定檔均在使用者目錄下,且 ~/.tmux.conf 對 tmux 3.2a(22.04) 與 tmux 3.4(24.04) 零差異相容,換機或雙機對齊只需同步以下路徑再執行 source ~/.zshrc:

1
2
3
4
5
6
7
8
9
10
# 範例:保持家目錄相對層級同步到另一台 Ubuntu 開發機(將 <remote-host> 替換為目標主機名稱)
(cd ~ && rsync -avzR \
.tmux.conf \
.gitconfig \
.config/bat/config \
.config/delta/catppuccin.gitconfig \
.config/Typora/themes/catppuccin-mocha.css \
.config/Typora/themes/catppuccin \
.local/share/gtksourceview-4/styles/catppuccin-mocha.xml \
<remote-host>:~/)

(若兩端均為同架構 Linux,也可以一併把 ~/.local/bin/{delta,fzf,fd,zoxide,bat} 同步過去,省去二次下載。)

3. 一鍵復刻與開源儲存庫

本系列涉及的全部終端機、編輯器、IDE、桌面美化設定與精簡軟體清單,已整理為零第三方相依(純 Python 3 標準函式庫)的模組化遷移儲存庫並開源,已在 Ubuntu 22.04(GNOME 42 / Python 3.10) 與 Ubuntu 24.04(GNOME 46 / Python 3.12) 雙版本實測通過:

  • 開源儲存庫:https://github.com/hippo0913/dotfiles
  • 支援互動式選單(./run.py)、純命令列套件(--profile cli)、完整桌面套件(--profile desktop)、唯讀健檢(--check)、零寫入預覽(--dry-run)、離線資源包(--assets-tar)以及自動時間戳記備份與一鍵還原腳本(restore.sh)。
1
2
3
4
5
git clone https://github.com/hippo0913/dotfiles.git ~/dotfiles
cd ~/dotfiles
./run.py --check # 先執行唯讀健檢
./run.py --dry-run --profile cli # 先預覽改動
./run.py # 互動式選單按需安裝

到這裡,從開機引導(GRUB / Plymouth / GDM)、GNOME 暗色毛玻璃桌面、字型與輸入法、經典 Vim 9,一直到 VS Code / Cursor / tmux / Git Delta / fzf / Typora / Guake / gedit,整台 Ubuntu 開發工作站完成了從核心引導到最後一個高頻開發工具的全鏈路視覺統一與效率閉環。


系列導覽

序號 文章標題 核心內容
#0 Ubuntu 開發工作站建置實戰 · 目錄 全鏈路架構藍圖、雙機基線與閱讀路線
#1 Ubuntu 22.04 GNOME 桌面環境設定指南 基礎起步:GNOME 擴充功能安裝、視窗習慣與 X11/Wayland 選型
#2 Ubuntu GNOME 暗色霧面玻璃桌面框架與雙檔案管理員透明度統一排錯(22.04 / 24.04) Fluent + Colloid + 動態桌布、Blur my Shell 調校與 Nautilus/Nemo 排錯
#3 Ubuntu 字型渲染、fontconfig 強綁定、fcitx5 美化與快捷鍵排錯實錄 Inter + HarmonyOS Sans SC + Sarasa、強綁定與輸入法排錯
#4 告別跨框架割裂:終端機 CLI 套件、Qt5、VS Code/Cursor 與 Chrome 暗色一體化 eza/bat/btop/fastfetch、qt5ct 融合配色、編輯器與 Chrome 無損腳本
#5 從電源鍵到鎖定畫面全鏈路閉環:GRUB、Plymouth、GDM 無損美化與一鍵還原 GRUB baseline JPEG、Plymouth bgrt、無損 GDM 與全域還原矩陣
#6 Ubuntu vimplus 安裝設定指南 零侵入改造 vimplus:coc.nvim + clangd、完整 LSP 鍵位與雙模式 Markdown 預覽
#7 不遷 Neovim:零侵入將經典 Vim 9 + vimplus 改造成現代暗色毛玻璃編輯器 Catppuccin Mocha 透底、實底圓角浮窗、膠囊狀態列、Vim 9 原生縮排線與 Buffer 級大檔案最佳化
#8 **Ubuntu 常用開發軟體全鏈路美化與效率對齊:VS Code / Cursor / tmux / Git Delta / fzf / Typora 一站式實戰**(目前篇) VS Code/Cursor 精修、零外掛 tmux 膠囊狀態列、delta/fzf/fd/zoxide 效率鏈與 Typora/Guake/gedit 收尾