From 6ece8523b112871f49afc374c7bbe8aeaa3dc047 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 28 Sep 2014 16:35:14 +0800 Subject: [PATCH] __fish_complete_path: add new completion, mimics builtin path completion Completions can now be written which disable file completion and then selectively re-enable it using this function. Closes #834. --- share/functions/__fish_complete_path.fish | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 share/functions/__fish_complete_path.fish diff --git a/share/functions/__fish_complete_path.fish b/share/functions/__fish_complete_path.fish new file mode 100644 index 000000000..e10ef7069 --- /dev/null +++ b/share/functions/__fish_complete_path.fish @@ -0,0 +1,14 @@ +function __fish_complete_path --description "Complete using path" + set -l target + set -l description + switch (count $argv) + case 0 + # pass + case 1 + set target "$argv[1]" + case 2 "*" + set target "$argv[1]" + set description "$argv[2]" + end + printf "%s\t$description\n" (command ls -dp "$target"*) +end