konradsz / igrep

Interactive Grep
MIT License
657 stars 17 forks source link

[feature request] edit the pattern in the intermediate window #44

Closed florianhumblot closed 1 year ago

florianhumblot commented 1 year ago

Since the pattern is the second argument in the invocation of igrep, editing the pattern from the command line can become frustrating if you have a long path:

ig pattern /etc/some/long/path/to/a/file/somewhere/else

it would be nice if you could change the pattern inside of igrep's window with results. Another solution I could imagine is if it was possible to pass the pattern as a named argument rather than positional so that it could be appended:

ig /etc/some/long/path/to/a/file/somewhere/else --pattern mypattern

konradsz commented 1 year ago

Hi, thanks for your suggestion. I will try to modify existing F5 keybind, so it displays a pop-up with a current pattern with an option to change it - hopefully it is doable in a TUI crate igrep is built upon. Your alternative solution seems to be easier to implement at first glance, but it might be actually quite tricky to interpret whether the first argument is a pattern or a path. I will give it a go anyway if the first attempt fails.

florianhumblot commented 1 year ago

amazing fix @konradsz thanks for the quick addition!

konradsz commented 1 year ago

Enjoy! I am going to release new version with this feature soon if you prefer using prebuilt version :)