commit d8f2127c8ff78bf1ce79ec4408f6438a88158001
parent 08f10c4202b7a6a47524187ac912844b90c0c16b
Author: Wolfgang Corcoran-Mathe <first.lord.of.teal@gmail.com>
Date: Tue, 19 Aug 2014 14:45:45 -0400
Fixed overzealous deletions (oops), added explanatory comment
Diffstat:
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/surf.suckless.org/files/quick_search.md b/surf.suckless.org/files/quick_search.md
@@ -34,6 +34,20 @@ Code
#
# surf_qsearch:
# Search script for surf. Takes the surf window id as argument.
+ # POSIX compliant and GNU-free, I think.
+ #
+ # Add something like the following to your surf/config.(def.)h, replacing
+ # surf_qsearch with the name of the file you've copied this code into:
+ #
+ # /* Quick searching. */
+ # #define QSEARCH { \
+ # .v = (char *[]){"/bin/sh", "-c", "surf_qsearch $0 $1", winid, NULL } \
+ # }
+ #
+ # Add a keybinding in keys[]:
+ #
+ # { MODKEY, GDK_q, spawn, QSEARCH },
+ #
# Get the full query. The 'echo | dmenu' idiom may be a bit of
# a hack, but it seems to work.
@@ -43,7 +57,10 @@ Code
# Extract the engine code.
e="${q%% *}"
- # Encode the search string (i.e. the rest of q)
+ # Encode the search string (i.e. the rest of q). xxd was formerly used
+ # here, but xxd is part of vim packages on some systems, whereas od is
+ # ubiquitous. A search script that breaks if someone accidentally removes
+ # vim is stupid.
s=$(printf %s "${q#* }" | od -t x1 -An | tr -d '\n' | tr ' ' '%')
# These are examples. Change as desired.