Merge pull request 'update-zsh' (#2) from update-zsh into main
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
@@ -13,4 +13,14 @@ alias dk=docker_kill_fzf
|
||||
alias zs='nvim ~/.zshrc'
|
||||
alias sz='source ~/.zshrc'
|
||||
alias ls="eza --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions"
|
||||
alias gk="gitkraken"
|
||||
alias ghb='gh browse'
|
||||
alias ghs='gh status'
|
||||
alias ghl='gh pr list'
|
||||
alias ghw='gh pr view --web'
|
||||
alias prs='select_and_open_pr'
|
||||
alias pr='select_and_open_pr_web_only'
|
||||
alias e='exit'
|
||||
alias ta='tmux-attach'
|
||||
alias tn='tmux-new'
|
||||
alias tk='tmux-kill'
|
||||
alias st='tmux source-file ~/.tmux.conf'
|
||||
|
||||
@@ -31,3 +31,68 @@ fzf-cd-widget() {
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
if [[ -f "/opt/homebrew/bin/brew" ]]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
fi
|
||||
|
||||
export PATH="/Library/Developer/CommandLineTools/usr/bin:$PATH"
|
||||
alias f='selected=$(find . -type f | fzf --preview "bat --style=numbers --color=always {}") && [ -n "$selected" ] && vim "$selected"'
|
||||
|
||||
alias ghostty_config='v $HOME/Library/Application\ Support/com.mitchellh.ghostty/config'
|
||||
alias cat='bat'
|
||||
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
|
||||
#source $(brew --prefix powerlevel10k)/powerlevel10k.zsh-theme
|
||||
export PATH="$PATH:/Users/luisfreixial/.cargo/bin"
|
||||
#source $(brew --prefix powerlevel10k)/powerlevel10k.zsh-theme
|
||||
export GOPATH=$HOME/go
|
||||
export GOROOT="$(brew --prefix golang)/libexec"
|
||||
alias python=/usr/bin/python3
|
||||
|
||||
@@ -86,6 +86,11 @@ zle -N fzf-cd-widget
|
||||
source ~/.zsh_exports
|
||||
fi
|
||||
|
||||
# Secrets
|
||||
if [ -f ~/.zsh_secrets ]; then
|
||||
source ~/.zsh_secrets
|
||||
fi
|
||||
|
||||
# OS-specific configurations
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
if [ -f ~/.zsh_debian ]; then
|
||||
@@ -101,3 +106,5 @@ fi
|
||||
eval "$(zoxide init --cmd cd zsh)"
|
||||
eval "$(rbenv init -)"
|
||||
eval "$(starship init zsh)"
|
||||
eval "$(gh copilot alias -- zsh)"
|
||||
eval "$(/Users/luisfreixial/.local/bin/mise activate zsh)"
|
||||
|
||||
Reference in New Issue
Block a user