mprocs icon indicating copy to clipboard operation
mprocs copied to clipboard

Feature Request: Search logs

Open hunterwilhelm opened this issue 5 months ago • 8 comments

Use case: My team and I use mprocs for improved DX with 6 nodejs/bun processes. It allows us to start up our application easier. However, with no search, finding logs can be tedious. Often my workaround if there are too many logs is to shutdown the instance and run it outside of mprocs to search.

Proposed Hotkey: <C-f> (or /) but any hotkey works for me Proposed Command: show-search-logs

Behavior:

Pressing <C-f> would bring up a modal (similar to the show-rename-proc modal) to activate search mode, allowing the user to type a substring. As the substring is typed, mprocs would highlight and jump to the first matching occurrence across all process outputs.

Subsequent presses of <C-f> (or <Enter>) would cycle forward through the matches. Optionally, <C-Shift-f> (or <Shift-Enter>) could be used to cycle backward.

To cancel the search and close the modal, pressing <C-a> would exit search mode and return to the normal view.

Example Workflow:

  1. User presses <C-f>.
  2. A modal prompt appears (e.g., /Search:) at the bottom or top of the terminal, similar to the show-rename-proc modal.
  3. User types "error"mprocs highlights the first occurrence and scrolls to the pane where it's found.
  4. Pressing <C-f> again jumps to the next occurrence in another pane or further down in the same pane.
  5. Pressing <C-a> cancels the search and closes the modal.

Hud

  • Display match count: Match 2 of 7.

Why Useful:

  • Helps me locate logs and errors.
  • Reduces the need to scroll manually through panes.

Can I volunteer to help?

Yes, let me know if this is in line with the goals of mprocs, and if I should make a PR, then I'll start making it.

hunterwilhelm avatar Jul 30 '25 18:07 hunterwilhelm

We certainly need this feature. But I'm currently working on rearranging the code significantly. So merging new PR would be very difficult. Let's wait on the refactoring before any PRs.

pvolok avatar Jul 31 '25 09:07 pvolok

@pvolok Makes sense. I’ll wait until the refactor is completed and for the go-ahead from you.

hunterwilhelm avatar Jul 31 '25 17:07 hunterwilhelm

For anyone looking for a workaround, you can

  • click-and-hold at the start
  • scroll to select your entire log where your error might be
  • press c to copy into another editor to search

hunterwilhelm avatar Aug 01 '25 18:08 hunterwilhelm

Hi @pvolok, just following up on this. How’s the refactor coming along? Once it’s ready, I’m happy to jump in and open a PR right away.

hunterwilhelm avatar Aug 13 '25 15:08 hunterwilhelm

Hi @hunterwilhelm, I am sorry for overlooking your message. If you are still interested, feel free to work on it. I am going to continue to refactor, but for now I will avoid big changes in the architecture. I would advise to incapsulate search logic into a struct SearchState that would accompany vt100::Parser struct. It should be possible to have multiple active searches in the future.

As for the UI, mprocs generally follows vim experience. So the search should be similar to how / search works in vim. Basically:

  • / shows search input at the bottom of the terminal (over the bottom border)
  • C-g and C-t for next/prev match

Let me know if you are going to work on this feature and if you have any questions.

pvolok avatar Sep 21 '25 21:09 pvolok

@pvolok, thank you for the direction. I'll start working on it and I'll keep you updated with any questions I have.

hunterwilhelm avatar Sep 23 '25 14:09 hunterwilhelm

@pvolok I'm copying some of Vim's / search behaviors and wanted to run them by you:

  1. Press / to start a search.
  2. Type your search (regex is enabled by default; type /\V to search as plain text).
  3. Press Enter to perform the search (the search is executed immediately; editing is not possible at this stage).
  4. Use C-g and C-t to navigate to the next/previous match (Vim uses n and N).
  5. Press / to start a new search.
  6. Press the Up Arrow to select previous searches from the history.
  7. Press Esc to exit search mode.

Additional features I’m planning to add:

  • A mode indicator at the top of the terminal (similar to Copy Mode).
  • A status indicator showing the current highlight position and total matches (e.g., 10 of 92).

I’ll proceed with these unless you have any feedback.

hunterwilhelm avatar Sep 25 '25 18:09 hunterwilhelm

@hunterwilhelm Sounds great!

pvolok avatar Sep 25 '25 18:09 pvolok