summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_surfraw18
1 files changed, 16 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..343d275cc 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -424,12 +424,26 @@ case $state in
       yubnub)
         _message -e command 'Yubnub Command'
       ;;
+      *)
+        _message -e string 'search string'
+      ;;
     esac
   ;;
   elvi)
+    local -UT XDG_CONFIG_DIRS xcd
+    # as it starts with a space, the header becomes an empty
+    # string removed by the list expansion
     _wanted elvi expl elvi compadd \
-      ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
+        ${${(f)"$(surfraw -elvi)"}%%[[:space:]]*} $(
+          # extract the keys of all bookmarks (should be in surfraw itself)
+          awk '{keys[$1]=1} END {for (k in keys) print k}' \
+          $^xcd/surfraw/bookmarks(Nr) \
+          /etc/xdg/surfraw/bookmarks(Nr) \
+          /etc/surfraw.bookmarks(Nr) \
+          ${XDG_CONFIG_HOME-${HOME?homeless}/.config}/surfraw/bookmarks(Nr) \
+          ${HOME?homeless}/.surfraw.bookmarks(Nr)
+        ) && ret=0
   ;;
-esac  
+esac
 
 return ret