elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.72k stars 303 forks source link

'clear' binary on Windows #1858

Open PinkSerenity opened 1 week ago

PinkSerenity commented 1 week ago

What happened, and what did you expect to happen?

When trying to use the clear command, I am faced with the following exception: Exception: exec: "clear": executable file not found in %PATH% Of course, since this is Windows, there is no real clear executable file (at least as far as I know). I have no idea how other shells are doing it, my idea was aliasing clear to cmd /c cls. But I don't know whether it is the right approach.

Considering that this is part of standard shell usage and other shells (like Nushell) have a working clear command as well, I will file it as a bug, but it might as well be a feature request for a out-of-the-box solution on Windows.

Output of "elvish -version"

0.21.0+official

Code of Conduct

burdiyan commented 1 week ago

I bumped into this issue because I tried to do ctrl+l to clear the terminal and I saw Unbound key: Ctrl-L which was quite unfortunate, because I have this shortcut in the muscle memory for so many years, and I'm constantly clearing my terminal with it. I know I can type clear, but I'm not used to it. And turns out that apparently clear also wouldn't work on Windows, which is also a bit sad.

@xiaq Is there some weird inherent complexity with being able to support ctrl+l to clear the terminal in a cross-platform way? I wouldn't be surprised knowing how cursed the world of terminal emulators is :)

PinkSerenity commented 1 week ago

You can easily set custom key bindings, that's not the issue. Also, the readline-binding module does what you want.