wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

copy_mode: implement `MoveToBlankLine`

Open 9999years opened this issue 5 months ago • 6 comments

This is equivalent to the previous-paragraph and next-paragraph bindings in tmux.

Closes #7079

If this looks good, let me know and I can write some tests and docs for it! I'm not sure if we want this to be a more general mechanism like jumping to a line that matches a pattern.

TODO:

  • [x] Docs
  • [ ] Tests

Usage:

local wezterm = require 'wezterm'
local act = wezterm.action

return {
  key_tables = {
    copy_mode = {
      {
        key = "{",
        action = act.CopyMode { MoveToBlankLine = "Up" },
      },
      {
        key = "}",
        action = act.CopyMode { MoveToBlankLine = "Down" },
      },
    },
  },
}

9999years avatar Aug 07 '25 23:08 9999years

Hello, thanks for the contribution!

What's your reasoning for allowing any number instead of just -1/1 for a direction? If you want to allow skipping multiple paragraphs this can already be done using the Multiple action if the user wants.

bew avatar Aug 31 '25 23:08 bew

@bew No real reason, happy to cut that feature if you'd like.

9999years avatar Sep 02 '25 01:09 9999years

I this it'll be easier to make sense of and describe, and it's still easy to add back if needed

bew avatar Sep 02 '25 06:09 bew

@bew Done, now it takes a direction parameter: act.CopyMode { MoveToBlankLine = "Up" }.

9999years avatar Sep 02 '25 18:09 9999years

Added the requested doc comments, I still need to add docs to the manual + tests. Thanks for the review!

9999years avatar Sep 06 '25 20:09 9999years

@bew Added docs, PTAL :)

9999years avatar Nov 10 '25 19:11 9999years