Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pane contents reader configurable #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion urlview.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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