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

Add Feature: Copy all visible lines in specified tmux pane to buffer #96

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

Matt-A-Bennett
Copy link

This is my first pull request (following the new issue I created on 05/01/2022 requesting the feature), so I hope it's in good order. I explained the new feature in the updated README.md

At one point I accidentally overwrote the file sh/tmuxcomplete with an altered copy, so now it's showing that all the lines were changed. I actually only altered two functions and added a new option flag -t in the getopts loop. Below I just show the additional lines:

TARGET='-1'

while getopts enp:s:t:l:c:g: name
do case $name in

    t) TARGET="$OPTARG";;

    *) echo "Usage: $0 [-t <pane_index>] [-p pattern] [-s splitmode] [-l listargs] [-c captureargs] [-g grepargs]\n"
        exit 2;;
esac
done

and the two functions in they're entirety (the new part is the elif):

excludecurrent() {
    if [ "$EXCLUDE" = "1" ]; then
        currentpane=$(tmux display-message -p '11-#{session_id} ')
        # echo 1>&2 'current' "$currentpane"
        # use -F to match $ in session id
        grep -v -F "$currentpane"
    elif ! [ "$TARGET" = "-1" ]; then
        echo $(tmux display-message -p '01-#{session_id} ')$TARGET
    else
        cat
    fi
}

and (the new part is that uniq is changed to cat:

sortu() {
    if [ "$NOSORT" = "1" ]; then
        cat
    else
        sort -u
    fi
}

Please let me know if this feature is of interest/within the scope of the plugin, and if there's anymore I should do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant