Skip to content

Instantly share code, notes, and snippets.

@benrowe
Last active February 19, 2026 22:36
Show Gist options
  • Select an option

  • Save benrowe/3ab0634d25ed95ba0abd36775e6a2c9e to your computer and use it in GitHub Desktop.

Select an option

Save benrowe/3ab0634d25ed95ba0abd36775e6a2c9e to your computer and use it in GitHub Desktop.
Dot Configuration for local machine
export EDITOR=nvim
alias dk="docker"
alias tf="terraform"
alias vi="nvim"
alias ga="gemini"
alias ca="claude"
alias cat="bat"
alias md="glow"
[user]
name = <your-name>
email = <your-email>
[commit]
template = /home/ben/.stCommitMsg
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
[push]
default = current
[pull]
ff = only
[init]
defaultBranch = master
[rebase]
autoStash = true
[alias]
## [Staging & Committing]
## Stage all changes
a = add
## Stage changes interactively
ap = add -p
## Commit with an inline message
cm = commit -m
## Amend the previous commit
ca = commit --amend
## Quick snapshot of all changes as a WIP commit
wip = !git add -A && git commit -m 'WIP'
## Undo the last commit but keep all changes staged
undo-commit = reset --soft HEAD~1
## [Branches]
## List local branches, sorted by most recent
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
## List all local and remote branches by date
ba = "!git for-each-ref --format='%(authordate:format:%Y-%m-%d)%09%(authorname)%09%(objectname:short)%09%(refname)' refs | grep -i 'heads\\|remotes' | sed -e 's-refs/heads/--' | sed -e 's-refs/remotes/--'"
## List only my local and remote branches by date
bam = "!git for-each-ref --format='%(authordate:format:%Y-%m-%d)%09%(authorname)%09%(objectname:short)%09%(refname)' refs | grep -i 'heads\\|remotes' | grep '$(git config user.name)' | sed -e 's-refs/heads/--' | sed -e 's-refs/remotes/--'"
## Checkout a branch or commit
co = checkout
## Create and checkout a new branch
cob = checkout -b
## Checkout file changes interactively
cop = checkout -p
## Force delete a local branch
del = branch -D
## Push current branch to origin and set as upstream
track = "!git push -u origin $(git symbolic-ref --short HEAD)"
## [Diffs]
## Show changes in the working directory
d = diff
## Show diff statistics
ds = diff --stat
## Show staged changes (diff against HEAD)
dc = diff --cached
## Diff current branch against the develop branch
dd = diff develop..HEAD --name-status
## [Log & History]
## Show commit history as a graph
ls = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
## Show linear commit history with file stats
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
## Show commit history for a specific file
filelog = log -u
## Alias for filelog
fl = log -u
## Search commit content for a string
search = "!f() { git log -p -S \"$1\" -- \"${2:-.}\"; }; f"
## Show commit statistics by author
stat = shortlog -s -n --all --no-merges
## Show commits ahead/behind remote master
ahead = "!git rev-list --left-right --count origin/master...HEAD | awk '{print \"behind: \"$1, \"ahead: \"$2}'"
## [Remote & Sync]
## Fetch changes from remote
f = fetch
## Push changes to remote
p = push
## Force push safely, without overwriting others' work
pf = push --force-with-lease
## [Stash]
## List all stashed changes
stl = stash list
## Pop stash, preserving staged/unstaged distinction
stp = stash pop --index
## [Rebase]
## Interactive rebase (e.g. git ri HEAD~3)
ri = rebase -i
## Rebase current branch onto origin/develop
rbod = rebase origin/develop
## Rebase current branch onto origin/master
rbom = rebase origin/master
## [Workflow]
## Commit staged changes to a new branch based off a remote branch, then return
## Usage: git cms '<commit message>' <new-branch-name> <base-branch>
## Example: git cms 'fix login validation bug' bugfix/login-fix origin/staging
cms = "!f() { \
msg=\"$1\"; \
new_branch=\"$2\"; \
base_branch=\"$3\"; \
original_branch=$(git symbolic-ref --short HEAD); \
git stash push --staged -m 'cms-temp-stash' && \
git checkout \"$base_branch\" && \
git checkout -b \"$new_branch\" && \
git stash pop --index && \
git commit -m \"$msg\" && \
git push -u origin \"$new_branch\" && \
git checkout \"$original_branch\" && \
git stash pop --quiet 2>/dev/null; \
echo \"Committed and pushed to $new_branch, returned to $original_branch\"; \
}; f"
## Finish work on current branch: checkout target, pull, delete old branch, tidy
## Usage: git done <target-branch>
done = "!f() { \
prev=$(git symbolic-ref --short HEAD); \
if [ \"$prev\" = \"$1\" ]; then echo \"Already on $1, nothing to do.\"; return 1; fi; \
git checkout \"$1\" && \
git pull && \
git branch -D \"$prev\" && \
git tidy; \
}; f"
## Prune remote and interactively clean up merged branches
tidy = "!git remote prune origin && git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches"
## Clean untracked files interactively
cln = clean -i
## [Misc]
## Lazygit!!
lazy = "!lazygit"
## List all configured git aliases
la = "!~/.config/scripts/git-la.sh"
## Show short repository status
s = status -s -uall
## Apply a specific commit from another branch
cp = cherry-pick
[core]
editor = vi
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
source ~/.aliases
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

Instructions

Tools

  • bat
  • nvim
  • glow
  • lazygit
  • lazydocker
  • ghostty
  • zsh/oh-my-zsh + powerlevel10k
  • gemini
  • claude
  • gh (github cli)
  • tmux
  • fzf
  • jq
  • eza
  • zoxide
#!/usr/bin/env bash
# Lists all git aliases from ~/.gitconfig grouped by ## [Category] comments
gitconfig="$HOME/.gitconfig"
if [ ! -f "$gitconfig" ]; then
echo "No ~/.gitconfig found"
exit 1
fi
{
echo ""
printf "\033[1;37mGit Aliases\033[0m\n"
printf "Usage: git \033[1;32m<alias>\033[0m [args]\n"
printf "Defined in \033[2m%s\033[0m\n" "$gitconfig"
printf "Add \033[2m## [Category]\033[0m comments to group aliases\n"
echo ""
awk '
in_alias == 0 && /^\[alias\]/ { in_alias = 1; next }
in_alias == 1 && /^\[/ { in_alias = 0; desc = ""; next }
in_alias == 0 { next }
# Detect category header: ## [Category Name]
/^[[:space:]]*## \[.+\]/ {
line = $0
sub(/^[[:space:]]*## \[/, "", line)
sub(/\].*$/, "", line)
category = line
desc = ""
next
}
# Capture the first ## comment in a consecutive block
/^[[:space:]]*##/ {
if (desc == "") {
line = $0
sub(/^[[:space:]]*##[[:space:]]*/, "", line)
desc = line
}
next
}
# Skip blank lines (preserve desc across them)
/^[[:space:]]*$/ { next }
# Skip continuation lines (backslash multi-line aliases)
continuation { if (/\\$/) { next } else { continuation = 0; next } }
# Alias definition line
/^[[:space:]]*[a-zA-Z]/ {
split($0, parts, "=")
name = parts[1]
gsub(/^[[:space:]]+|[[:space:]]+$/, "", name)
cat = (category != "") ? category : "Misc"
# Store: category|name|desc
entries[++count] = cat "|" name "|" desc
# Track category order
if (!(cat in cat_seen)) {
cat_seen[cat] = 1
cat_order[++cat_count] = cat
}
desc = ""
if (/\\$/) { continuation = 1 }
}
END {
# Collect entries per category
for (i = 1; i <= count; i++) {
split(entries[i], e, "|")
cat = e[1]
cat_entries[cat] = cat_entries[cat] entries[i] "\n"
}
# Print each category in definition order
for (c = 1; c <= cat_count; c++) {
cat = cat_order[c]
if (c > 1) printf "\n"
printf "\033[1;35;4m%s\033[0m\n", cat
# Sort entries within category
n = split(cat_entries[cat], lines, "\n")
# Simple insertion sort by alias name
for (i = 1; i <= n; i++) {
sorted[i] = lines[i]
}
for (i = 2; i <= n; i++) {
key = sorted[i]
if (key == "") continue
split(key, kparts, "|")
j = i - 1
while (j >= 1) {
if (sorted[j] == "") { j--; continue }
split(sorted[j], jparts, "|")
if (jparts[2] > kparts[2]) {
sorted[j + 1] = sorted[j]
j--
} else break
}
sorted[j + 1] = key
}
for (i = 1; i <= n; i++) {
if (sorted[i] == "") continue
split(sorted[i], e, "|")
if (e[3] != "") {
printf " \033[1;32m%-16s\033[0m %s\n", e[2], e[3]
} else {
printf " \033[1;32m%-16s\033[0m\n", e[2]
}
}
delete sorted
}
}
' "$gitconfig"
} | less -R
# Set prefix to C-a
unbind C-b
set-option -g prefix C-Space
bind-key C-a send-prefix
# Enable mouse mode
set -g mouse on
# Set new panes to open in current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Use vim keybindings in copy mode
set-window-option -g mode-keys vi
# Left side of status bar
set -g status-left '#[fg=green,bold][ #S ]#[default]'
# Right side of status bar
set -g status-right '#[fg=cyan,bold][%Y-%m-%d %H:%M]#[default]'
set -g @plugin 'dreamsofcode-io/catppuccin-tmux'
# from omerxx .dotfiles repo
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
set -g @catppuccin_status_modules_right "directory date_time"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{b:pane_current_path}"
set -g @catppuccin_date_time_text "%H:%M"
set -g @catppuccin_window_status_style "rounded" # can comment this out
##### Display Popups #####
bind C-y display-popup \
-d "#{pane_current_path}" \
-w 80% \
-h 80% \
-E "lazygit"
bind C-n display-popup -E 'bash -i -c "read -p \"Session name: \" name; tmux new-session -d -s \$name && tmux switch-client -t \$name"'
bind C-j display-popup -E "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
### DISPLAY MENU ###
bind d display-menu -T "#[align=centre]Dotfiles" -x C -y C \
".zshrc" z "display-popup -w 80% -h 80% -E 'nvim ~/.zshrc'" \
".gitconfig" g "display-popup -w 80% -h 80% -E 'nvim ~/.gitconfig'" \
".tmux.conf" t "display-popup -w 80% -h 80% -E 'nvim ~/.config/tmux/tmux.conf'" \
"Exit" q ""
### STATUS BAR ###
# set -g status-style "bg=#1e1e2e,fg=#cdd6f4"
# set -g status-left "#[bg=#f38ba8,fg=#1e1e2e]  #{session_name} #[bg=#fab387,fg=#f38ba8]#[bg=#fab387,fg=#1e1e2e]#{?client_prefix, PREFIX ,}#[bg=#313244,fg=#fab387]"
# set -g status-left-length 500
# set -g window-status-format "#[bg=#313244] #{window_index}-#{window_name} #{?#{==:#{window_index},#{last_window_index}},#[bg=#1e1e2e fg=#313244],}"
# set -g window-status-current-format "#[bg=#cdd6f4,fg=#313244]#[fg=#1e1e2e] #{window_index}-#{window_name} #[bg=#313244,fg=#cdd6f4]#{?#{==:#{window_index},#{last_window_index}},#[bg=#1e1e2e],}"
# set -g window-status-separator ""
# set -g status-right "#(pwd) #[fg=#313244]#[bg=#313244,fg=#cdd6f4] #(whoami)  #[bg=#fab387,fg=#1e1e2e] #(date +%a-%b-%d) #[fg=#f38ba8]#[bg=#f38ba8,fg=#1e1e2e] #(date +%H:%M) "
# set -g status-right-length 500
# set -g status-interval 1
# more settings can be added here
set-option -g status-position top
set-option -g base-index 1
set-window-option -g pane-base-index 1
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"
# Plugin manager: Always last!
run '~/.tmux/plugins/tpm/tpm'
@sidouglas
Copy link
Copy Markdown

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment