diff --git a/home/dot_zsh.d/.chezmoiremove b/home/dot_zsh.d/.chezmoiremove new file mode 100644 index 0000000..2951f57 --- /dev/null +++ b/home/dot_zsh.d/.chezmoiremove @@ -0,0 +1,4 @@ +path.zsh +dev-tools.zsh +fzf.zsh +utils.zsh diff --git a/home/dot_zsh.d/core/env.zsh b/home/dot_zsh.d/core/env.zsh new file mode 100644 index 0000000..b4cc76a --- /dev/null +++ b/home/dot_zsh.d/core/env.zsh @@ -0,0 +1,7 @@ +export VISUAL="cursor" +export EDITOR="hx" + +export NI_DEFAULT_AGENT="pnpm" +export NI_GLOBAL_AGENT="pnpm" + +export LG_CONFIG_FILE="$HOME/.config/lazygit/config.yml" diff --git a/home/dot_zsh.d/path.zsh b/home/dot_zsh.d/core/path.zsh similarity index 100% rename from home/dot_zsh.d/path.zsh rename to home/dot_zsh.d/core/path.zsh diff --git a/home/dot_zsh.d/dev-tools.zsh b/home/dot_zsh.d/dev-tools.zsh deleted file mode 100644 index 02b0315..0000000 --- a/home/dot_zsh.d/dev-tools.zsh +++ /dev/null @@ -1,22 +0,0 @@ -# proto - version manager activation -eval "$(proto activate zsh --no-shim)" -export PROTO_AUTO_INSTALL=true -# Global npm packages PATH -export PATH="$PROTO_HOME/tools/node/globals/bin:$PATH" - -# Docker Desktop (optional - only present when Docker Desktop is installed) -[[ -f "$HOME/.docker/init-zsh.sh" ]] && source "$HOME/.docker/init-zsh.sh" - -# ni - package manager -export NI_DEFAULT_AGENT="pnpm" -export NI_GLOBAL_AGENT="pnpm" - -# Code editor -export VISUAL="cursor" -export EDITOR="hx" - -# Lazygit -export LG_CONFIG_FILE="$HOME/.config/lazygit/config.yml" - -# Vite+ bin (https://viteplus.dev) -. "$HOME/.vite-plus/env" diff --git a/home/dot_zsh.d/utils.zsh b/home/dot_zsh.d/functions/git.zsh similarity index 68% rename from home/dot_zsh.d/utils.zsh rename to home/dot_zsh.d/functions/git.zsh index 6a76d0e..1582eb0 100644 --- a/home/dot_zsh.d/utils.zsh +++ b/home/dot_zsh.d/functions/git.zsh @@ -14,15 +14,3 @@ gwn() { fi git gtr new "$branch_name" --from "origin/$default_branch" && cd "$(git gtr go "$branch_name")" } - -# 長時間コマンドの完了通知 -notify-after() { - "$@" - local exit_code=$? - if [ $exit_code -eq 0 ]; then - cmux notify --title "✓ Command Complete" --body "$1" - else - cmux notify --title "✗ Command Failed" --body "$1 (exit $exit_code)" - fi - return $exit_code -} diff --git a/home/dot_zsh.d/functions/notify.zsh b/home/dot_zsh.d/functions/notify.zsh new file mode 100644 index 0000000..83a0186 --- /dev/null +++ b/home/dot_zsh.d/functions/notify.zsh @@ -0,0 +1,11 @@ +# 長時間コマンドの完了通知 +notify-after() { + "$@" + local exit_code=$? + if (( exit_code == 0 )); then + cmux notify --title "✓ Command Complete" --body "$*" + else + cmux notify --title "✗ Command Failed" --body "$* (exit $exit_code)" + fi + return $exit_code +} diff --git a/home/dot_zsh.d/tools/docker.zsh b/home/dot_zsh.d/tools/docker.zsh new file mode 100644 index 0000000..98bcdf8 --- /dev/null +++ b/home/dot_zsh.d/tools/docker.zsh @@ -0,0 +1 @@ +[[ -f "$HOME/.docker/init-zsh.sh" ]] && source "$HOME/.docker/init-zsh.sh" diff --git a/home/dot_zsh.d/fzf.zsh b/home/dot_zsh.d/tools/fzf.zsh similarity index 100% rename from home/dot_zsh.d/fzf.zsh rename to home/dot_zsh.d/tools/fzf.zsh diff --git a/home/dot_zsh.d/tools/proto.zsh b/home/dot_zsh.d/tools/proto.zsh new file mode 100644 index 0000000..a4c9264 --- /dev/null +++ b/home/dot_zsh.d/tools/proto.zsh @@ -0,0 +1,2 @@ +eval "$(proto activate zsh --no-shim)" +export PROTO_AUTO_INSTALL=true diff --git a/home/dot_zsh.d/tools/vite-plus.zsh b/home/dot_zsh.d/tools/vite-plus.zsh new file mode 100644 index 0000000..f375c63 --- /dev/null +++ b/home/dot_zsh.d/tools/vite-plus.zsh @@ -0,0 +1 @@ +[[ -f "$HOME/.vite-plus/env" ]] && source "$HOME/.vite-plus/env" diff --git a/home/dot_zshrc b/home/dot_zshrc index 2e8a67d..a727b43 100644 --- a/home/dot_zshrc +++ b/home/dot_zshrc @@ -2,16 +2,25 @@ ZSH_CONFIG_DIR="${HOME}/.zsh.d" -# 各設定ファイルを読み込み -source "${ZSH_CONFIG_DIR}/path.zsh" +# Core +source "${ZSH_CONFIG_DIR}/core/path.zsh" +source "${ZSH_CONFIG_DIR}/core/env.zsh" fpath+=(${ZSH_CONFIG_DIR}/completions) -source "${ZSH_CONFIG_DIR}/dev-tools.zsh" -source "${ZSH_CONFIG_DIR}/fzf.zsh" -[ -f "${ZSH_CONFIG_DIR}/.local.zsh" ] && source "${ZSH_CONFIG_DIR}/.local.zsh" +# Tools +source "${ZSH_CONFIG_DIR}/tools/proto.zsh" +source "${ZSH_CONFIG_DIR}/tools/docker.zsh" +source "${ZSH_CONFIG_DIR}/tools/fzf.zsh" +source "${ZSH_CONFIG_DIR}/tools/vite-plus.zsh" -# Sheldon +# Machine-local overrides +[[ -f "${ZSH_CONFIG_DIR}/.local.zsh" ]] && source "${ZSH_CONFIG_DIR}/.local.zsh" + +# Plugins (Sheldon) eval "$(sheldon source)" -source "${ZSH_CONFIG_DIR}/utils.zsh" +# Functions +for f in "${ZSH_CONFIG_DIR}/functions/"*.zsh(N); do + source "$f" +done