Compare commits
6 Commits
7f087bc39e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c2be26cac | ||
|
|
760f8584cf | ||
|
|
7eb837a068 | ||
|
|
225b91b5d6 | ||
|
|
47a3e90c6c | ||
|
|
7cb12c4582 |
@@ -25,6 +25,7 @@ in
|
|||||||
# Password management
|
# Password management
|
||||||
"1password"
|
"1password"
|
||||||
"1password-cli"
|
"1password-cli"
|
||||||
|
"bitwarden"
|
||||||
|
|
||||||
# Terminal & Development
|
# Terminal & Development
|
||||||
"ghostty"
|
"ghostty"
|
||||||
|
|||||||
@@ -125,6 +125,57 @@ in
|
|||||||
autoSetupRemote = true;
|
autoSetupRemote = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Rebase settings
|
||||||
|
rebase = {
|
||||||
|
autoStash = true;
|
||||||
|
updateRefs = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Rerere (Reuse Recorded Resolution) - automatically reuse conflict resolutions
|
||||||
|
rerere = {
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Color settings
|
||||||
|
color = {
|
||||||
|
ui = "auto";
|
||||||
|
branch = "auto";
|
||||||
|
diff = "auto";
|
||||||
|
status = "auto";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Diff settings
|
||||||
|
diff = {
|
||||||
|
compactionHeuristic = true;
|
||||||
|
algorithm = "patience";
|
||||||
|
colorMoved = "default";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Merge settings
|
||||||
|
merge = {
|
||||||
|
conflictStyle = "zdiff3";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Fetch settings
|
||||||
|
fetch = {
|
||||||
|
prune = true;
|
||||||
|
showForcedUpdates = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Advice settings (disable annoying messages)
|
||||||
|
advice = {
|
||||||
|
detachedHead = false;
|
||||||
|
statusHints = true;
|
||||||
|
addIgnoredFile = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Blame settings
|
||||||
|
blame = {
|
||||||
|
colorLines = true;
|
||||||
|
markUnblamables = true;
|
||||||
|
markUnblamableLines = true;
|
||||||
|
};
|
||||||
|
|
||||||
# GPG/SSH signing settings
|
# GPG/SSH signing settings
|
||||||
gpg = {
|
gpg = {
|
||||||
format = "ssh";
|
format = "ssh";
|
||||||
@@ -159,18 +210,112 @@ in
|
|||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias = {
|
alias = {
|
||||||
|
|
||||||
|
# Log and history aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Pretty graph log with GPG info
|
||||||
|
history = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\"";
|
||||||
graph = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\"";
|
graph = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\"";
|
||||||
|
# One-line log
|
||||||
ll = "log --oneline";
|
ll = "log --oneline";
|
||||||
st = "status -sb";
|
# Last commit with stats
|
||||||
cm = "commit -m";
|
|
||||||
append = "commit --amend --no-edit";
|
|
||||||
sobmodules = "submodule update --init --recursive";
|
|
||||||
df = "difftool -t nvimdiff -y";
|
|
||||||
last = "log -1 --stat";
|
last = "log -1 --stat";
|
||||||
br = "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
|
|
||||||
brr = "branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
|
# Status and branch aliases
|
||||||
undo = "reset HEAD~1 --mixed";
|
# =====
|
||||||
|
|
||||||
|
# Short branch status
|
||||||
|
st = "status -sb";
|
||||||
|
# Formatted local branches
|
||||||
|
local-branches = "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
|
||||||
|
# Formatted remote branches
|
||||||
|
remote-branches = "branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
|
||||||
|
# Create and switch to new branch
|
||||||
|
new-branch = "!f() { git checkout -b \"$1\"; }; f";
|
||||||
|
# Switch branch (interactive with fzf)
|
||||||
|
switch-branch = "!f() { branch=$(git branch --format='%(refname:short)' | fzf --height 40%); [ -n \"$branch\" ] && git checkout \"$branch\"; }; f";
|
||||||
|
# Delete branch (with confirmation)
|
||||||
|
delete-branch = "!f() { git branch -d \"$1\" 2>/dev/null || git branch -D \"$1\"; }; f";
|
||||||
|
|
||||||
|
# Commit aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Commit with message
|
||||||
|
cm = "commit -m";
|
||||||
|
# Amend last commit without editing message
|
||||||
|
amend = "commit --amend --no-edit";
|
||||||
|
append = "commit --amend --no-edit";
|
||||||
|
# Stage all and amend to last commit
|
||||||
|
fix = "!git add . && git commit --amend --no-edit";
|
||||||
|
# Stage all, amend, and safely force push with lease and force-if-includes
|
||||||
|
fck = "!f() { git add . && git commit --amend --no-edit && git push --force-with-lease --force-if-includes; }; f";
|
||||||
|
# Stage all, commit with message, and push
|
||||||
|
save = "!f() { git add --all && git commit -m \"$*\" && git push; }; f";
|
||||||
|
|
||||||
|
# Fixup workflow aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Interactive fixup: pick commit with fzf, stage all, create fixup
|
||||||
|
fix-commit = "!f() { commit=$(git log --oneline --color=always | fzf --ansi --height 40% | awk '{print $1}'); [ -n \"$commit\" ] && git add . && git commit --fixup=\"$commit\"; }; f";
|
||||||
|
apply-fixes = "!f() { upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null); if [ -n \"$upstream\" ]; then git rebase -i --autosquash \"$upstream\"; elif git show-ref --verify --quiet refs/remotes/origin/main; then git rebase -i --autosquash origin/main; elif git show-ref --verify --quiet refs/remotes/origin/master; then git rebase -i --autosquash origin/master; elif git show-ref --verify --quiet refs/heads/main; then git rebase -i --autosquash main; elif git show-ref --verify --quiet refs/heads/master; then git rebase -i --autosquash master; else first_commit=$(git rev-list --reverse HEAD | head -1); if [ -n \"$first_commit\" ]; then base=$(git rev-parse \"$first_commit^\" 2>/dev/null); if [ -n \"$base\" ] && [ \"$base\" != \"$first_commit\" ]; then git rebase -i --autosquash \"$base\"; else echo \"Could not determine base. Usage: git apply-fixes <base-branch>\"; fi; else echo \"No base branch found. Usage: git apply-fixes <base-branch>\"; fi; fi; }; f";
|
||||||
|
# Squash all commits unique to current branch (auto-detects default branch)
|
||||||
|
cleanup = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
||||||
|
squash-all = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
|
||||||
|
|
||||||
|
# Staging aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Stage all files
|
||||||
|
stage-all = "add --all";
|
||||||
|
# Unstage all staged files
|
||||||
unstage = "reset HEAD --";
|
unstage = "reset HEAD --";
|
||||||
|
# Interactive staging with fzf
|
||||||
|
stage = "!f() { git status -s | fzf --multi --ansi --height 40% | awk '{print $2}' | xargs git add; }; f";
|
||||||
|
|
||||||
|
# Undo and reset aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Interactive undo: pick state from reflog, show diff, confirm before hard reset
|
||||||
|
undo = "!f() { target=$(git reflog --color=always --date=relative --format=\"%C(yellow)%h%C(reset) %C(cyan)%gd%C(reset) %C(green)%gs%C(reset)\" | fzf --ansi --height 40% --header=\"Select a state to reset to\" | awk '{print $1}'); if [ -n \"$target\" ]; then echo \"\n=== Diff between HEAD and selected state ===\n\"; git diff --color=always HEAD \"$target\"; echo \"\n=== This will discard all changes above ===\n\"; read -p \"Reset to $target? (y/N): \" confirm; if [ \"$confirm\" = \"y\" ] || [ \"$confirm\" = \"Y\" ]; then git reset --hard \"$target\"; else echo \"Reset cancelled.\"; fi; fi; }; f";
|
||||||
|
|
||||||
|
# Remote operations aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Fetch from all remotes
|
||||||
|
fetch-all = "fetch --all";
|
||||||
|
# Pull latest changes
|
||||||
|
pull-latest = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git pull origin \"$default\"; }; f";
|
||||||
|
# Push and set upstream
|
||||||
|
push-new = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD); }; f";
|
||||||
|
# Update from main/master (rebase)
|
||||||
|
update-from-main = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git rebase \"origin/$default\"; }; f";
|
||||||
|
|
||||||
|
# Stash aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Save current changes to stash
|
||||||
|
stash-save = "stash push -m";
|
||||||
|
# Apply and remove stash (interactive with fzf)
|
||||||
|
stash-pop = "!f() { stash=$(git stash list --color=always | fzf --ansi --height 40% | awk -F: '{print $1}'); [ -n \"$stash\" ] && git stash pop \"$stash\"; }; f";
|
||||||
|
# List stashes
|
||||||
|
stash-list = "stash list";
|
||||||
|
|
||||||
|
# Workflow aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Create new feature branch from main/master
|
||||||
|
new-feature = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git checkout -b \"$1\" \"origin/$default\"; }; f";
|
||||||
|
# Compare current branch with another branch
|
||||||
|
compare = "!f() { git diff \"$1\"..HEAD; }; f";
|
||||||
|
|
||||||
|
# Other aliases
|
||||||
|
# =====
|
||||||
|
|
||||||
|
# Initialize and update submodules
|
||||||
|
sobmodules = "submodule update --init --recursive";
|
||||||
|
# Diff tool using nvimdiff
|
||||||
|
df = "difftool -t nvimdiff -y";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,6 +115,7 @@
|
|||||||
age # Modern encryption tool
|
age # Modern encryption tool
|
||||||
sops # Secrets management
|
sops # Secrets management
|
||||||
rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative.
|
rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative.
|
||||||
|
bitwarden-cli
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Miscellaneous Tools
|
# Miscellaneous Tools
|
||||||
@@ -130,6 +131,7 @@
|
|||||||
mob
|
mob
|
||||||
zsh-fast-syntax-highlighting
|
zsh-fast-syntax-highlighting
|
||||||
jellyfin-tui
|
jellyfin-tui
|
||||||
|
mpv
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Nix Tools
|
# Nix Tools
|
||||||
@@ -191,4 +193,30 @@
|
|||||||
programs.lazygit = {
|
programs.lazygit = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.k9s = {
|
||||||
|
enable = true;
|
||||||
|
plugins = {
|
||||||
|
"edit-secret" = {
|
||||||
|
shortCut = "Ctrl-X";
|
||||||
|
confirm = false;
|
||||||
|
description = "Edit Decoded Secret";
|
||||||
|
scopes = [ "secrets" ];
|
||||||
|
command = "sh";
|
||||||
|
background = false;
|
||||||
|
args = [
|
||||||
|
"-c"
|
||||||
|
''
|
||||||
|
tempfile=$(mktemp);
|
||||||
|
secret=$(kubectl get secrets --context $CONTEXT --namespace $NAMESPACE $NAME -o json);
|
||||||
|
printf '%s\n' $secret | jq '.data | map_values(@base64d)' > $tempfile;
|
||||||
|
vim $tempfile;
|
||||||
|
secret_data=$(cat $tempfile | jq -c '. | map_values(@base64)');
|
||||||
|
rm $tempfile;
|
||||||
|
printf '%s\n' $secret | jq -r --argjson secret_data "$secret_data" '.data = $secret_data' | kubectl apply -f -;
|
||||||
|
''
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user