DEV Community

Kevin Burns
Kevin Burns

Posted on • Originally published at burnskp.com on

1

Wezterm QuickSelect

After using tmux for more than a decade, I’ve recently moved away from it and switched to using the multiplex features in wezterm. One of my favorite plugins for tmux is tmux-thumbs. This allowed me to write patterns using regex and press a shortcut to highlight those patterns. It would give me a set of quick keys I could type that would then either copy the text to my clipboard or paste it to the command line. This comes in very handy when using kubectl and dealing with pod names.

Wezterm has a similar feature called QuickSelect. The following config will create a LEADER-f shortcut for selecting the string and pasting it into the command prompt and LEADER-F to copy it to the clipboard.


local config = wezterm.config_builder()
config.keys = {
    {
        key = "f",
        mods = "LEADER",
        action = act.QuickSelectArgs({
            label = "paste",
            action = wezterm.action_callback(function(window, pane)
                local selection = window:get_selection_text_for_pane(pane)
                pane:paste(selection)
            end),
        }),
    },
  { key = "F", mods = "LEADER", action = act.QuickSelect },
}
config.quick_select_patterns = {
  "[a-z]+(?:-[a-z0-9]+)+-[a-z0-9]+",
}
return config

Enter fullscreen mode Exit fullscreen mode

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay