about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/User/_urls16
1 files changed, 13 insertions, 3 deletions
diff --git a/Completion/User/_urls b/Completion/User/_urls
index 859402246..422c249d8 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -46,13 +46,23 @@ if [[ -prefix [-+.a-z0-9]#: ]]; then
   scheme="${PREFIX%%:*}"
   compset -P "[-+.a-z0-9]#:"
 else
-  compadd "$@" -S '' http:// ftp:// bookmark:
+  compadd "$@" -S '' http:// ftp:// bookmark: file:
   return
 fi
 
 case "$scheme" in
-  http) compset -P // || { compadd "$@" -S '' //; return };;
-  ftp) compset -P // || { compadd "$@" -S '' //; return };;
+  http|ftp) compset -P // || { compadd "$@" -S '' //; return };;
+  file)
+    if [[ -prefix // ]]; then
+      compset -P //
+    elif [ -prefix / ]; then
+      _files "$@"
+      return
+    elif [ ! "$PREFIX" ]; then
+      compadd -S '/' ~+
+      return
+    fi
+  ;;
 esac
 
 if [[ "$scheme" = bookmark &&