I, like many *nix folks, am used to typing ctrl-d to exit my shell. Most if not all linux commandline tools that have a ‘shell’ support control-d out of it. Whether it’s screen, bash, an ssh session, mail, cat I want to leave.
@wimcoekaerts the latest released version, v0.4.0, supports Ctrl-D
to exit PowerShell (by way of integrating PSReadLine).
Are you sure? I just installed v0.6.0. As per below. I start bash, hit control-d and it exits. I start powershell, hit contr-d and it doesn't.
[root@ol72 ~]# bash
[root@ol72 ~]# exit
[root@ol72 ~]# powershell
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS /root> ^D
: The term '' is not recognized as the name of a cmdlet, function, script fi
le, or operable program. Check the spelling of the name, or if a path was inclu
ded, verify that the path is correct and try again.
At line:1 char:1
+
PS /root>
Ah, let me explain :smile:
The keybindings are controlled by PSReadLine (more specifically, our internal port of it to Linux, that we intend to extract back to the public project as soon as we can do that). PSReadLine's default edit mode is Windows style, where Ctrl-D is unbound.
I believe this is what you're seeing. Set your edit mode to Emacs (Set-PSReadlineOption -EditMode Emacs
), and you'll have the more Bash-like experience where Ctrl-D is bound to DeleteCharOrExit
.
So this is supported, and it's just user preference.
ah setting it to Vi works.
ok. so should we set that as the default for Linux powershell then ?
Now that's the question :smiley:! I've asked @lzybkr, and we think it's probably not a bad idea to do this.
Setting Emacs mode will work too. The question is - what should the default be? I'd say Emacs, I think @jpsnover will agree because we want to make Linux folks happy. The only minor issue is keeping folks coming from Windows happy - but they can just set the mode in their profile.
I think it's consistent with our approach to aliases.
vi or emacs. I don't care i am not religious about that :) I did try emacs and that didn't work Vi did work. let me try in another environment again but I did try both and Vi OK Emacs not :)
Most helpful comment
ah setting it to Vi works.
ok. so should we set that as the default for Linux powershell then ?