w3m surfraw current url

pull/41/head
gotbletu 3 years ago
parent 0cf32500df
commit 495b13a580

@ -48,12 +48,14 @@ If you find my videos feature on other site let me know also, I always need an E
- Archwiki: xbacklight / xcalib - backlight utilities [Link](https://wiki.archlinux.org/index.php/backlight)
- FZF Fuzzy Finder - A command-line fuzzy finder written in Go [Link](http://junegunn.kr/2015/02/fzf-in-go/)
- Linuxaria: poor mans sportify [Link](http://linuxaria.com/pills/linux-terminal-poor-mans-spotify?lang=en)
- Linuxaria: Reptyr attach a running process to a new terminal [Link](https://linuxaria.com/pills/linux-terminal-reptyr-attach-a-running-process-to-a-new-terminal)
- nixCraft: vim as a manpager [Link](https://twitter.com/nixcraft/status/973221210589925385)
- OMGUbuntu: veromix - mixer for pulseaudio [Link](http://www.omgubuntu.co.uk/2012/02/how-to-increase-volume-over-100-in-kde/)
- Phoenixts: 9 YouTube Channels to Learn Linux Online [Link](http://phoenixts.com/blog/9-youtube-channels-to-learn-linux-online/)
- Softpedia: Video Clip of the Week: Workspaces & How We Use Them [Link](http://news.softpedia.com/news/Softpedia-Linux-Weekly-Issue-95-141165.shtml)
- Softpedia: Video Clip of the Week: KDE SC 4.7 [Link](http://news.softpedia.com/news/Softpedia-Linux-Weekly-Issue-164-221159.shtml)
- UbuntuBuzz: doc2pdf - convert microsoft doc or docx files to pdf [Link](http://www.ubuntubuzz.com/2012/12/cli-convert-microsoft-word-document-to.html)
- UbuntuManual: What is the Perfect YouTube Channel to Learn Ubuntu (or Linux) 2021 Guide [Link](https://ubuntumanual.org/youtube-channel-to-learn-ubuntu-or-linux/)
- WebUpd8: compiz grid with mouse binding [Link](http://www.webupd8.org/2011/01/set-up-hot-corners-for-compiz-grid.html)
- WebUpd8: ofris - deep freeze for linux [Link](http://www.webupd8.org/2010/08/ofris-deep-freeze-like-application-for.html)
- Transmission Remote CLI torrent client (Xpressrazor) [Link](https://xpressrazor.wordpress.com/2014/04/30/using-transmission-remote-as-your-default-bittorrent-client/)

@ -40,8 +40,11 @@ Yellow='\e[0;33m' # Yellow
# sudo mkdir -p /mnt/timecapsule && sudo mount.cifs //192.168.1.207/Data /mnt/timecapsule -o user=XXXXX,password=XXXXX,sec=ntlm,vers=1.0
# You can use the ip address if the basestation name fails
# https://i.imgur.com/LEgaW1M.png
CAPSULE_BASESTATION_NAME="TC2TB"
# CAPSULE_BASESTATION_NAME="TC2TB.local"
# CAPSULE_BASESTATION_NAME="192.168.X.XXX"
# https://i.imgur.com/h7slYTL.png
CAPSULE_PARTITION="Data"

@ -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";

@ -1,14 +1,14 @@
# W3M Prefix Search Engines Searches Using FZF and Surfraw
improving w3m by having a quick way to search multiple search engines or even custom search engines via the power of surfraw elvi
* tutorial video: [Link](https://youtu.be/p5NZb8f8AHA)
* tutorial video: [Link](https://youtu.be/p5NZb8f8AHA) | update [Link](https://youtu.be/0j3pUfZjCeQ)
* offical website: [Link](https://www.youtube.com/user/gotbletu)
tags: linux w3m omnibar address bar quick w3m smart search fzf fuzzy finder surfraw tmux workaround
tags: linux w3m omnibar address bar quick w3m smart search fzf fuzzy finder surfraw tmux workaround current url
### install requirements
w3m fzf surfraw (xsel or tmux)
w3m surfraw fzf gawk coreutils grep (xsel or tmux)
### install scripts to root directory
Download at [root-cgi-bin](w3m_plugins/root-cgi-bin)
@ -21,14 +21,13 @@ Download at [root-cgi-bin](w3m_plugins/root-cgi-bin)
----
chmod +x <script.cgi>
### install scripts to local directory
### install script to local directory
Download at [cgi-bin](w3m_plugins/cgi-bin)
----
# save it to
~/.w3m/cgi-bin/fzf_surfraw.cgi
~/.w3m/cgi-bin/fzf_surfraw_tmux.cgi
----
chmod +x <script.cgi>
@ -45,8 +44,15 @@ Download at [cgi-bin](w3m_plugins/cgi-bin)
# 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"
### set the default open-url to current url
sed -i 's:default_url.*:default_url 1:g' ~/.w3m/config
### usage example
$ w3m google.com
then press XS to use surfraw for smart search
### references
- https://youtu.be/0j3pUfZjCeQ
- https://youtu.be/p5NZb8f8AHA
- https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m
- [W3M Playlist](https://www.youtube.com/playlist?list=PLqv94xWU9zZ35Yv0s6zMID5JoS8qu19Kh)
@ -55,16 +61,14 @@ Download at [cgi-bin](w3m_plugins/cgi-bin)
### contact
_ _ _ _
__ _ ___ | |_| |__ | | ___| |_ _ _
_ _ _ _
__ _ ___ | |_| |__ | | ___| |_ _ _
/ _` |/ _ \| __| '_ \| |/ _ \ __| | | |
| (_| | (_) | |_| |_) | | __/ |_| |_| |
\__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|___/
|___/
- http://www.youtube.com/user/gotbletu
- https://www.youtube.com/user/gotbletu
- https://lbry.tv/@gotbletu
- https://twitter.com/gotbletu
- https://github.com/gotbletu
- gotbletu@gmail.com

Loading…
Cancel
Save