diff --git a/Examples.md b/Examples.md index 0f72901..aacae81 100644 --- a/Examples.md +++ b/Examples.md @@ -56,6 +56,7 @@ Table of Contents * [fzf as dmenu replacement](#fzf-as-dmenu-replacement) * [dotfiles management](#dotfiles-management) * [Transmission](#transmission) +* [Pacman](#pacman) ### General @@ -1464,6 +1465,21 @@ function drm() { } ``` +```sh +# Same as above, but allows multi selection: +function drm() { + docker ps -a | sed 1d | fzf -q "$1" --no-sort -m --tac | awk '{ print $1 }' | xargs -r docker rm +} +``` + + +```sh +# Select a docker image or images to remove +function drmi() { + docker images | sed 1d | fzf -q "$1" --no-sort -m --tac | awk '{ print $3 }' | xargs -r docker rmi +} +``` + ### buku Search and open website bookmarks stored in a [buku](https://github.com/jarun/Buku) database. ```sh @@ -1535,6 +1551,13 @@ fman() { } ``` +```sh +# Same as above, but with previews and works correctly with man pages in different sections. +function fman() { + man -k . | fzf -q "$1" --prompt='man> ' --preview $'echo {} | tr -d \'()\' | awk \'{printf "%s ", $2} {print $1}\' | xargs -r man' | tr -d '()' | awk '{printf "%s ", $2} {print $1}' | xargs -r man +} +``` + ### Python Behave BDD Tab copy the step name. @@ -1616,4 +1639,20 @@ pick_torrent() LBUFFER="transmission-remote -t ${$({ } | fzf)%% *} -" zle -N pick_torrent bindkey '^o' pick_torrent -``` \ No newline at end of file +``` + +### Pacman + +```sh +# Install packages using yay (change to pacman/AUR helper of your choice) +function in() { + yay -Slq | fzf -q "$1" -m --preview 'yay -Si {1}'| xargs -ro yay -S +} +``` + +```sh +# Remove installed packages (change to pacman/AUR helper of your choice) +function re() { + yay -Qq | fzf -q "$1" -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns +} +```