You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same with less --pattern=foo (which is really alias for +/foo).
workarounds I discovered:
Pressing RETURN proceeds to show the file content. (Same as "Pattern not found" message behaves after interactive search — just less obvious if the message is all you see at first... I mean, it says "press RETURN" right there in the message, but it hadn't occurred to me 🙈)
less +r --pattern=foo — r does repaint. It may still show "Pattern not found", but at least you'll see (the first screen of) the text.
if your goal of searching is highlighting, not movement, try less +r --pattern='foo|$'. The |$ makes it match the empty string at end of any line, preventing "Pattern not found" (except on entirely empty file). Naturally, it breaks the n/p keys as every line will match.
I still wish paint-before-message was default behavior.
less +r --pattern=foo — r does repaint. It may still show "Pattern not found", but at least you'll see (the first screen of) the text.
^This does the trick for me, thank you so much @cben 👍
Naturally, it breaks the n/p keys as every line will match.
Edit: however matching every line and break n/N feels like another deal breaker 😂
ryenus
changed the title
always show buffer content on start even if pattern specified via CLI matches nothing
[RFE] always show buffer content on start even if pattern specified via CLI matches nothing
May 21, 2024
ryenus
changed the title
[RFE] always show buffer content on start even if pattern specified via CLI matches nothing
[RFE] always show buffer content on start when pattern specified via CLI matches nothing
May 21, 2024
Version: less 580
Currently, in case the search pattern is passed via the command line options, and if there's no match, like the case with the following command:
In this case, upon starting, less doesn't show the buffer content, namely
abc
in this case, instead it only displays the error message:It would be better that the buffer content is also made visible before the above error message is dismissed.
The text was updated successfully, but these errors were encountered: