Cleanup dotfiles

This commit is contained in:
Corey Smith
2025-07-23 00:26:25 -07:00
parent 75c981e76d
commit e25d845bbf
33 changed files with 3394 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
# Use the provided path or default to the current directory.
current_path="${1:-.}"
cd "$current_path" 2>/dev/null || exit 1
# Check if we are inside a Git repository.
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
# Get the URL of the 'origin' remote.
remote_url="$(git config --get remote.origin.url)"
if [ -n "$remote_url" ]; then
# We have a remote, so let's get the icon and domain.
# 1. Determine the icon based on the URL's content.
icon=""
if [[ $remote_url == *"github"* ]]; then
icon=" "
elif [[ $remote_url == *"gitlab"* ]]; then
icon="󰮠 "
elif [[ $remote_url == *"gitea"* ]]; then
icon=" "
else
# Fallback icon for any other git remote (e.g., Bitbucket, Codeberg).
icon=" "
fi
# 2. Extract the domain from the remote URL.
domain=""
if [[ $remote_url =~ ^https?:// ]]; then
# For HTTPS URLs (e.g., "https://github.com/user/repo.git")
domain=$(echo "$remote_url" | sed -E 's#https?://([^/]+).*#\1#')
elif [[ $remote_url =~ @ ]]; then
# For SSH URLs (e.g., "git@github.com:user/repo.git")
domain=$(echo "$remote_url" | sed -E 's/.*@([^:]+):.*/\1/')
fi
# 3. Print the icon and the extracted domain.
echo "$icon $domain"
else
# No remote is configured, so it's a local repository.
echo " local"
fi
else
# Not a git repository, so output nothing.
echo ""
fi

View File

@ -0,0 +1,26 @@
#!/bin/bash
# Icons
icon_local="󰹑 " # Your specified local icon
icon_remote="󰖟 " # Your specified remote icon
current_cmd=$(tmux display-message -p '#{pane_current_command}')
if [[ "$current_cmd" == "ssh" ]]; then
# Remote - get info from pane title
pane_title_raw=$(tmux display-message -p '#{pane_title}')
# Clean up: remove any spaces after the colon
pane_title_cleaned=$(echo "$pane_title_raw" | sed 's/: /:/g')
# Output plain text: ICON user@host:directory (or ICON title if not parsable)
echo "${icon_remote}${pane_title_cleaned:-remote}"
else
# Local - build the same format
user_part="$(whoami)"
host_part="$(hostname -s)"
local_dir_raw=$(echo "$1" | sed "s|^$HOME|~|") # $1 is #{pane_current_path}
# Output plain text: ICON user@host:directory
echo "${icon_local}${user_part}@${host_part}:${local_dir_raw}"
fi