From e32b7a10a58964c9d89d557434b11dc28be05005 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Fri, 2 May 2025 20:32:07 +0800 Subject: [PATCH] =?UTF-8?q?common.sh:=20=E6=A0=B9=E6=93=9A=E5=B8=B8?= =?UTF-8?q?=E6=94=B9=E7=9A=84=E9=83=A8=E4=BB=BD=EF=BC=8C=E6=8C=AA=E5=8B=95?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .chezmoitemplates/common.sh.tmpl | 33 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.chezmoitemplates/common.sh.tmpl b/.chezmoitemplates/common.sh.tmpl index 94a125b..de94517 100644 --- a/.chezmoitemplates/common.sh.tmpl +++ b/.chezmoitemplates/common.sh.tmpl @@ -1,5 +1,21 @@ {{/* 以下是套用到 ~/.zshrc ~/.bashrc 用的共通內容 */ -}} +{{/* ---- 設定ailas ------------------------------------------------------ */ -}} +# alias +alias gitu='git add . && git commit && git push' + +{{/* ---- 設定環境變數 ---------------------------------------------------- */ -}} +# 設定預設編輯器 +{{ if false -}} {{/* 不執行 */}} +{{ if eq .chezmoi.os "linux" }} +[ -n "$DISPLAY" ] && export EDITOR=kate|| export EDITOR=nvim +{{ else }} +export EDITOR=nvim +{{ end }} +{{ end -}} + +export EDITOR=nvim +export VISUAL=nvim {{/* ---- 設定與修復PATH路徑對應 ------------------------------------------- */ -}} @@ -21,23 +37,6 @@ export PATH="/usr/local/opt/ruby/bin:$PATH"¬ 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 false -}} {{/* 不執行 */}} -{{ if eq .chezmoi.os "linux" }} -[ -n "$DISPLAY" ] && export EDITOR=kate|| export EDITOR=nvim -{{ else }} -export EDITOR=nvim -{{ end }} -{{ end -}} - -export EDITOR=nvim -export VISUAL=nvim - -{{/* ---- 設定ailas ------------------------------------------------------ */ -}} -# alias -alias gitu='git add . && git commit && git push' - {{/* ---- 擴充功能 ------------------------------------------------------- */ -}} # 圖片顯示 # 既然即使加入判斷後還是「進入函數定義段落且噴錯」,那就代表:zsh 在解析 .zshrc 時,在到達 if 邏輯前,就已經知道 imgcat 是 alias,並因此直接報錯,這是因為: