From ee6816e27636282a61d787543f67e5e0f25129b8 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Fri, 2 May 2025 09:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A0=90=E8=A8=AD=E7=B7=A8?= =?UTF-8?q?=E8=BC=AF=E5=99=A8=EF=BC=8C=E4=B8=A6=E8=AA=BF=E6=95=B4chezmoi?= =?UTF-8?q?=E6=9E=B6=E6=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .chezmoi.toml.tmpl | 3 --- .chezmoitemplates/sh_common.tmpl | 21 +++++++++++++++++++++ dot_zshrc => dot_zshrc.tmpl | 6 +----- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .chezmoitemplates/sh_common.tmpl rename dot_zshrc => dot_zshrc.tmpl (95%) diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index f4e78a3..cb6b5f4 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -2,9 +2,6 @@ {{- $email := promptStringOnce . "email" "輸入您的Email地址" -}} sourceDir = "~/.local/share/chezmoi" -[edit] - command = "vim" - [data] name = {{ $name | quote }} email = {{ $email | quote }} diff --git a/.chezmoitemplates/sh_common.tmpl b/.chezmoitemplates/sh_common.tmpl new file mode 100644 index 0000000..fe6a9e2 --- /dev/null +++ b/.chezmoitemplates/sh_common.tmpl @@ -0,0 +1,21 @@ + +{{- /* ---- 設定環境變數 -------------------------------------------------- */ -}} + +{{- /* 設定預設編輯器 */ -}} +{{ if eq .chezmoi.os "linux" }} +# linux config +[ -n "$DISPLAY" ] && export EDITOR=kate|| export EDITOR=nvim +{{ else }} +export EDITOR=nvim +# non-linux config +{{ end }} + +export VISUAL=nvim + +{{- /* ---- 設定ailas ---------------------------------------------------- */ -}} + +## Alias section +alias cp="cp -i" # Confirm before overwriting something +alias df='df -h' # Human-readable sizes +alias free='free -m' # Show sizes in MB +alias gitu='git add . && git commit && git push' diff --git a/dot_zshrc b/dot_zshrc.tmpl similarity index 95% rename from dot_zshrc rename to dot_zshrc.tmpl index 0559cf5..97436f4 100644 --- a/dot_zshrc +++ b/dot_zshrc.tmpl @@ -123,11 +123,7 @@ zstyle ':completion:*:directory-stack' list-colors '=(#b) #([0-9]#)*( *)==95=38; # highlight case in select zstyle ':completion:*' menu select -## Alias section -alias cp="cp -i" # Confirm before overwriting something -alias df='df -h' # Human-readable sizes -alias free='free -m' # Show sizes in MB -alias gitu='git add . && git commit && git push' +{{ template "sh_common.tmpl" . }} # overwrite ls if command -v colorls &> /dev/null; then