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