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.
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:
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.
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 |
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 ;-)
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:
There are no default enter-key bindings.
Examples: