DEV Community

Kevin Burns
Kevin Burns

Posted on • Originally published at burnskp.com on

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

Top comments (0)