1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-29 00:21:57 +03:00
wezterm/docs/config/lua/keyassignment/Search.md
Wez Furlong 107d3d2378 search mode can now default to searching the selection text
To do this, we split `Pattern` into the underlying pattern for the mux
layer (which is part of the codec), and another for the config layer,
so that we can specify this new mode.

At the gui layer, we translate the selection variant into the actual
selection text and map it to the mux Pattern enum.

When taking the selection text, we restrict it to just the first line.

refs: https://github.com/wez/wezterm/issues/1912
2022-05-21 07:24:50 -07:00

1.2 KiB

Search

since: 20200607-144723-74889cd4

This action will trigger the search overlay for the current tab. It accepts a typed pattern string as its parameter, allowing for Regex, CaseSensitiveString and CaseInSensitiveString as pattern matching types.

The supported regular expression syntax is described here.

local wezterm = require 'wezterm';
return {
  keys = {
    -- search for things that look like git hashes
    {key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={Regex="[a-f0-9]{6,}"}}},
    -- search for the lowercase string "hash" matching the case exactly
    {key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseSensitiveString="hash"}}},
    -- search for the string "hash" matching regardless of case
    {key="H", mods="SHIFT|CTRL", action=wezterm.action{Search={CaseInSensitiveString="hash"}}},
  },
}

Learn more about the search overlay

since: nightly builds only

You may now use wezterm.action{Search="CurrentSelectionOrEmptyString"} to have the search take the currently selected text as the item to search.

The selection text is adjusted to be a single line.