0

When I use Hyper (with ZSH), there are two ways to clear the terminal: typing clear (which scrolls down to the last line, but don't clear the rest) and doing Cmd+K (which is linked to "Clear Buffer" and do clear the rest).
So, as far as I know, I should be able to write something like alias cls="command to execute Cmd+K" and clear the console the way I want to.

Which is that command? Or is there something like clear I don't know about?

JuanM04
  • 27
  • 2
  • 8
  • Cmd+K isn't input to the shell; it's a command to the terminal emulator. You can't alias it. – chepner Nov 08 '19 at 20:33
  • The only thing `clear` does is write a terminal-dependent byte sequence to standard output (try `clear | hexdump -C`). Terminal emulators are programmed to respond appropriately to such byte sequences, rather than simply print them in the terminal window. Your terminal type (the value of `$TERM`) may not be correct, or possibly a bug in Hyper is being triggered. – chepner Nov 09 '19 at 20:27
  • If you need to clear the scroll buffer, what you need is AppleScript. The shell has no say on whether the terminal emulator wants to keep its buffer, and I'm not aware of any standard escape sequence to ask the terminal emulator to discard its scroll buffer (although individual terminal emulators *may* implement their own custom escape sequences; I'm not aware of such a sequence for Terminal.app or iTerm 2 either). – 4ae1e1 Nov 11 '19 at 15:48
  • @chepner Which TERM should I use? (I'm using MacOS Catalina btw) – JuanM04 Nov 12 '19 at 16:02

0 Answers0