Remix.run Logo
JayGuerette 8 hours ago

Also -X or --no-init

" ... desirable if the deinitialization string does something unnecessary, like clearing the screen."

I prefer to not clear the screen. I usually want to continue to refer to something or even copy/paste from the content to my current command line.

Izkata 7 hours ago | parent [-]

And combined with -E, it'll quit immediately if the output is smaller than the terminal size.

...And combined with some of the other options in the post, my go-to has been "less -SEXIER" for a long time. Specifying E twice doesn't seem to do anything except make this easier to remember.

jlokier 4 hours ago | parent | next [-]

I recommend -FX instead of -EX. They both quit immediately if the output is smaller than the screen size, but -FX does not quit if the output is larger and you jump to the end of a large file, so you can continue to do things like scroll back or search.

git uses "less -FRX" by default. This is how I learned about -F.

(To be pedentic, git uses "LESS=FRX less", which accomplishes the same thing.)

marcosdumay 5 hours ago | parent | prev | next [-]

I'm reading it correctly that it will cause less to exit if you scroll until the end of file even if the file is larger than the terminal size?

Izkata 5 hours ago | parent [-]

Yeah; in both cases (text is larger or smaller than terminal) it makes "less" act the same as "more" with auto-exiting.

kccqzy 5 hours ago | parent | prev [-]

I hate -E. Quitting immediately does not do good things to my muscle memory. I’m using to hitting q to quit less when I am done. Now the q key becomes part of the input to the shell prompt (or worse if there’s a different tool invoking less and now q might be interpreted differently by that tool). I value the consistency of user interaction more than saving a keystroke.