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,並因此直接報錯,這是因為: