dir - directory browser in vile
perl "use directory"
This is a directory browser written for use within [x]vile using the perl interface. It can be invoked with a directory name as an optional argument. If the directory argument is provided, it lists the contents of that directory. Otherwise it prompts the user for the directory name and defaults to the current directory.
The listing is a two panel output. The left panel contains the list of directories while the right panel contains the list of files. The directory list provides information regarding permissions and owner of each directory listed while the file listing provides the file size in addition to the permissions and owner for the files listed.
Both the lists are color coded to provide at-a-glance information regarding the type of the file or directory. The recognized types are executable files, symlinks to directories and files, block special files, character special files, named pipes, sockets, and broken symlinks.
Additionally, the browser utilized the hyperlink capability of vile to allow traversal to any directory in the listing by a single keypress. To enter a particular directory within a listing, simply press your hyperlink key on the name of the directory or use mouse double-click in xvile. (Personally, I find the <RETURN> key to be the most convenient key as the hyperlink key.) This also means that you can refresh the current directory listing by following the "." directory hyperlink.
The file listing is also hyperlinked such that when a file name hyperlink is followed, depending on the file type clicked on (file type is decided using the file extension) and the mime settings, appropriate application will be invoked to view that file. Which means you can view .gif file in xv by simply clicking on it, and view a .ps file in ghostview by simply clicking on it, and can view a .fm file in framereader by simply clicking on it, and ... :-)
Lastly, the mime library utilized by the directory browser (and provided along with) for handling the mime capabilities is plugin aware (and you thought only netscape can have plugins). Which means that for certain file types, like .gz and .tar, you dont need to take help of an external viewer by can use vile itself to view those files. And the perl interface in vile makes it very simple to write new plugins :-)
A sample plugin script for .gz files is provided along with. For more information on mime library capabilites, please refer to the pod documentation in mime.pl.
When the directory browser changes directory, it changes the current directory as pointed to by the perl environment and hence the current directory as vile knows it does not change. This may cause a little confusion. If you want to change the vile current directory along with the directory browser, please uncomment the appropriate line in the dir.pl file.
1. pod documentation on mime.pl
J. Chris Coppick, once wrote: Having a Perl interpreter in vile is very slick. Kudos to everyone who made it happen.
Kuntal Daftary writes: Amen!
Kuntal Daftary (email@example.com), 1998