I love Powershell, but coming from a Linux background there is a few things that is really bugging me. Like for example how the default auto completion works.

For example: Get-PS expands to "Get-PSBreakpoint" which is the first matching command. In bash if there is only one command matching bash will expand to the matching command. If there is several hitting tab once does nothing, double tapping tab will show a list of matching commands but not expanding. Is there a way to make Powershell behave like this?

And one other thing, if i have written one line, and moves the marker back to an earlier command (marker is where the ^ is):

"Get-PSS^ | Remove-PSSession" auto completes to "Get-PSSession^", removing all trailing commands. In bash the trailing commands would still be there unaffected. Is there a way to make Powershell not remove the trailing commands when auto completing?

A bonus would be to get CTRL+L to clear the screen. CTRL+A to go to the beginning of the line, and CTRL+E to go to the end of the line.

link|improve this question
I posted an answer to your question but the funny thing is that I arrived on this question because I'm looking for the exact opposite... I want PowerShell style completion in bash :) – Robert S Ciaccio Nov 28 '10 at 0:24
feedback

4 Answers

Maybe you should have a look at Powertab, a customizable PowerShell Tab expansion.

link|improve this answer
1  
Thanks! Powertab really makes tab expansion way better. Still, the issue completing something not at the end of the command is there. – Peter Moberg Nov 3 '10 at 12:22
feedback

PowerShell uses the same console features as the venerable Command Prompt; so you have the usual Home/End, and:

F3 to bring up the previous command
F1 to copy a single character from the previous command
F7 popup history window

...but there's no facility to show all possible completions, as far as I know.

link|improve this answer
This is still very limiting compared to good old bash. For example it is really great being able to type ctrl+r (speedsearch) in bash and just start typing and a matching previous command will show up. – Peter Moberg Nov 11 '10 at 8:24
feedback

hi peter just press F8 for something like speedsearch. It completes with the commands that you run previously that start with what you have in the line. The problem with the deletion of the trailing is annoying, I write a suggestion in Connect regarding the same issue. In the main time you could use Powershell ISE, that behave a little better(don't delete the trailing characters).

link|improve this answer
feedback

PowerShell uses its own parser for commands, so in a sense it is a different shell than cmd.exe, even though they share the same terminal (gui window).

Because of that difference, PowerShell allows you to override the tab-completion functionality with your own function. I haven't had time to mess with this myself, but you basically override the function tabexpansion in your profile, the same way you can override the prompt function.

I found this article, by Lee Holmes (author of the awesome Windows PowerShell Cookbook), that describes a tabexpansion override that is very similar to what you're looking for. You could probably tweak it to give you exactly what you want.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.