Open a URL from TMUX's save-buffer, with or without the http
I found myself wanting to open URLs from my TMUX scrollback buffers. The problem is that a lot of the time the URLs are missing the scheme.
bind u run "tmux save-buffer - | perl -pe 'if (not m/^http/) {\$_ = \"http://\$_\"}'| xargs open"
This will run open on what you copied from your scrollback buffer in your default browser in OSX also adding http:// if it does not start with http.
This breaks if you try to open a URL with a scheme other than http/https. In those cases, I simply use the following:
bind U run "tmux save-buffer - | xargs open"Written by Michael Lee Vazquez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Osx
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#