Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions home/dot_zsh.d/.chezmoiremove
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
path.zsh
dev-tools.zsh
fzf.zsh
utils.zsh
7 changes: 7 additions & 0 deletions home/dot_zsh.d/core/env.zsh
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
22 changes: 0 additions & 22 deletions home/dot_zsh.d/dev-tools.zsh

This file was deleted.

12 changes: 0 additions & 12 deletions home/dot_zsh.d/utils.zsh → home/dot_zsh.d/functions/git.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
11 changes: 11 additions & 0 deletions home/dot_zsh.d/functions/notify.zsh
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions home/dot_zsh.d/tools/docker.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[ -f "$HOME/.docker/init-zsh.sh" ]] && source "$HOME/.docker/init-zsh.sh"
File renamed without changes.
2 changes: 2 additions & 0 deletions home/dot_zsh.d/tools/proto.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eval "$(proto activate zsh --no-shim)"
export PROTO_AUTO_INSTALL=true
1 change: 1 addition & 0 deletions home/dot_zsh.d/tools/vite-plus.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[ -f "$HOME/.vite-plus/env" ]] && source "$HOME/.vite-plus/env"
23 changes: 16 additions & 7 deletions home/dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +12 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve maintainability and consistency with how functions are loaded (lines 24-26), consider using a loop to source all files in the tools/ directory. This allows for adding or removing tool configurations without needing to manually update .zshrc each time.

for f in "${ZSH_CONFIG_DIR}/tools/"*.zsh(N); do
	source "$f"
done

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tools/ はロード順に意味があります(core/env.zsh で設定した変数を proto.zsh が参照するなど)。グロブによるアルファベット順読み込みでは順序が保証できないため、今回は明示的 source を維持します。


Generated by Claude Code


# 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
Comment on lines +24 to +26
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions autoload loop can behave unexpectedly when the glob matches nothing: in many shells (including zsh), for f in; do ... falls back to iterating over positional parameters. If functions/*.zsh(N) expands to empty (e.g., directory missing/empty), this could end up attempting to source arbitrary shell args. Consider guarding with an explicit existence check (e.g., build an array of matches and only loop when non-empty) or add a [[ -r $f ]] || continue inside the loop.

Suggested change
for f in "${ZSH_CONFIG_DIR}/functions/"*.zsh(N); do
source "$f"
done
function_files=("${ZSH_CONFIG_DIR}/functions/"*.zsh(N))
if (( ${#function_files[@]} )); then
for f in "${function_files[@]}"; do
source "$f"
done
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zsh の (N) glob 修飾子(Null glob)は、マッチするファイルが0件のとき展開結果を空にしてループをスキップします。for f in *.zsh(N) でマッチなしの場合にループ本体は実行されないため、配列化によるガードは不要と判断し現状を維持します。


Generated by Claude Code