pfm --- terminal mode file manager for UNIX-systems

Copyright (c) 1995-2003 by peter fuerst

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, as described in the accompaning file COPYING.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the accompaning file COPYING for more details.

Author:
Peter Fürst, post@pfrst.de


Introduction

pfm was largely inspired by Paul R. Culley's PFM.COM (1984) for DOS, which contained in a nutshell (15k) nearly all you needed to navigate the filesystem (in this environment).

And a utility like this, was what i missed under *U*X.

pfm's philosophy is easily explained:

Invoking pfm

There are two different modes to invoke pfm:

	pfm [-C configuration-file]

	pfm -t

In the first mode pfm is invoked the usual way as file manager. Here an optional configuration file may be given by the -C option, to override the default $HOME/.pfm/rc.

In the second mode pfm will just read the keys hit on the keyboard and and report, which key-values or escape sequences will be generated from these keystrokes in curses' various keypad modes. This helps to check the correctnes of termcap/terminfo entries and to adjust these, if necessary.

Input

Hot keys

Usually the keystrokes to use in the current context are displayed in either the top or the bottom menu line. However often there are additional or redundant (to be save on any terminal) keys available (^K stands for ctrl+K in the following):

Escape, ^D, ^X will cancel the current action.

Additional keys in menue mode:
'1'..'9','0' corresponding digit-keys may be used instead of F1..F9,F10
^L redraws the screen
^V restarts curses (the same as receiving SIGWINCH)
Right,'>',Left,'<' rotate top menue
Home,'h' move to top of display
End,'l' move to bottom of display
Down,'j','+' move one line down
Up,'k','-','^' move one line up
PageDown,^F one page down
PageUp,^B one page up

Hints for text input

The Insert-, Delete-, Backspace-, Home-, End- and Arrow-Keys should work as expected.

---

When prompted for text-input, one can use several placeholder-variables to build expressions which reference the current file, directory, etc. Each of these variables will also be generated by a corresponding function key (displayed in the bottom menue).

Variable FKey references
%F F2 filename at cursor-position
%N F1 this filename without suffix
%X F3 this filename's suffix
%A F4 the "alternate" directory, i.e. the directory
that was last left with the chdir hotkey F7
%D F5 current working directory
%H F6 (initial value of) $HOME

One more variable %U can be used, when (and only when) configuring some URL-handler. In this context %U stands for the protocol part of the URL ("//" inclusive), while %F just references the domain/file part.

These variables are also intended for use in the configuration file.

---

The input routine will always present a proposal for the actual input (usually the previous input in the given context). There may be more than one proposal, in this case one may scroll through these with the PageDown, PageUp keys. Also a (error-)message may consist of several parts, through which one may scroll the same way.

---

Any not yet finished input (and so the input-proposal) can be cleared with the ^L (ctrl+L) key-combination.

Mouse input with ncurses

If pfm is built with a ncurses version with mouse interface, a mouse click may be used to pick from a menue or jump to a line in the files window. This interface may be enabled/disabled at runtime (for caveats see manpage curs_mouse(3X)) or may be suppressed completely at compile time by -DIGNORE_MOUSE_EVENTS=1 on the compiler commandline. Please note, that when ncurses has taken over the mouse from (e.g.) xterm, you cannot use xterm's usual mouse facilities (cut and paste).

Note on specifying file destinations

When specifying a destination directory for file operations (copy,move, link,...), a certain syntax must be obeyed:
To file-op some file into directory dir one must type dir/ with a trailing '/'. dir without '/' always means file-op onto file dir. This helps to avoid ambiguities, which may arise, when pfm had to guess what was intended. (And relieves the user from the need to guess, what pfm will guess ;-)

Runtime configuration

The configuration menue

When prompted to define a command, one needs to take into account the two levels of wildcard expansion, which will be performed on the input.

Example: The current directory is /usr/bin, the cursor is positioned there over cmd and $HOME expands to /home/me. Then
the input: %D/%F -f ~/.rc '\%F\\\~'
defines the command pattern: /usr/bin/cmd -f /home/me/.rc '%F\~'
the input: %D/%F -f \~/.rc '\%F\\\~'
defines the command pattern: /usr/bin/cmd -f ~/.rc '%F\~'

which both will be invoked as /usr/bin/cmd -f /home/me/.rc 'myfile.c~' (assumed the cursor is positioned over myfile.c then)

The configuration file

When no other configuration file is given on the commandline (option -C configfile) pfm will use $HOME/.pfm/rc (and create it, if it does not yet exist).

The entries in the configuration file are currently either flags or command-definitions. Leading and trailing whitespace will be stripped from command definitions.

Recognized boolean flag values are True | Yes | 1 | False | No | 0

Commands will be invoked via a system() call, hence their definitions may also contain shell constructs like redirection, etc. Background command must be defined explicitely, pfm will not append a & behind your back.

pfm will write all not-user-defined entries and their default values (builtin or from environment) as comments to the configuration file, so you will find the complete settings there. As of this writing the following entries in the configuration file are recognized:

pfm.DotFiles: boolean-flag
Defines, whether "dot-files" are shown in the directory window. Default is True.


pfm.Mouse: boolean-flag
Ncurses only. Defines, whether ncurses' mouse-event interface should be enabled (if compiled in). Default is False.


pfm.DocDir: help-file-directory
Defines the directory, where pfm's help and documentation files (e.g. this file) are installed. Needed by the help facility. Default is: the directory, where pfm was built (if available), or $HOME/.pfm


pfm.PagerPrg: pagercommand
Defines the pager command, that will be used by the builtin file-viewer for line oriented display or by help. This command must read its input from stdin. Default is: $PAGER or less -dimnu or more -lu (note: no argument-wildcard here).


pfm.Editor: editorcommand arguments
Defines the editor. Default is: $EDITOR '%F' or $VISUAL '%F' or vi '%F'


pfm.Viewer: viewercommand arguments
Defines a command to override the builtin file-viewer. Default is the empty string, i.e. use the builtin viewer.


pfm.Cpdir: copydircommand arguments
Defines the command to be used for (recursivly) copying one directory in/on-to another. The default depends on the OS, e.g. *BUILTIN* -Rdpv '%D' '%A' or cpdir -dv '%D' '%A' .
In this context '%D' and '%A' stand for source and destination respectively. *BUILTIN* stands for a builtin wrapper of "cp -R", which ensures proper handling of the different (intended) relations between source and destination, see Destinations .


pfm.Mailer: mailercommand arguments
Defines the mailer to be used on mailto: links. Default is: $MAILER '%F' or mail '%F'


pfm.UrlHdlr: browsercommand arguments
Defines the command to handle URLs with no specific handler. Default is: $BROWSER '%U%F' or lynx '%U%F'


pfm.Www: browsercommand arguments
Defines the command to handle WWW (http:) links. Default is: $BROWSER '%U%F' or lynx '%U%F'


pfm.Ftp: ftpcommand arguments
Defines the command to handle ftp: links. Default is: ftp '%F'


pfm.Telnet: telnetcommand arguments
Defines the command to handle telnet: links. Default is: telnet '%F'
Note: for all the preceding URL-handlers %F means URL with protocoll part (mailto:, ftp://, ...) stripped, you must use %U to retain it !
pfm.Enter: pattern, modemask, notbefore, notafter, K|C, key|command
(Multiple) enter-key bindings. These entries define an action (menue action on a keystroke or shell command) to be performed on the file at the cursor position, when the enter key is hit and this file meets certain criteria.


In pattern ',', '\', spaces or nonprintable chars (or digits following any of these) must be coded as octal escape sequence: \ddd


modemask is like ls's mode output. Trailing sequences of '?' can be abbreviated with a '*'


Time values can be given as yyyy mm|monthname dd hh:mm:ss or as seconds since The Epoch.


key is either a single printable non-space character or octal number \ddd (with at least two digits).

There are no default enter-key bindings.

Examples:

pfm.Enter: , dr?x???????, 1970 Jan 1 01:00:00, 0x7fffffff, K, S
here the enter-key will trigger a S-keystroke, i.e. the Show command in main menue (this in turn is chdir for directories) on the user-readable and -searchable directory at the cursor postion, which was last modified between the start of The Epoch and 2038.
 
pfm.Enter: *.html, -r?????????, 0, 2030 12 31 23:59:00, C, lynx '%F'
here the enter-key will invoke lynx on the regular user-readable file at the cursor position with suffix .html, which was last modified between the start of The Epoch and Dec 31 2030.