Strange, that's not expected behavior.
I have the following binding and it works like a charm (tmux 3.2):
# Copy the current selection to a new buffer or start one if none is active.
bind -T copy-mode 'Space' {
if -F '#{||:#{selection_active},#{search_present}}' {
send -X copy-pipe
} {
send -X begin-selection
}
}
If you are referring to mouse support, this is what I'm using:
# Avoid cancelling copy-mode if the pane history has been scrolled.
bind -T copy-mode 'MouseDragEnd1Pane' {
if -F "#{scroll_position}" {
send -X copy-pipe
} {
send -X copy-pipe-and-cancel
}
}
On Sep 2 2020, at 9:28 pm, Peng Yu <[email protected]> wrote:
> I changed copy-pipe-and-cancel to copy-pipe. But the cursor still is
> reset to the bottom of the history. I want the cursor to remain at its
> original position (it could be several pages back.). Thanks.
>
> On 9/2/20, Stéphane GLEIZES <[email protected]> wrote:
> > I think you can use 'copy-pipe' instead of 'copy-pipe-and-cancel' for that
> > purpose.
> >
> > Stéphane Gleizes
> > On Sep 2 2020, at 7:46 am, Suraj N. Kurapati <[email protected]> wrote:
> > > I think he's referring to exiting copy mode. He wants to copy a selection
> > > using a shortcut and still remain in copy mode afterwards.
> > >
> > > On September 1, 2020 10:41:21 PM PDT, Nicholas Marriott
> > > <[email protected]> wrote:
> > > > What do you mean the screen gets reset?
> > > >
> > > >
> > > > On Wed, 2 Sep 2020 at 03:01, Peng Yu <[email protected]
> > > > (mailto:[email protected])> wrote:
> > > > > I have the following ~/.tmux.conf. When I copy text I select the text,
> > > > > the text got automatically copied (in Mac Terminal). But the screen
> > > > > got reset too. I don't want this behavior. I want to select the text
> > > > > then type command-C to copy the text without resetting the screen. Is
> > > > > there way to get this behavior in the configuration? Thanks.
> > > > >
> > > > >
> > > > > # Send prefix
> > > > > set-option -g prefix C-a
> > > > > set-option -g repeat-time 2000
> > > > > bind-key c-R source-file ~/.tmux.conf \; display-message "~/.tmux.conf
> > > > > sourced"
> > > > >
> > > > > bind-key v split-window -h -c "#{pane_current_path}" #\; switch-client
> > > > > -T prefix
> > > > > bind-key s split-window -v -c "#{pane_current_path}" #\; switch-client
> > > > > -T prefix
> > > > >
> > > > > bind-key -r h select-pane -L
> > > > > bind-key -r j select-pane -D
> > > > > bind-key -r k select-pane -U
> > > > > bind-key -r l select-pane -R
> > > > >
> > > > > bind-key -r - resize-pane -D
> > > > > bind-key -r + resize-pane -U
> > > > > bind-key -r < resize-pane -L
> > > > > bind-key -r > resize-pane -R
> > > > >
> > > > > bind-key c new-window -c "#{pane_current_path}"
> > > > > bind-key -r n next-window
> > > > > bind-key -r p previous-window
> > > > >
> > > > > #bind-key -T root C-'[' next-window
> > > > > #bind-key -T root C-']' previous-window
> > > > >
> > > > > set-option -g mode-keys vi
> > > > > bind-key -T copy-mode-vi v send-keys -X begin-selection
> > > > > #bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
> > > > > bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
> > > > > "reattach-to-user-namespace pbcopy"
> > > > >
> > > > > bind-key -T prefix P paste-buffer
> > > > > set-option -g history-limit 10000
> > > > > set-option -g mouse on
> > > > >
> > > > > # https://github.com/tmux/tmux/issues/1113
> > > > > #bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X
> > > > > copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
> > > > > #bind-key -T copy-mode-vi MouseDragEnd1Pane send -X
> > > > > copy-pipe-and-cancel "cat >/tmp/foo"
> > > > > bind-key -T copy-mode-vi MouseDragEnd1Pane send -X
> > > > > copy-pipe-and-cancel pbcopy
> > > > >
> > > > >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "tmux-users" group.
> > > > > To unsubscribe from this group and stop receiving emails from it, send
> > > > > an email to [email protected]
> > > > > (mailto:[email protected]).
> > > > > To view this discussion on the web, visit
> > > > > https://groups.google.com/d/msgid/tmux-users/90509f4f-41ea-4396-928d-7536e4adbf19n%40googlegroups.com
> > > > > (https://groups.google.com/d/msgid/tmux-users/90509f4f-41ea-4396-928d-7536e4adbf19n%40googlegroups.com?utm_medium=email&utm_source=footer).
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "tmux-users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an
> > > email to [email protected]
> > > (mailto:[email protected]).
> > > To view this discussion on the web, visit
> > > https://groups.google.com/d/msgid/tmux-users/F8D4BDA8-8217-416D-B885-43BE05DB0554%40riseup.net
> > > (https://groups.google.com/d/msgid/tmux-users/F8D4BDA8-8217-416D-B885-43BE05DB0554%40riseup.net?utm_medium=email&utm_source=footer).
> > >
> >
> >
>
>
> --
> Regards,
> Peng
>
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/6552B2D0-0433-48E9-AE0A-B89C34F9512A%40getmailspring.com.