8

Under Windows, using PowerShell, is it possible to make the filename suggestion (using the Tab key) work like with bash under Linux?

Let's assume a directory contains 3 directories: example1, example and examination.

On Windows (by default), if you type cd ex and Tab, it will auto-suggest cd .\examination. Subsequent uses of Tab will rotate the suggestion between example1, example and examination.

Using bash (typically under Linux), if you type cd ex and Tab, it will auto-complete until the character where the filenames start to differ: cd exam. Another use of Tab then suggests which directories are available:

$ cd exam
examination/ example1/    example2/

Then, if you type p and Tab, it will auto-complete to example, and so on (here, offering a choice between example1 and example2).

Is there a way to make the filename suggestion work in a tree-like search like this, instead of rotating through the names?

(I'm mainly interested in file names. Bash can also refine this selection based on the file type, for example only directories for cd, which would be good, but having the file name selection itself would be enough.)

1

1 Answer 1

5

The default completion behavior is the result of using the command window, which handles keyboard input.

As of PowerShell v3, the ISE is worth considering as a full-time shell, and has modern completion behavior (and colorization!).

If you really want BASH-style completion in a PowerShell command Window, get PSReadline:

https://github.com/lzybkr/PSReadLine

There is an older, less featured, and unmaintained project also called PSReadline here: http://nivot.org/nivot2/post/2012/09/12/Emulating-Bash-GNU-Readline-with-PowerShell-30.aspx http://nivot.org/blog/post/2012/09/12/Emulating-Bash-GNU-Readline-with-PowerShell-30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .