issue 3159

13 views
Skip to first unread message

E Varun Kumar

unread,
Aug 6, 2022, 3:49:13 AM8/6/22
to tmux-...@googlegroups.com
hi,
I would like to work on this issue 3159

thanks,
Varun

Nicholas Marriott

unread,
Aug 6, 2022, 4:37:45 AM8/6/22
to E Varun Kumar, tmux-users
Great, do you have any questions? 

You will need to change window-copy.c, it is fairly easy to add a new command (there is a table). You'll also need to add a new default key binding to the two copy mode tables in key-bindings.c.



--
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 tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAAJX8E%3D6cUDAtFx_TFv%2BBbw__As3GoMhniWuwMbGqDb0zZ1AQQ%40mail.gmail.com.

M Kelly

unread,
Aug 7, 2022, 4:05:55 PM8/7/22
to tmux-users
Hi,

Adding a new tmux built-in function to do this would be great and that is really the point of this post.
But just for fun, a mapping such as:

bind-key -T copy-mode-vi z switch-client -T LEADERZ
bind-key -T LEADERZ z if -F "#{e|>=|:#{copy_cursor_y},#{e|/|:#{pane_height},2}}" "run \"tmux send -XN #{e|-|:#{copy_cursor_y},#{e|/|:#{pane_height},2}} scroll-down ; tmux send -XN #{e|-|:#{copy_cursor_y},#{e|/|:#{pane_height},2}} cursor-up\"" "run \"tmux send -XN #{e|-|:#{e|/|:#{pane_height},2},#{copy_cursor_y}} scroll-up ; tmux send -XN #{e|-|:#{e|/|:#{pane_height},2},#{copy_cursor_y}} cursor-down\""

I think gets close to vi's zz command, except for some corner cases.
And I am sure there is a much better way, to common up some values, and a way to get everything evaluated without using run-shell for example.
But it is fun to see what you can do with just a few minutes of messing around with bindings :-)

thx,
-m

Nicholas Marriott

unread,
Aug 7, 2022, 4:07:57 PM8/7/22
to M Kelly, tmux-users
Since you aren't using any actual sh in the inner commands - only expansion - you can use "run -C"


E Varun Kumar

unread,
Aug 20, 2022, 7:56:09 AM8/20/22
to Nicholas Marriott, tmux-users
window_copy_update_selection in window-copy.c takes two integer parameters may_redraw, no_reset. I have tried various values but could not notice any difference. Hence I went with the values 0,0. Could you explain these attributes?

On Sat, Aug 20, 2022 at 3:09 PM E Varun Kumar <varunk...@gmail.com> wrote:
I have raised pull request 3307.

E Varun Kumar

unread,
Aug 20, 2022, 7:56:10 AM8/20/22
to Nicholas Marriott, tmux-users
I have raised pull request 3307.

On Sat, Aug 6, 2022 at 2:07 PM Nicholas Marriott <nicholas...@gmail.com> wrote:

Nicholas Marriott

unread,
Aug 20, 2022, 11:55:36 AM8/20/22
to E Varun Kumar, tmux-users
may_redraw means the function is allowed to redraw. I assume this is intended to be zero if the caller is going to redraw anyway but it doesn't seem to be used consistently

no_reset looks to mean don't reset the selection to end of word/line if cursor has changed, not sure exactly how this works, seems like something to do with vi vs emacs cursor movement.



Varun Erigila

unread,
Aug 20, 2022, 12:56:32 PM8/20/22
to Nicholas Marriott, tmux-users
Thank you.
Reply all
Reply to author
Forward
0 new messages