Shell: Add 'pel' function for fzf-ing pacman packaged files

master
Pierre Neidhardt 2016-10-04 10:02:32 +05:30
parent 559033de94
commit 87a9301899
2 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@ if [ "zsh" = "$SHELL_CURRENT" ]; then
compdef _gs pdfresize
compdef _pcc pacfiles
compdef _pcc pacsize
compdef _pcc pel
compdef _pcc pql
compdef _tex ltx
compdef _path_commands typex

View File

@ -215,6 +215,20 @@ xmultioff () {
## Pacman functions
if command -v pacman >/dev/null 2>&1; then
if command -v fzf >/dev/null 2>&1; then
pel() {
local result count
count=$#
while IFS= read -r i; do
set "$@" "$i"
done <<EOF
$(pacman -Qlq "$@" | grep -v "/$" | fzf)
EOF
shift $count
[ -n "$1" ] && $EDITOR "$@"
}
fi
## Get detailed file list for the specified packages, omitting folders.
pql () {
pacman -Ql "$@" | grep -v "/$"