I’ve recently started experimenting with PowerTab version 0.98 on one of my systems where I use PowerShell. I hadn’t done this before for quite a few reasons:
- I wanted to work with PowerShell 1.0 without modifications for at least the first little while to see how well it works by itself (suffice it to say that this is the best 1.0 release of a product I have used in a long time).
- Beyond the initial experience with PowerShell 1.0, the built-in tab expansion was meeting my immediate needs when writing one-liners.
- Whenever I would write anything more complex that a one-liner I would do so in an editor that had built-in syntax highlighting and/or intellisense (I say and/or because I’ve been trying out quite a few different script editors), and PowerTab wasn’t available within those editors.
But after listening to Scott Hanselman talk about PowerShell (and PowerTab) on a recent episode of .NET Rocks TV, I figured it was time I install this component that I’ve had sitting in my downloads folder since version 0.91 or so and kick the tires a bit.
While I haven’t used PowerTab for very long yet, so far I can say that PowerTab provides some really nice enhancements over the built-in tab expansion functionality, and if you’re working within the console that ships with PowerShell 1.0 it definitely helps, especially when working with WMI objects and .NET objects directly. The visual browsing functionality it provides will be of greatest benefit to newcomers who don’t know their way around PowerShell, WMI and .NET yet.
That said, there are a few issues I have encountered in the current release, as well as some opportunities for enhancement requests that are worth mentioning. First, the issues:
- If you are viewing the tab expansion window for the current word and you press backspace or Esc, you can’t use tab expansion for that word from that point on. For example, if you type in get-c, press tab, and then once you see your options you press backspace or Esc, tab completion will no longer work for get-c until you use tab expansion for something else.
- If you are viewing the tab expansion window for the current word and you press backspace or Esc, you should be returned to the exact command you started with because you are cancelling out of the option to use tab expansion on that word. This does not work properly for files or directories. When you press backspace or Esc the word has changed. For example, if I am in a folder with nothing but tab.txt and tabexpansion.txt, and I type in “t” and then press the Tab key, I see the two files. If I then press backspace or Esc, the word I entered changes from “t” to the current working directory path with “\t” appended to it (prepended by “& ‘” and appended by “‘” if there is a space in the current working directory).
Now on to the enhancement requests:
- If you are viewing tab expansion options for a file or folder and you press backslash or space, that option should be selected and you should see your backslash or space in the command line. This is necessary to prevent from additional keystrokes being required in the implementation of tab expansion (i.e. this is how it works in DOS and in PowerShell 1.0 when using the tab expansion routine that comes with PowerShell). When you get to know what the minimum path is that you have to type, this can speed things up for you. Having to press enter and then type the backslash is disruptive to how things worked before. For example, using the tab expansion that comes with PowerShell, if I have two folders called “Tab” and “TabExpansion” and I know I want to navigate to the first folder I can type set-location C:\T, press the Tab key, and then press space or backslash depending on what I am doing and it will just continue. If I do the same when using PowerTab it will beep at me when I press space, or it will do nothing when I press backslash. I’d love to see this changed so that space and backslash will properly allow me to continue typing. The same goes for files (although for files backslash doesn’t make sense, but space does).
- Similar to the last one, if you are viewing tab expansion options for a .NET class and you press the right square bracket “]”, the current option should be selected and you should see your .NET class with the “]” character at the end in the command line. Basically I think that if you press any character that is a valid terminator for the item that is showing in the tab expansion option list that the item should be terminated and you should see it with your terminator in the current line of script you are writing.
- When you have a line of script on the screen and you activate tab expansion in the middle of that script, the remainder of that line of script is deleted. This is an issue with tab expansion in the standard command prompt and the tab expansion that comes with PowerShell 1.0. The impact of this issue is much more apparent in PowerShell when working with long one-liners (although you have command history so you can usually go back unless you just typed in a long one-liner from scratch). I’d love to see this fixed with PowerTab, but I think this is beyond the control of what can be done in the TabExpansion function.
That’s about it for now. I’ll continue experimenting with PowerTab and see what else I come across. Kudos to Marc van Orsouw (MOW) for all of his hard work on PowerTab! I look forward to seeing this functionality in PowerShell Plus!
Technorati Tags: PowerShell, PoSh, Poshoholic, PowerTab, PowerShell Plus, Tab Expansion
6 thoughts on “PowerShelling with PowerTab”
great to see your experiences with PowerTab, some info about your remarks :
1) This is a “feature” of PowerShell PowerTab will not be invoked at all, can’t solve this in normal console, but in PSP this will work
2) Yes this is an issueversion 0.99 does easy the pain a bit by featuring relative path completion, you can find the beta here : http://thepowershellguy.com/blogs/posh/pages/powertab-beta.aspx
I will look if I can improve this more later
1) Backslash will work, space will not work as a filename can contain spaces and dots dot and space completion is automatic disabpled on filesystem completion, space will work on other completions, also you can configure this behavour in $powertabconfig:
SpaceComplete : True
DotComplete : True
BackSlashComplete : True
AutoExpandOnDot : True
2) an enter will add the [ automaticly for you
3) this is also a “feature” of PowerSHell I can’t fix in normal console, this also will work in PSP.
Also I will give a demo of PowerTab usage myself 3 oct :
I understand that filenames can contain spaces and that you can hit enter to add the ] for .NET objects automatically. My point is that it means I have to re-learn habits that I have already developed in existing tab expansion in cmd.exe and PowerShell, and I shouldn’t have to. And it’s not consistent with other tab expansion implementations.
In tab expansion you’re looking at existing files or existing folders. Therefore if you have an item selected and you have entered the first three characters of the item and you hit space, PowerTab should check to see if there is an item in the list with space and if not it should use the item that was selected. That maintains the flow that myself (and likely other users) have become accustomed to when using tab expansion in cmd.exe and PowerShell. Similarly, if I hit right-square bracket when looking at the .NET objects, it should apply the selected item, closed with the right-square bracket. Hitting enter just isn’t required in other implementations of tab expansion and it just doesn’t feel right to me.
I’ll take a look at the $powertabconfig variable and experiment with this some more.
Thanks for the quick reply!
I just went to look into the $powertabconfig variable and noticed that I have BackSlashComplete set to true, but it doesn’t seem to be working. I’m using a French keyboard and have my regional settings configured to use French (Canada) – Canadian French, so when I enter a backslash it is entered by pressing the right Alt key and the top left key on the keyboard. I suspect that this is why PowerTab isn’t recognizing when I enter a backslash into the console.
[…] gave some great feetback on his blog : PowerShelling with PowerTab and we exchanged some mail afterwards, resulting in the following changes […]
I was looking to download the PowerTab utility. when I go to download it, the link doesnt’t work. I attempted to find a different download site with no luck. Every site appear to point back to the same location. How can I obtain PowerTab? Thanks
The link at the top of this article should take you to the PowerTab page. I just tested it and it works for me. Here is the actual URL: