From 5e616bcd4f3365153f685626f0116142e0813e31 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Fri, 2 May 2025 10:47:03 +0800 Subject: [PATCH] =?UTF-8?q?chezmoi=20=E8=AA=BF=E6=95=B4=E6=9E=B6=E6=A7=8B?= =?UTF-8?q?=EF=BC=8C=E5=B0=87=E5=85=B1=E9=80=9A=E9=83=A8=E4=BB=BD=E7=A7=BB?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .chezmoitemplates/sh_common.tmpl | 29 ++++++++++++++++++++++++----- .editorconfig | 4 ++++ dot_zshrc.tmpl | 20 ++------------------ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/.chezmoitemplates/sh_common.tmpl b/.chezmoitemplates/sh_common.tmpl index e6b04ea..6b79a31 100644 --- a/.chezmoitemplates/sh_common.tmpl +++ b/.chezmoitemplates/sh_common.tmpl @@ -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 \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index 6b495de..bad0daf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl index 7aaa682..7bddd80 100644 --- a/dot_zshrc.tmpl +++ b/dot_zshrc.tmpl @@ -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