Skip to content

rc/repl/tmux: bracketed paste#5386

Open
KoviRobi wants to merge 4 commits intomawww:masterfrom
KoviRobi:rc/repl/tmux-bracketed-paste
Open

rc/repl/tmux: bracketed paste#5386
KoviRobi wants to merge 4 commits intomawww:masterfrom
KoviRobi:rc/repl/tmux-bracketed-paste

Conversation

@KoviRobi
Copy link
Copy Markdown
Contributor

Hi!

I have made some tweaks to the rc/repl/tmux file which might be useful for others so I thought I'd contribute back :)

Summary

  • Use bracketed paste by default, add option to disable (as it might not be supported by all interpreters)
  • tmux-send-repl sends all selections -- this is to support stripping indent, very useful for Python. No option as the old behaviour can be achieved by ,: tmux-send-repl<ret><a-u>.

The latter comes with a question which I should probably remove from the commit message and ask somewhere better... Since I'm here I'll put it here but just ignore and I'll create an account and move to discuss when I can remember

Aside question: Is there a better way to select block
selections? Especially if I want it to be say only the second column in
a Markdown table e.g.

| A | B | C |
|---|---|---|
| 1 | x | i |
| 2 | y | j |
| 3 | z | k |

and my selection is /\| B.+?z \| (i.e. "| B" to "z |")? I normally
just do xs^ and use h/H etc. Such selections are very easy to make by
just using J or similar, so for me are somewhat common.

I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
This is required for e.g Python 3.13's _pyrepl pasting to work properly,
otherwise it indents the next line which doesn't work with Python.
@KoviRobi KoviRobi force-pushed the rc/repl/tmux-bracketed-paste branch from 0fad8da to 8f834cc Compare September 16, 2025 00:58
This is most useful for e.g. Python code, where you might have something
like

```python
def function_under_test():
    if foo:
        print(bar)
```

so you do something like selecting the `if` and `print` lines
`/if<ret>]fx` (lsp plugin select to end of function), and then convert
it to block selection using `S^ {,4}` (for 4 space indent) then it will
send the dedented lines to the repl.

Not adding an option for this as the old way of only sending the main
selection can be done using `,: tmux-send-repl<ret><a-u>`.
@KoviRobi KoviRobi force-pushed the rc/repl/tmux-bracketed-paste branch from 8f834cc to 40f7ffb Compare September 16, 2025 01:08
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