wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.11k stars 771 forks source link

Search: option to not use last search term #1988

Open Funami580 opened 2 years ago

Funami580 commented 2 years ago

Is your feature request related to a problem? Please describe. In https://github.com/wez/wezterm/commit/dc0fde7ae001b5210d2cd4752c71429af08d8ac4 the behaviour of the search was altered and it now defaults to using the last search term, if the pattern is empty. I’ve been using the empty pattern as default, though.

{key="f", mods="CTRL|SHIFT", action=wezterm.action{Search={CaseInSensitiveString=""}}},

Describe the solution you'd like I’m not sure, what’s the best way to handle this. Possible would be

{key="f", mods="CTRL|SHIFT", action=wezterm.action{Search={CaseInSensitiveString=nil}}},

or

{key="f", mods="CTRL|SHIFT", action=wezterm.action{
Search={CaseInSensitiveString="default when there is no last search term", use_last_search_term=true}}},

for signalising the active use of the last search term. But there may also be better solutions to this.

Describe alternatives you've considered Not sure if there is an alternative?

wez commented 2 years ago

Can you share a bit more about the workflow in which you want it to be explicitly blank? That might inform how to deal with this!

Funami580 commented 2 years ago

I don’t think I have a specific workflow. I use the search action to search for specific words in the terminal, that are most of the times different (especially when large text chunks are printed to the terminal). When a pattern is predefined or the old pattern is used, I always have to delete it first, to enter the new pattern. And that takes time, as deleting the pattern requires pressing backspace for some time, in particular if the last search term was really long. Perhaps some way to clear the entire current search term really fast with one shortcut would be an alternative?

wez commented 2 years ago

Thanks! In the mean time, you can use CTRL-u to clear the pattern.

I have a local development branch which restructures the scrollback data structures and dramatically improves search performance; there are still some kinks to work out before I can merge that code.

jemag commented 1 year ago

I have a similar workflow where I always want to start searching from an empty pattern. To clear on a new search, I currently use:

      {
        key = "/",
        mods = "NONE",
        action = act.Multiple({
          act.CopyMode("ClearPattern"),
          act.Search({ CaseSensitiveString = "" }),
        }),
      },

However I cannot seem to clear the pattern when I am entering CopyMode for some reason. Using similar strategy:

    {
      key = "phys:Space",
      mods = "SHIFT|CTRL",
      action = act.Multiple({
        act.ActivateCopyMode,
        act.CopyMode("ClearPattern"),
      }),
    },

Here I cannot clear the search pattern after entering CopyMode

sceneq commented 1 year ago

act.CopyMode does not work after ActivateCopyMode with act.Multiple

act.Multiple {
  act.ActivateCopyMode,
  -- ↓ does not work
  act.CopyMode "MoveToViewportTop",
  act.CopyMode "MoveLeft",
  act.CopyMode "MoveRight",
}

version: 20230408-112425-69ae8472

mstinsky commented 11 months ago

+1 I would also appreciate a config option to set search empty on each new search.

pyinto commented 3 months ago

any updates/solutions on this one?

nickvikeras commented 2 months ago

I'd like this option as well

maceip commented 1 week ago

as a new wezterm user, the reason i switch back to iterm is the search. any time I open a search interstitial i expect it to be blank to start

nickvikeras commented 1 week ago

@maceip if you want to stick with wezterm you can use ctrl-u to clear the search bar as a workaround.