Monday, August 30, 2004

Cygwin complaint

I have a confession to make. I use Windows. Yeah, I know, so just keep your boos and hisses to yourself for a moment.

I also run Cygwin (and MSYS) to allow me to use gcc and other GNU tools which are infinitely useful in my daily work. Cygwin, in case you aren't aware of it, is a Unix-like shell environment that runs on Windows. Within the Cygwin shell (bash) you can pretend you are running on a Unix machine and ps and ls to your heart's content. For what it does, it is pretty nifty, and for what it provides, it is indispensable.

Which is what brings up the next complaint. There is no reason that the Cygwin shell should be less usable than the CMD.exe. Why, then, does Cygwin not provide full directory tab completion?

Tab completion is the feature wherein you can automatically retrieve a filename or directory name by hitting the tab key. In CMD.exe, if you press the tab key you will be presented with the first file in a directory. Hitting tab repeatedly will bring up the next file in succession. By typing a character, you can limit the tab completion search results to only those files that begin with the specified characters. Likewise, if you execute a directory-related command like 'CD' the tab completion engine will only display directories, filtering out files.

The default Cygwin configuration does not have this ability. It has tab completion, but the tab completion is little more than worthless. The Cygwin tab completion engine can only return one filename. To retrieve that filename it is necessary to specify enough leading characters so that the tab completion engine can distinguish the specified file from others with similar leading characters. That means that the full name of a file must be specified in cases where all the leading characters are the same except for an incremented counter at the end.

  • LOGFILE20040801.TXT
  • LOGFILE20040802.TXT
  • LOGFILE20040803.TXT
  • ...
  • LOGFILE20040831.TXT

In order to use Cygwin tab completion on any of the above filenames, it is necessary to type almost the entire filename. It requires typing at least "LOGFILE200408xx" leaving the tab completion to fill in the ".TXT". This is not useful.

CMD.exe allows me to type "LO" and tab completion brings up the first file that begins with the string "lo". Since it is not case-sensitive, I am able to retrieve all files that begin with "lo".

For whatever reason, the better behavior of the CMD.exe shell is not emulated in Cygwin. Why can't Cygwin not act brain-damaged in this situation?

2 Comments:

Blogger Patrick McElhaney said...

Two years later, I'm researching this issue, and came across your blog. Do you know of a way to configure Cygwin to have smarter tab completion?

8:26 AM  
Blogger Lauren Smith said...

Sorry. Unless they've updated it, and I doubt it, the behavior is still the same. On Debian Linux the behavior is similar. Double tabbing will bring up a list of completable filenames, so I suppose you could copy and paste the filename from that list.

In short, it's a quirk that you'll have to get used to.

8:10 PM  

Post a Comment

Links to this post:

Create a Link

<< Home