w3m surfraw current url
parent
0cf32500df
commit
495b13a580
@ -1,43 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
### _ _ _ _
|
||||
### __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
### / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
###| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
### \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
### |___/
|
||||
### https://www.youtube.com/user/gotbletu
|
||||
### https://lbry.tv/@gotbletu
|
||||
### https://twitter.com/gotbletu
|
||||
### https://github.com/gotbletu
|
||||
### gotbletu@gmail.com
|
||||
###
|
||||
### Author : gotbletu
|
||||
### Name : fzf_surfraw.cgi
|
||||
### Version : 0.2
|
||||
### Date : 2020-04-27
|
||||
### Description : interactive surfraw smart prefix search engine (mainly use within w3m web browser)
|
||||
### Depends On : surfraw fzf xsel gawk coreutils grep procps-ng
|
||||
### Video Demo : https://youtu.be/p5NZb8f8AHA
|
||||
### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
|
||||
### Setup
|
||||
# vim ~/.w3m/keymap
|
||||
# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi"
|
||||
# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi"
|
||||
# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi"
|
||||
# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi"
|
||||
|
||||
clear
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: interactive surfraw smart prefix search engine
|
||||
# DEMO: https://youtu.be/p5NZb8f8AHA | updated https://youtu.be/0j3pUfZjCeQ
|
||||
# DEPEND: surfraw fzf gawk coreutils grep (xsel or tmux)
|
||||
# RQMTS: 1. allow permissions and put goto_* scripts in /usr/lib/w3m/cgi-bin/
|
||||
# 2. allow permissions and put fzf_surfraw.cgi any where you like e.g ~/.w3m/cgi-bin/
|
||||
# 3. $EDITOR ~/.w3m/keymap
|
||||
#
|
||||
# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi"
|
||||
# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi"
|
||||
# # keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi"
|
||||
# # keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi"
|
||||
# # keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi"
|
||||
# # keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi"
|
||||
#
|
||||
# CLOG: 2021-02-05 version 0.3 copy to all 3 clipboard at once; xsel primary/system clipboard, tmux clipboard
|
||||
# 2020-05-08 version 0.2 surfraw -p instead of echo
|
||||
# 2020-04-27 version 0.1
|
||||
|
||||
|
||||
# clear screen
|
||||
printf "\033c"
|
||||
|
||||
# select your elvi
|
||||
PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e | awk '{print $1}')
|
||||
|
||||
# exit script if no elvi is selected (e.g hit ESC)
|
||||
if [ "$PREFIX" = "" ]; then exit; fi
|
||||
# if [ "$PREFIX" = "" ]; then exit; fi
|
||||
[ -z "$PREFIX" ] && exit
|
||||
|
||||
# get user input
|
||||
read -r -e -p " $PREFIX >> Enter Your Search Keyword: " INPUT
|
||||
|
||||
# print proper url and copy to primary clipboard (aka highlighted clipboard) and tmux clipboard
|
||||
surfraw -p "$PREFIX" "$INPUT" | xsel -p
|
||||
# surfraw -p "$PREFIX" "$INPUT" | xsel -p
|
||||
# tmux set-buffer "$(surfraw -p "$PREFIX" "$INPUT")"
|
||||
|
||||
# note: dont quote $INPUT it will mess up results
|
||||
|
||||
# copy to xsel primary (aka shift-insert)
|
||||
surfraw -p "$PREFIX" $INPUT | xsel -p
|
||||
|
||||
# copy to xsel system clipboard (aka ctrl-v)
|
||||
surfraw -p "$PREFIX" $INPUT | xsel -b
|
||||
|
||||
# copy to tmux clipboard
|
||||
tmux set-buffer "$(surfraw -p "$PREFIX" $INPUT)"
|
||||
# pidof tmux >/dev/null && tmux set-buffer "$(surfraw -p "$PREFIX" "$INPUT")"
|
||||
|
@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
### _ _ _ _
|
||||
### __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
### / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
###| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
### \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
### |___/
|
||||
### https://www.youtube.com/user/gotbletu
|
||||
### https://lbry.tv/@gotbletu
|
||||
### https://twitter.com/gotbletu
|
||||
### https://github.com/gotbletu
|
||||
### gotbletu@gmail.com
|
||||
###
|
||||
### Author : gotbletu
|
||||
### Name : fzf_surfraw_tmux.cgi
|
||||
### Version : 0.2
|
||||
### Date : 2020-04-27
|
||||
### Description : interactive surfraw smart prefix search engine (mainly use within w3m web browser)
|
||||
### Depends On : surfraw fzf tmux gawk coreutils grep procps-ng
|
||||
### Video Demo : https://youtu.be/p5NZb8f8AHA
|
||||
### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
|
||||
### Setup
|
||||
# vim ~/.w3m/keymap
|
||||
# keymap xs COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi"
|
||||
# keymap XS COMMAND "SHELL ~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi ; TAB_GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi"
|
||||
|
||||
clear
|
||||
|
||||
# select your elvi
|
||||
PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL'| fzf -e | awk '{print $1}')
|
||||
|
||||
# exit script if no elvi is selected (e.g hit ESC)
|
||||
if [ "$PREFIX" = "" ]; then exit; fi
|
||||
|
||||
# get user input
|
||||
read -r -e -p " $PREFIX >> Enter Your Search Keyword: " INPUT
|
||||
|
||||
# print proper url and copy to primary clipboard (aka highlighted clipboard) and tmux clipboard
|
||||
# surfraw -p "$PREFIX" "$INPUT" | xsel -p
|
||||
pidof tmux >/dev/null && tmux set-buffer "$(surfraw -p "$PREFIX" "$INPUT")"
|
@ -1,25 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
### __ _ _
|
||||
### / _| ___| (_)_ __ ___ ___ __ _ __ _
|
||||
###| |_ / _ \ | | '_ \ / _ \/ __|/ _` |/ _` |
|
||||
###| _| __/ | | |_) | __/\__ \ (_| | (_| |
|
||||
###|_| \___|_|_| .__/ \___||___/\__,_|\__,_|
|
||||
### |_|
|
||||
### https://github.com/felipesaa
|
||||
###
|
||||
### Author : felipesaa
|
||||
### Name : goto_clipboard.cgi
|
||||
### Version : 0.1
|
||||
### Date : 2018-09-30
|
||||
### Description : paste and go feature for w3m web browser using system clipboard (aka ctrl+v)
|
||||
### Depends On : w3m xsel
|
||||
### Video Demo : https://youtu.be/p5NZb8f8AHA
|
||||
### Source : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
### Install : put this script in /usr/lib/w3m/cgi-bin/
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: paste and go feature for w3m web browser using system clipboard (aka ctrl+v)
|
||||
# DEMO: https://youtu.be/p5NZb8f8AHA | updated https://youtu.be/0j3pUfZjCeQ
|
||||
# DEPEND: w3m xsel
|
||||
# RQMTS: 1. allow permissions and put this script in /usr/lib/w3m/cgi-bin/
|
||||
#
|
||||
# 2. $EDITOR ~/.w3m/keymap
|
||||
# # paste url and go (current tab)
|
||||
# keymap pp GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi
|
||||
#
|
||||
# # paste url and go (new tab)
|
||||
# keymap PP TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard.cgi
|
||||
#
|
||||
# 3. set the default open-url to current url
|
||||
# sed -i 's:default_url.*:default_url 1:g' ~/.w3m/config
|
||||
#
|
||||
# REFF: https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
# CLOG: 2021-02-05 version 0.2 reset url back to 1 (aka edit current url)
|
||||
# 2018-09-30 version 0.1 by felipesaa (https://github.com/felipesaa)
|
||||
|
||||
|
||||
# set open-url value to zero (aka empty url line)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=0";
|
||||
|
||||
#GOTO url in clipboard in current page. If the clipboard has a
|
||||
#"non url string/nothing" an blank page is shown.
|
||||
printf "%s\r\n" "W3m-control: GOTO $(xsel -ob)";
|
||||
|
||||
#delete the buffer (element in history) created between the current page and
|
||||
#the searched page by calling this script.
|
||||
printf "W3m-control: DELETE_PREVBUF\r\n"
|
||||
|
||||
# set default open-url value to one (aka current url)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=1";
|
||||
|
||||
|
@ -1,28 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
### _ _ _ _
|
||||
### __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
### / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
###| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
### \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
### |___/
|
||||
### https://www.youtube.com/user/gotbletu
|
||||
### https://twitter.com/gotbletu
|
||||
### https://github.com/gotbletu
|
||||
### gotbletu@gmail.com
|
||||
###
|
||||
### Author : gotbletu
|
||||
### Name : goto_clipboard_primary.cgi
|
||||
### Version : 0.1
|
||||
### Date : 2020-04-26
|
||||
### Description : paste and go feature for w3m web browser using system clipboard (primary aka shift+insert)
|
||||
### Depends On : w3m xsel
|
||||
### Video Demo : https://youtu.be/p5NZb8f8AHA
|
||||
### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
### Install : put this script in /usr/lib/w3m/cgi-bin/
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: paste and go feature for w3m web browser using primary clipboard (aka shift+insert)
|
||||
# DEMO: https://youtu.be/p5NZb8f8AHA | updated https://youtu.be/0j3pUfZjCeQ
|
||||
# DEPEND: w3m xsel
|
||||
# RQMTS: 1. allow permissions and put this script in /usr/lib/w3m/cgi-bin/
|
||||
#
|
||||
# 2. $EDITOR ~/.w3m/keymap
|
||||
# # paste url and go (current tab)
|
||||
# keymap pp GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi
|
||||
#
|
||||
# # paste url and go (new tab)
|
||||
# keymap PP TAB_GOTO /usr/lib/w3m/cgi-bin/goto_clipboard_primary.cgi
|
||||
#
|
||||
# 3. set the default open-url to current url
|
||||
# sed -i 's:default_url.*:default_url 1:g' ~/.w3m/config
|
||||
#
|
||||
# REFF: https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
# CLOG: 2021-02-05 version 0.2 reset url back to 1 (aka edit current url)
|
||||
# 2020-04-26 version 0.1
|
||||
|
||||
|
||||
# set open-url value to zero (aka empty url line)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=0";
|
||||
|
||||
#GOTO url in clipboard in current page. If the clipboard has a
|
||||
#"non url string/nothing" an blank page is shown.
|
||||
printf "%s\r\n" "W3m-control: GOTO $(xsel -op)";
|
||||
|
||||
#delete the buffer (element in history) created between the current page and
|
||||
#the searched page by calling this script.
|
||||
printf "W3m-control: DELETE_PREVBUF\r\n"
|
||||
|
||||
# set default open-url value to one (aka current url)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=1";
|
||||
|
||||
|
@ -1,28 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
### _ _ _ _
|
||||
### __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
### / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
###| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
### \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
### |___/
|
||||
### https://www.youtube.com/user/gotbletu
|
||||
### https://twitter.com/gotbletu
|
||||
### https://github.com/gotbletu
|
||||
### gotbletu@gmail.com
|
||||
###
|
||||
### Author : gotbletu
|
||||
### Name : goto_tmux_clipboard.cgi
|
||||
### Version : 0.1
|
||||
### Date : 2020-04-26
|
||||
### Description : paste and go feature for w3m web browser using tmux clipboard
|
||||
### Depends On : w3m tmux
|
||||
### Video Demo : https://youtu.be/p5NZb8f8AHA
|
||||
### References : https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
### Install : put this script in /usr/lib/w3m/cgi-bin/
|
||||
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# DESC: paste and go feature for w3m web browser using tmux clipboard
|
||||
# DEMO: https://youtu.be/p5NZb8f8AHA | updated https://youtu.be/0j3pUfZjCeQ
|
||||
# DEPEND: w3m tmux
|
||||
# RQMTS: 1. allow permissions and put this script in /usr/lib/w3m/cgi-bin/
|
||||
#
|
||||
# 2. $EDITOR ~/.w3m/keymap
|
||||
# # paste url and go (current tab)
|
||||
# keymap pp GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi
|
||||
#
|
||||
# # paste url and go (new tab)
|
||||
# keymap PP TAB_GOTO /usr/lib/w3m/cgi-bin/goto_tmux_clipboard.cgi
|
||||
#
|
||||
# 3. set the default open-url to current url
|
||||
# sed -i 's:default_url.*:default_url 1:g' ~/.w3m/config
|
||||
#
|
||||
# REFF: https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
|
||||
# CLOG: 2021-02-05 version 0.2 reset url back to 1 (aka edit current url)
|
||||
# 2020-04-26 version 0.1
|
||||
|
||||
|
||||
# set open-url value to zero (aka empty url line)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=0";
|
||||
|
||||
#GOTO url in clipboard in current page. If the clipboard has a
|
||||
#"non url string/nothing" an blank page is shown.
|
||||
printf "%s\r\n" "W3m-control: GOTO $(tmux paste-buffer)";
|
||||
|
||||
#delete the buffer (element in history) created between the current page and
|
||||
#the searched page by calling this script.
|
||||
printf "W3m-control: DELETE_PREVBUF\r\n"
|
||||
|
||||
# set default open-url value to one (aka current url)
|
||||
printf "%s\r\n" "W3m-control: SET_OPTION default_url=1";
|
||||
|
||||
|
Loading…
Reference in New Issue