Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add incremental search in commands history #2040

Closed
flashcode opened this issue Nov 5, 2023 · 0 comments
Closed

Add incremental search in commands history #2040

flashcode opened this issue Nov 5, 2023 · 0 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@flashcode
Copy link
Member

flashcode commented Nov 5, 2023

Feature description

Add a way to perform an incremental search in commands history, like Ctrl+R in Bash.
This is similar to the script https://github.com/weechat/scripts/blob/master/python/histsearch.py.

Proposed changes (comments are welcome if you have other ideas):

  • Move current key Ctrl+R (search in buffer lines) to Ctrl+S
  • Add option search_history in command /input, bind default key Ctrl+R on this command
  • Add key context "histsearch" (search in commands history)
  • Default keys in context "search":
    • return: stop search here (unchanged)
    • ctrl-q: stop search and reset scroll to its initial value (unchanged)
    • meta-c: switch case sensitive/insensitive (unchanged)
    • ctrl-x (instead of ctrl-r): toggle between string and regex search
    • ctrl-r or up: search in previous (older) buffer lines
    • ctrl-s or down: search in next (newer) buffer lines
  • Default keys in new context "histsearch": almost the same as context "search":
    • return: stop search and use matching input
    • ctrl-q: stop search and restore input to its initial value
    • meta-c: switch case sensitive/insensitive
    • ctrl-x: toggle between string and regex search
    • ctrl-r or up: search in previous (older) history entries
    • ctrl-s or down: search in next (newer) history entries
    • ctrl-o: execute the command found and put the next one (newer) in input without executing it
  • New key in "default" context:
    • ctrl-o: execute the selected command in history (by using keys up/down or ctrl-up/ctrl-down and put the next one (newer) in input without executing it
  • New option weechat.look.buffer_search_history: enum with values local (default) or global: default search in history: in buffer local history or global history
  • Buffer variable text_search, new possible values are:
    • 0: search disabled
    • 1: search in buffer lines (Ctrl+S)
    • 2: search in commands history (Ctrl+R)
  • New buffer variable text_search_direction: enum, possible values are:
    • 0: search backward
    • 1: search forward
  • New buffer variable text_search_history: enum, possible valued are:
    • 0: none (search not enabled)
    • 1: search in local history
    • 2: search in global history
  • New buffer variable text_search_ptr_history: pointer to history found
  • Display in input: prompt + input + matching history entry, for example:
[Search command (~ str,local)] wee█ => /join #weechat
@flashcode flashcode added the feature New feature request label Nov 5, 2023
@flashcode flashcode added this to the 4.2.0 milestone Nov 5, 2023
@flashcode flashcode self-assigned this Nov 5, 2023
@flashcode flashcode changed the title Incremental search in commands history Add incremental search in commands history Nov 6, 2023
flashcode added a commit that referenced this issue Nov 7, 2023
Changes:

- move key ctrl+r to ctrl+s
- add key ctrl+r to search in commands history
- add option `search_history` in command `/input`
- add key context "histsearch"
- add option weechat.look.buffer_search_history
- add buffer variables "text_search_direction", "text_search_history" and "text_search_ptr_history"
flashcode added a commit that referenced this issue Nov 11, 2023
Changes:

- move key ctrl+r to ctrl+s
- add key ctrl+r to search in commands history
- add option `search_history` in command `/input`
- add key context "histsearch"
- add option weechat.look.buffer_search_history
- add buffer variables "text_search_direction", "text_search_history" and "text_search_ptr_history"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

1 participant