From b93a58f4c211b474f2961083ca1a332a4407f954 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sun, 27 Nov 2016 16:49:25 +0530 Subject: [PATCH] fzf: Add support for any file in 'describe' --- .config/fish/functions/describe.fish | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.config/fish/functions/describe.fish b/.config/fish/functions/describe.fish index f76c182f..29e1f471 100644 --- a/.config/fish/functions/describe.fish +++ b/.config/fish/functions/describe.fish @@ -1,13 +1,21 @@ -function describe -d 'Extend on "type" for executables' +function describe -d 'Extended "type"' for i in $argv - switch (type -t $i) + set typ (type -t $i ^ /dev/null) + if test $status -ne 0 + set -l path $i + ls -l $path + file $path | cut -d':' -f2 | cut -b 2- + type -pq pacman; and pacman -Qo $path ^ /dev/null + continue + end + switch $typ case file set -l path (type -p $i) ls -l $path file $path | cut -d':' -f2 | cut -b 2- - type -pq pacman; and pacman -Qo $path + type -pq pacman; and pacman -Qo $path ^ /dev/null case '*' - type $i + type $i end end end