Add cool git aliases

This commit is contained in:
2025-01-03 00:09:34 +01:00
parent 3856474569
commit 815307d2bc
2 changed files with 44 additions and 28 deletions
+12
View File
@@ -27,6 +27,18 @@
# # TODO: figure out a way to specify all repositories in ~/projects & ~/work at run time # # TODO: figure out a way to specify all repositories in ~/projects & ~/work at run time
# repositories = []; # repositories = [];
# }; # };
aliases = {
master =
#bash
''
!git symbolic-ref --short refs/remotes/$(git remote | head -n 1)/HEAD | sed 's@.*/@@'
'';
cleanup =
#bash
''
!git branch --merged | grep -vE "^([+*]|\s*($(git master))\s*$)" | xargs git branch --delete 2>/dev/null
'';
};
extraConfig = { extraConfig = {
gpg.format = "ssh"; gpg.format = "ssh";
gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers"; gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers";
+32 -28
View File
@@ -249,35 +249,39 @@
file = "share/oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh"; file = "share/oh-my-zsh/plugins/copyfile/copyfile.plugin.zsh";
} }
]; ];
initExtraFirst = '' initExtraFirst =
# Create a new tmux session (with a random name) and attach. #bash
if [[ -z "$TMUX" ]]; then ''
exec tmux -u new-session -s "#$(hexdump -n 4 -v -e '/1 "%02X"' /dev/urandom)" # Create a new tmux session (with a random name) and attach.
elif [[ $SHLVL -eq 1 ]]; then if [[ -z "$TMUX" ]]; then
session=$(tmux display-message -p "#S") exec tmux -u new-session -s "#$(hexdump -n 4 -v -e '/1 "%02X"' /dev/urandom)"
# kill current sesion if we are quiting the only pane elif [[ $SHLVL -eq 1 ]]; then
function __onExit { session=$(tmux display-message -p "#S")
if [[ $(tmux list-panes -s -t $session | wc -l) == 1 ]]; then # kill current sesion if we are quiting the only pane
tmux kill-session -t $session function __onExit {
fi if [[ $(tmux list-panes -s -t $session | wc -l) == 1 ]]; then
} tmux kill-session -t $session
trap __onExit EXIT fi
fi }
''; trap __onExit EXIT
fi
'';
initExtraBeforeCompInit = builtins.readFile ./comp.zsh; initExtraBeforeCompInit = builtins.readFile ./comp.zsh;
completionInit = '' completionInit =
# The globbing is a little complicated here: #bash
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct. ''
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error) # The globbing is a little complicated here:
# - '.' matches "regular files" # - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.autoload -Uz compinit # - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
autoload -Uz compinit # - '.' matches "regular files"
if [[ -n $ZSH_CACHE_DIR/.zcompdump(#qN.mh+24) ]]; then # - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.autoload -Uz compinit
compinit; autoload -Uz compinit
else if [[ -n $ZSH_CACHE_DIR/.zcompdump(#qN.mh+24) ]]; then
compinit -C; compinit;
fi; else
''; compinit -C;
fi;
'';
initExtra = builtins.readFile ./init.zsh; initExtra = builtins.readFile ./init.zsh;
envExtra = '' envExtra = ''