├── LICENSE.md ├── README.md └── urlview.tmux /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) Joshua Boy Nicolai Appelman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tmux urlview 2 | 3 | Quickly open any url on your terminal window! 4 | 5 | Plugin wrapper around either [urlview](https://github.com/sigpipe/urlview) or [extract_url](http://www.memoryhole.net/~kyle/extract_url/). 6 | 7 | ### Demo 8 | 9 | [![Demo tmux-urlview](http://g.recordit.co/5Uh5W4oaPR.gif)](http://recordit.co/5Uh5W4oaPR) 10 | 11 | ### Dependencies 12 | 13 | *One* of the following is required. 14 | 15 | - `urlview` - `brew install urlview` on OS X. 16 | - `extract_url` - `brew install extract_url` on OS X. 17 | 18 | ### Key bindings 19 | 20 | In any tmux mode: 21 | 22 | - `u` - listing all urls on bottom pane 23 | 24 | 25 | ### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended) 26 | 27 | Add plugin to the list of TPM plugins in `.tmux.conf`: 28 | 29 | set -g @plugin 'tmux-plugins/tmux-urlview' 30 | 31 | 32 | Hit `prefix + I` to fetch the plugin and source it. You should now be able to 33 | use the plugin. 34 | 35 | ### Manual Installation 36 | 37 | Clone the repo: 38 | 39 | $ git clone https://github.com/tmux-plugins/tmux-urlview ~/clone/path 40 | 41 | Add this line to the bottom of `.tmux.conf`: 42 | 43 | run-shell ~/clone/path/urlview.tmux 44 | 45 | Reload TMUX environment: 46 | 47 | # type this in terminal 48 | $ tmux source-file ~/.tmux.conf 49 | 50 | You should now be able to use the plugin. 51 | 52 | ### Configuration 53 | 54 | > How can I change the default "u" key binding to something else? For example, 55 | > key "x"? 56 | 57 | Put `set -g @urlview-key 'x'` in `tmux.conf`. 58 | 59 | ### Other goodies 60 | 61 | `tmux-urlview` works great with: 62 | 63 | - [tmux-fpp](https://github.com/tmux-plugins/tmux-fpp) - a plugin for 64 | opening any files on your terminal window 65 | - [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) - a plugin for 66 | regex searches in tmux and fast match selection 67 | - [tmux-yank](https://github.com/tmux-plugins/tmux-yank) - enables copying 68 | highlighted text to system clipboard 69 | 70 | ### License 71 | 72 | [MIT](LICENSE.md) 73 | -------------------------------------------------------------------------------- /urlview.tmux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | get_tmux_option() { 4 | local option=$1 5 | local default_value=$2 6 | local option_value=$(tmux show-option -gqv "$option") 7 | if [ -z $option_value ]; then 8 | echo $default_value 9 | else 10 | echo $option_value 11 | fi 12 | } 13 | 14 | find_executable() { 15 | if type urlview >/dev/null 2>&1; then 16 | echo "urlview" 17 | elif type extract_url >/dev/null 2>&1; then 18 | echo "extract_url" 19 | fi 20 | } 21 | 22 | readonly key="$(get_tmux_option "@urlview-key" "u")" 23 | readonly cmd="$(find_executable)" 24 | 25 | if [ -z "$cmd" ]; then 26 | tmux display-message "Failed to load tmux-urlview: neither urlview nor extract_url were found on the PATH" 27 | else 28 | tmux bind-key "$key" capture-pane -J \\\; \ 29 | save-buffer "${TMPDIR:-/tmp}/tmux-buffer" \\\; \ 30 | delete-buffer \\\; \ 31 | split-window -l 10 "$cmd '${TMPDIR:-/tmp}/tmux-buffer'" 32 | fi 33 | --------------------------------------------------------------------------------