chezmoi 調整架構,將共通部份移出

This commit is contained in:
Yuan Chiu 2025-05-02 10:47:03 +08:00
parent 42f0328079
commit 5e616bcd4f
3 changed files with 30 additions and 23 deletions

View File

@ -1,8 +1,27 @@
{{/* 以下是套用到 ~/.zshrc ~/.bashrc 用的共通內容 */}}
{{/* 以下是套用到 ~/.zshrc ~/.bashrc 用的共通內容 */ -}}
{{/* ---- 設定環境變數 ---------------------------------------------------- */}}
{{/* ---- 設定與修復PATH路徑對應 ------------------------------------------- */ -}}
# Created by `pipx` on 2023-01-30 19:57:14
export PATH="$PATH:$HOME/.local/bin"
# GoLang Path
export PATH="$PATH:$HOME/go/bin"
# Fix Python3 to python Path on macOS
if [ "$(uname -s)" = 'Darwin' ]; then
export PATH=/usr/local/opt/python/libexec/bin:$PATH
fi
# Install ruby¬
# Based on "`brew --prefix ruby`/bin"¬
export PATH="/usr/local/opt/ruby/bin:$PATH
# Based on "`gem environment gemdir`/bin"¬
export PATH="/usr/local/lib/ruby/gems/3.3.0/bin:$PATH
export PATH="$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH"
{{/* ---- 設定環境變數 ---------------------------------------------------- */ -}}
{{- /* 設定預設編輯器 */ -}}
{{ if eq .chezmoi.os "linux" }}
# linux config
@ -14,11 +33,11 @@ export EDITOR=nvim
export VISUAL=nvim
{{/* ---- 設定ailas ---------------------------------------------------- */}}
{{/* ---- 設定ailas ------------------------------------------------------ */ -}}
# alias
alias gitu='git add . && git commit && git push'
{{/* ---- 擴充功能 ---------------------------------------------------- */}}
{{/* ---- 擴充功能 ------------------------------------------------------- */ -}}
# 圖片顯示
# 既然即使加入判斷後還是「進入函數定義段落且噴錯」那就代表zsh 在解析 .zshrc 時,在到達 if 邏輯前,就已經知道 imgcat 是 alias並因此直接報錯這是因為
# ⚠️ 在 zsh 中,如果你寫 function_name() 這種形式,然後這個名稱之前被定義為 alias會在 parse 階段直接錯誤,不會等到 if 判斷。
@ -34,4 +53,4 @@ if ! alias imgcat &>/dev/null && ! functions imgcat &>/dev/null && command -v ma
magick "$1" -geometry 800x480 sixel:-
}'
fi
fi

View File

@ -8,6 +8,10 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[.chezmoitemplates/*]
insert_final_newline = false
trim_trailing_whitespace = true
[*.md]
indent_size = 4
indent_style = space

View File

@ -151,26 +151,10 @@ elif [ "$(uname -s)" = 'Darwin' ]; then
fi
# bindkey -s '^E' 'gnome-terminal --working-directory="$PWD" -- zsh\n'
# Install ruby¬
# Based on "`brew --prefix ruby`/bin"¬
export PATH="/usr/local/opt/ruby/bin:$PATH
# Based on "`gem environment gemdir`/bin"¬
export PATH="/usr/local/lib/ruby/gems/3.3.0/bin:$PATH
export PATH="$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH"
# Fix ython3 to python Path on macOS
if [ "$(uname -s)" = 'Darwin' ]; then
export PATH=/usr/local/opt/python/libexec/bin:$PATH
fi
# Created by `pipx` on 2023-01-30 19:57:14
export PATH="$PATH:$HOME/.local/bin"
# GoLang Path
export PATH="$PATH:$HOME/go/bin"
{{ if eq .chezmoi.os "darwin" -}}
# iterm2
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
{{ end -}}
zinit light mass8326/zsh-chezmoi