diff --git a/home/dot_config/sheldon/plugins.toml b/home/dot_config/sheldon/plugins.toml index 39d6915..43a06e0 100644 --- a/home/dot_config/sheldon/plugins.toml +++ b/home/dot_config/sheldon/plugins.toml @@ -18,6 +18,7 @@ defer = "{{ hooks?.pre | nl }}{% for file in files %}zsh-defer source \"{{ file # [plugins.zsh-abbr] github = "olets/zsh-abbr" +apply = ["defer"] [plugins.zsh-abbr.hooks] pre = ''' @@ -43,6 +44,7 @@ github = "zdharma-continuum/fast-syntax-highlighting" # [plugins.fast-abbr-highlighting] github = "5A6F65/fast-abbr-highlighting" +apply = ["defer"] # [plugins.zsh-completions] diff --git a/home/dot_config/zellij/config.kdl b/home/dot_config/zellij/config.kdl index 6eb603b..8bee960 100644 --- a/home/dot_config/zellij/config.kdl +++ b/home/dot_config/zellij/config.kdl @@ -1,9 +1 @@ theme "solarized-dark" - -keybinds { - normal { - bind "Alt b" { - Run "bash" "-c" "$HOME/scripts/zellij-new-branch-tab.sh"; - } - } -} diff --git a/home/dot_zsh.d/dev-tools.zsh b/home/dot_zsh.d/dev-tools.zsh index 1972208..24db726 100644 --- a/home/dot_zsh.d/dev-tools.zsh +++ b/home/dot_zsh.d/dev-tools.zsh @@ -5,7 +5,7 @@ export PROTO_AUTO_INSTALL=true export PATH="$PROTO_HOME/tools/node/globals/bin:$PATH" # Docker Desktop -source "$HOME/.docker/init-zsh.sh" || true +[ -r "$HOME/.docker/init-zsh.sh" ] && source "$HOME/.docker/init-zsh.sh" # ni - package manager export NI_DEFAULT_AGENT="pnpm" @@ -16,4 +16,4 @@ export VISUAL="cursor" export EDITOR="hx" # Lazygit -export LG_CONFIG_FILE="$HOME/.config/lazygit/config.yml" \ No newline at end of file +export LG_CONFIG_FILE="$HOME/.config/lazygit/config.yml" diff --git a/home/dot_zsh.d/fzf.zsh b/home/dot_zsh.d/fzf.zsh index b3cb2a6..8de6757 100644 --- a/home/dot_zsh.d/fzf.zsh +++ b/home/dot_zsh.d/fzf.zsh @@ -47,7 +47,10 @@ function fzf-cd-widget() { ) if [[ -n "$selected" ]]; then - cd "$selected" + cd "$selected" || { + zle reset-prompt + return + } fi zle reset-prompt } diff --git a/home/dot_zsh.d/utils.zsh b/home/dot_zsh.d/utils.zsh index fea6502..71c5da4 100644 --- a/home/dot_zsh.d/utils.zsh +++ b/home/dot_zsh.d/utils.zsh @@ -1,20 +1,3 @@ -# Git worktree runner -- -gwn() { - local branch_name="$1" - if [ -z "$branch_name" ]; then - echo "Usage: gwn " - return 1 - fi - local default_branch - default_branch=$(git remote show origin 2>/dev/null | awk '/HEAD branch/ {print $NF}') - if [ -z "$default_branch" ] && command -v gh >/dev/null 2>&1; then - if default_branch=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name 2>/dev/null); then - : - fi - fi - git gtr new "$branch_name" --from "origin/$default_branch" && cd "$(git gtr go "$branch_name")" -} - # 長時間コマンドの完了通知 notify-after() { "$@" diff --git a/home/dot_zshrc b/home/dot_zshrc index b78faa4..5e04962 100644 --- a/home/dot_zshrc +++ b/home/dot_zshrc @@ -5,16 +5,15 @@ ZSH_CONFIG_DIR="${HOME}/.zsh.d" # 各設定ファイルを読み込み source "${ZSH_CONFIG_DIR}/path.zsh" -# 補完システムの初期化(compdef を使うsourceより前に実行) -fpath+=(${ZSH_CONFIG_DIR}/completions) -autoload -Uz compinit && compinit +# 補完関数の探索先。実際の compinit は sheldon 側で 1 回だけ実行する。 +fpath+=("${ZSH_CONFIG_DIR}/completions") +# `git gtr` を git サブコマンド補完に出すための zstyle だけ先に登録する。 +zstyle ':completion:*:*:git:*' user-commands gtr:'Git worktree management' 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" -source "${ZSH_CONFIG_DIR}/completions/_git-gtr" - # Sheldon eval "$(sheldon source)" diff --git a/home/scripts/executable_zellij-new-branch-tab.sh b/home/scripts/executable_zellij-new-branch-tab.sh deleted file mode 100644 index 83718f6..0000000 --- a/home/scripts/executable_zellij-new-branch-tab.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -branch_name=$(git branch --show-current 2>/dev/null || echo "worktree") -current_dir=$(pwd) - -zellij action new-tab --name "$branch_name" -zellij action write-chars "cd \"$current_dir\" && cc" -zellij action write 10 -zellij action new-pane --direction right --cwd "$current_dir" -zellij action write-chars "cd \"$current_dir\"" -zellij action write 10 -zellij action focus-previous-pane -zellij action rename-pane "claude" -zellij action focus-next-pane -zellij action rename-pane "claude"