Skip to content

Delete temp file after script finishes #18

@Boruch-Baum

Description

@Boruch-Baum

For me, this isn't worth forking and making a pull request. Here are my minor changes to to your nice script, basically to just clean up after itself. Also, it removes some repetitive bash-shms, and uses the canonical method for creating a temp file.

readonly key="$(get_tmux_option "@urlview-key" "u")"
readonly cmd="$(find_executable)"
readonly temp_file="$(mktemp --tmpdir tmux-urlview.XXX)"

if [ -z "$cmd" ]; then
  tmux display-message "Failed to load tmux-urlview: neither urlview nor extract_url were found on the PATH"
else
  tmux bind-key "$key" capture-pane -J \\\; \
    save-buffer "$temp_file" \\\; \
    delete-buffer \\\; \
    split-window -l 10 "$cmd '$temp_file'; rm '$temp_file' "
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions