]> Sergey Matveev's repositories - dotfiles.git/commitdiff
urlview replacement
authorSergey Matveev <stargrave@stargrave.org>
Tue, 22 Feb 2022 14:02:40 +0000 (17:02 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 22 Feb 2022 14:02:40 +0000 (17:02 +0300)
urlview/.urlview [deleted file]
urlview/bin/urlview [new file with mode: 0755]

diff --git a/urlview/.urlview b/urlview/.urlview
deleted file mode 100644 (file)
index 511b181..0000000
+++ /dev/null
@@ -1 +0,0 @@
-COMMAND /home/stargrave/bin/www %s &
diff --git a/urlview/bin/urlview b/urlview/bin/urlview
new file mode 100755 (executable)
index 0000000..59aa515
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+cmd=www
+# regexp is taken from urlview
+grep -P -o '(((http|https|ftp|gopher)|mailto):(//)?[^ <>\"\t]*|(www|ftp)[0-9]?\\.[-a-z0-9.]+)[^ .,;\t\n\r<\">\\):]?[^, <>\"\t]*[^ .,;\t\n\r<\">\\):]' "$@" |
+fzf --bind="enter:execute($cmd {})" \
+    --bind="ctrl-f:execute(rlwrap --history-filename /dev/null --pre-given={} head -1 | xargs $cmd)"