Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation to point Windows users to how they can set up basic commands #1858

Open
1 task done
PinkSerenity opened this issue Nov 12, 2024 · 7 comments
Open
1 task done

Comments

@PinkSerenity
Copy link

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
Copy link

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
Copy link
Author

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

@ejrichards
Copy link

ejrichards commented Dec 5, 2024

The command edit:clear clears the screen, no need to call cmd, you can alias it to clear:

fn clear { edit:clear }

If you want to also clear the scrollback, which edit:clear doesn't do:

fn clear { print "\e[H\e[2J\e[3J" }

@PinkSerenity
Copy link
Author

The command edit:clear clears the screen, no need to call cmd, you can alias it to clear:

fn clear { edit:clear }

That is perfect. Thank you very much. Do you also know how to copy a file if cp causes the same exception? Or cat? Are all of these modules?

@ejrichards
Copy link

I'm personally using https://github.com/uutils/coreutils for cp, mkdir, etc. and https://github.com/sharkdp/bat for cat, but you could make aliases to the os: functions for some of the file operations.

@PinkSerenity
Copy link
Author

I'm personally using https://github.com/uutils/coreutils for cp, mkdir, etc. and https://github.com/sharkdp/bat for cat, but you could make aliases to the os: functions for some of the file operations.

So just to clearify, you aliased the functions to coreutils.exe [function]? Because I'm gonna do that as well then. Thank you for your help.

I still leave this open, but I will change the title since I think the documentation might profit from some kind of "Windows Quick-start" that will help setting normal shell commands up.

@PinkSerenity PinkSerenity changed the title 'clear' binary on Windows Improve documentation to point Windows users to how they can set up basic commands Dec 8, 2024
@ejrichards
Copy link

coreutils can be a single binary that you symlink to with the names of the utilities, so I have a ~\.config\elvish\bin with symlinks to the utilities I want to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❓Triage
Development

No branches or pull requests

3 participants