dotfiles/home/shell_funcs

50 lines
1.1 KiB
Bash

#!/bin/bash
export EDITOR=nvim
export VISUAL=nvim
# Functions
function httpdiff () {
diff --color -r -c <(curl -s "$1" 2>&1) <(curl -s "$2" 2>&1)
}
function cpbr () {
if branch=$(git symbolic-ref --short -q HEAD)
then
printf "$branch" | pbcopy
osascript -e "display notification \"$branch copied to clipboard\" with title \"cpbr\""
else
echo "no branch, can't copy"
fi
}
function hidden() { ls -a "$@" | grep '^\.'; }
function h () {
if [ -z "$*" ]
then
history
else
history | egrep "$@"
fi
}
function settitle () {
echo -ne "\033]0;"$*"\007"
}
function pullall (){
for d in ./*/ ; do (cd "$d" && pwd && git pull); done
}
function gh_mainall (){
for d in ./*/ ; do (cd "$d" && pwd && git checkout main && git pull); done
}
function allbranches (){
for d in ./*/ ; do (cd "$d" && pwd && git remote -v origin && git pull); done
}
function new_dock_space (){
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
}