Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Last active March 14, 2025 15:04
Show Gist options
  • Save GeneralD/8560fb923b791ab9a98e19b46b41b37a to your computer and use it in GitHub Desktop.
Save GeneralD/8560fb923b791ab9a98e19b46b41b37a to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# functions
function skim-brew-install() {
local inst=$(brew formulae | sk --query="$1" -m --preview 'brew info {}' --bind 'ctrl-space:execute-silent(brew home {})')
if [[ $inst ]]; then
for prog in $(echo $inst); do; brew install $prog; done;
fi
}
function skim-brew-uninstall() {
local uninst=$(brew leaves | sk --query="$1" -m --preview 'brew info {}' --bind 'ctrl-space:execute-silent(brew home {})')
if [[ $uninst ]]; then
for prog in $(echo $uninst);
do; brew uninstall $prog; done;
fi
}
function skim-cask-install() {
local inst=$(brew casks | sk --query="$1" -m --preview 'brew info --cask {}' --bind 'ctrl-space:execute-silent(brew home --cask {})')
if [[ $inst ]]; then
for prog in $(echo $inst); do; brew install --cask $prog; done;
fi
}
function skim-cask-uninstall() {
local inst=$(brew list --cask | sk --query="$1" -m --preview 'brew info --cask {}' --bind 'ctrl-space:execute-silent(brew home --cask {})')
if [[ $inst ]]; then
for prog in $(echo $inst); do; brew uninstall --cask $prog; done;
fi
}
zle -N skim-brew-install
zle -N skim-brew-uninstall
zle -N skim-cask-install
zle -N skim-cask-uninstall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment