update-zsh

This commit is contained in:
Luis Freixial
2025-07-10 21:53:23 +01:00
parent c5472fc27b
commit 8b49c1b8a5
4 changed files with 90 additions and 6 deletions

View File

@@ -30,4 +30,69 @@ fzf-cd-widget() {
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) && cd "$dir"
zle reset-prompt
}
}
select_and_open_pr() {
local pr_info=$(gh pr list --state open --json number,title | jq -r '.[] | "\(.number) \(.title)"' | fzf -1)
if [[ -n "$pr_info" ]]; then
local pr_number=$(echo "$pr_info" | awk '{print $1}')
gh pr checkout "$pr_number"
else
echo "No PR selected."
fi
}
select_and_open_pr_web_only() {
local pr_info=$(gh pr list --state open --json number,title | jq -r '.[] | "\(.number) \(.title)"' | fzf -1)
if [[ -n "$pr_info" ]]; then
local pr_number=$(echo "$pr_info" | awk '{print $1}')
gh pr view --web
else
echo "No PR selected."
fi
}
tmux-attach() {
local session
session=$(tmux ls -F "#{session_name}" 2>/dev/null | fzf)
[[ -n "$session" ]] && tmux attach -t "$session"
}
tmux-new() {
read "session?Enter new tmux session name: "
if [[ -z "$session" ]]; then
echo "No session name entered."
return 1
fi
if tmux has-session -t "$session" 2>/dev/null; then
echo "Session '$session' already exists."
return 1
fi
tmux new -s "$session"
}
tmux-kill() {
local session
session=$(tmux ls -F "#{session_name}" 2>/dev/null | fzf --prompt="Kill session: ")
[[ -n "$session" ]] && tmux kill-session -t "$session"
}
tmux_start_music() {
local session="music"
if ! tmux has-session -t "$session" 2>/dev/null; then
tmux new-session -d -s "$session"
tmux send-keys -t "$session":1 'clear' C-m
tmux split-window -v -t "$session":1 -p 8
tmux send-keys -t "$session":1.2 'spotify_player' C-m
tmux select-pane -t "$session":1.1
fi
tmux attach -t "$session"
}