diff --git a/README.md b/README.md index 76aa8d2..9df176d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,13 @@ You should now be able to use the plugin. Put `set -g @urlview-key 'x'` in `tmux.conf`. +> How can I reverse the order of the URLs? + +The program which is used to read the contents of the pane into the URL +extractor defaults to `cat`, but is configurable. To reverse the order, read +the contents with `tac` by placing `set -g @urlview-reader 'tac'` in +`tmux.conf`. + ### Other goodies `tmux-urlview` works great with: diff --git a/urlview.tmux b/urlview.tmux index 88752ce..ff2770e 100755 --- a/urlview.tmux +++ b/urlview.tmux @@ -20,6 +20,7 @@ find_executable() { } readonly key="$(get_tmux_option "@urlview-key" "u")" +readonly reader="$(get_tmux_option "@urlview-reader" "cat")" readonly cmd="$(find_executable)" if [ -z "$cmd" ]; then @@ -28,5 +29,5 @@ else tmux bind-key "$key" capture-pane -J \\\; \ save-buffer "${TMPDIR:-/tmp}/tmux-buffer" \\\; \ delete-buffer \\\; \ - split-window -l 10 "$cmd '${TMPDIR:-/tmp}/tmux-buffer'" + split-window -l 10 "$reader '${TMPDIR:-/tmp}/tmux-buffer' | $cmd" fi