Let's say I have the following files in my current directory:
假设我当前目录中有以下文件:
buildBar.bat
buildFoo.bat
buildHouse.bat
And I type the following at my command prompt, ./bu
and then TAB.
然后在命令提示符下键入以下内容:./bu,然后选择TAB。
-
In Bash, it gets expanded to
./build
在Bash中,它扩展为./build
-
In PowerShell, it gets expanded to
./buildBar.bat
-- the first item in the list.在PowerShell中,它扩展为./buildBar.bat - 列表中的第一项。
-
In Cmd, the behavior is the same as PowerShell.
在Cmd中,行为与PowerShell相同。
I prefer the Bash behaviour - is there a way to make PowerShell behave like Bash.
我更喜欢Bash行为 - 有没有办法让PowerShell表现得像Bash。
4 个解决方案
#1
62
New versions of PowerShell include PSReadline, which can be used to do this:
新版本的PowerShell包括PSReadline,可用于执行此操作:
Set-PSReadlineKeyHandler -Key Tab -Function Complete
To make it permanent, put this command into C:\Users\[User]\Documents\WindowsPowerShell\profile.ps1.
要使其永久化,请将此命令放入C:\ Users \ [User] \ Documents \ WindowsPowerShell \ profile.ps1。
#2
14
It is now possible to get PowerShell to do BASH-style completion, using PSReadline. Check out http://www.leeholmes.com/blog/2012/09/13/bash-like-tab-completion-in-powershell/
现在可以使用PSReadline让PowerShell完成BASH样式的完成。查看http://www.leeholmes.com/blog/2012/09/13/bash-like-tab-completion-in-powershell/
#3
13
Take a look here, not really your desiderata:
看看这里,不是你真正的渴望:
PowerTab
but I think is the best tab expansion feature for PowerShell console!!!
但我认为是PowerShell控制台的最佳标签扩展功能!
#4
4
Modify the TabExpansion function to achieve what you want. Remember that perhaps it completes till the end if you press tab again the new suggestion modify from where you originally press the key. I strongly prefer the actual behaviour, I want the line writted as fast as possible. Finally don't forget the wildcard expansion, for example: bu*h[Tab] automatically completes to buildHouse.bat
修改TabExpansion函数以实现您想要的功能。请记住,如果再次按Tab键,它可能会一直完成,新建议会从您最初按键的位置进行修改。我非常喜欢实际行为,我希望尽可能快地写入行。最后不要忘记通配符扩展,例如:bu * h [Tab]自动完成buildHouse.bat
#1
62
New versions of PowerShell include PSReadline, which can be used to do this:
新版本的PowerShell包括PSReadline,可用于执行此操作:
Set-PSReadlineKeyHandler -Key Tab -Function Complete
To make it permanent, put this command into C:\Users\[User]\Documents\WindowsPowerShell\profile.ps1.
要使其永久化,请将此命令放入C:\ Users \ [User] \ Documents \ WindowsPowerShell \ profile.ps1。
#2
14
It is now possible to get PowerShell to do BASH-style completion, using PSReadline. Check out http://www.leeholmes.com/blog/2012/09/13/bash-like-tab-completion-in-powershell/
现在可以使用PSReadline让PowerShell完成BASH样式的完成。查看http://www.leeholmes.com/blog/2012/09/13/bash-like-tab-completion-in-powershell/
#3
13
Take a look here, not really your desiderata:
看看这里,不是你真正的渴望:
PowerTab
but I think is the best tab expansion feature for PowerShell console!!!
但我认为是PowerShell控制台的最佳标签扩展功能!
#4
4
Modify the TabExpansion function to achieve what you want. Remember that perhaps it completes till the end if you press tab again the new suggestion modify from where you originally press the key. I strongly prefer the actual behaviour, I want the line writted as fast as possible. Finally don't forget the wildcard expansion, for example: bu*h[Tab] automatically completes to buildHouse.bat
修改TabExpansion函数以实现您想要的功能。请记住,如果再次按Tab键,它可能会一直完成,新建议会从您最初按键的位置进行修改。我非常喜欢实际行为,我希望尽可能快地写入行。最后不要忘记通配符扩展,例如:bu * h [Tab]自动完成buildHouse.bat