1PRWDRC(5)                   BSD File Formats Manual                  PRWDRC(5)
2

NAME

4     prwdrc — prwd configuration file
5

SYNOPSIS

7     ~/.prwdrc
8

DESCRIPTION

10     The prwdrc file describes the template and various attributes affecting
11     the behavior of prwd. The configuration file has the following format:
12
13     Empty lines and lines starting with `#' are comments, otherwise a line is
14     of the format ``keyword arguments...''.  Configuration arguments may be
15     separated by whitespace.  Arguments may optionally be enclosed in double
16     quotes (") in order to represent arguments containing spaces.
17
18     The possible keywords and their meanings are as follows:
19
20     alias [name] [path]
21             Defines a new alias which could be used as a path shortener (see
22             path in the TEMPLATE COMMANDS section) and as a shortcut (see
23             prwd(1) and its -a parameter).  The name defines the short key
24             used as replacement to the path.  See the ALIASES section below
25             for a more complete description.
26
27     set [key] [value]
28             Sets the global configuration parameter key to value.  See the
29             GLOBAL SETTINGS section below for a complete list of settings and
30             their impact on prwd.
31
32     template [value]
33             Defines your shell prompt template.  See the section below.
34

TEMPLATE SYNTAX

36     prwdrc has a simple templating language with a few small commands provid‐
37     ing basic information about your shell context.  All the commands start
38     with ``${`` and end with ``}'', within these brackets the syntax uses
39     flags and is very similar to standard UNIX tools.
40
41     Here is a simple template definition:
42
43           template "${path -l 20}> "
44
45     This simple template returns your current path, up to 20 characters and a
46     static "> " suffix.
47

TEMPLATE COMMANDS

49     The following commands available to customize your shell prompt:
50
51     path [-nc] [-l length] [-f filler]
52             Returns the current path (similar to the pwd command).  The com‐
53             mand-line options are as follows:
54
55             -n      Return the current path using a USENET/newsgroup-style
56                     naming convention, i.e.  only use the first letters of
57                     each path component.
58
59             -c      Attempt to keep all the path components intact (cut at
60                     the slash).
61
62             -l length
63                     Length of the final path output, including any possibly
64                     ellipsis/filler.  Default: 24
65
66             -f filler
67                     String to use as ellipsis/filler on trimmed paths.
68                     Default: "..."
69
70     branch  Display the current branch if you happen to be in a mercurial or
71             git repository.
72
73     date [format]
74             Returns the current date/time using the provided format.  See
75             strftime(3) for more information on the format.
76
77     hostname [-l]
78             Returns the current short hostname (up until the first dot).  If
79             the -l parameters is given, this command returns the long host‐
80             name.
81
82     uid     Returns the ``$'' character if the user has UID != 0 and ``#''
83             otherwise.  This is typically used at the end of a template, just
84             before the trailing space.
85
86     sep [value]
87             Define an optional separator.  If the token immediately before
88             the sep command is empty, the value of the separator is not
89             returned.  This is useful on prompts featuring some items that
90             could be empty from time to time (e.g.  branch).
91

ALIASES

93     If you use the path command in your prompt, defining aliases will allow
94     path to shorten the paths using your own defined keywords.  For example:
95
96           alias *prwd /home/tamentis/projects/prwd
97
98     If you are in "/home/tamentis/projects/prwd/doc/html/", prwd would return
99     "*prwd/doc/html".  If you have spaces in your directories, you can wrap
100     your path parameters with double quotes:
101
102           alias windocs "/mnt/Windows XP/My Documents/"
103
104     You can define multiple values for a single alias, prwd will pick the one
105     with an existing path. This allows you to share your configuration on
106     different machines and use the same shortened alias, for example:
107
108           alias *prwd /home/tamentis/projects/prwd
109           alias *prwd /Users/tamentis/projects/prwd
110
111     Aliases can be nested if you have a complicated directory hierarchy.
112
113           alias *prwd /home/tamentis/projects/prwd
114           alias *prwddoc *prwd/doc
115
116     Since you already define your aliases in your prwdrc file, you might want
117     to use them in your shell.  If you prefix your aliases with a '$' and add
118     the following line to your .profile, you will be able to have your
119     aliases available as environment variables.  Add this to your profile or
120     shell configuration file:
121
122           eval `prwd -a`
123
124     Then use your aliases like any environment variable:
125
126           cd $py3k
127     Note that ~ is a default alias for prwd.
128

GLOBAL SETTINGS

130     Settings are defined with the set command, the first argument is the name
131     of the setting, the second is the value:
132
133     set maxlength [length]
134             This setting is deprecated and was replaced by the -l parameter
135             of the path command.  If no template is defined, this will set
136             the path length in the default template.
137
138     set filler [value]
139             This setting is deprecated and was replaced by the -f parameter
140             of the path command.  If no template is defined, it sets the path
141             filler/ellipsis in the default template.
142
143     set cleancut [bool]
144             This setting is deprecated and was replaced by the -c parameter
145             of the path command.  If no template is defined, it sets the
146             cleancut flag on in the default template, avoiding prwd from cut‐
147             ting path in the middle.  For example "...rwd/doc/html" will be
148             returned as ".../doc/html".
149
150     set newsgroup [bool]
151             This setting is deprecated and was replaced by the -n parameter
152             of the path command.  If no template is defined, it sets the
153             newsgroup flag on in the default template, shortening the path by
154             only displaying the first letter of each path components.  For
155             example "/home/tamentis/projects/prwd/src/nowhere" is turned into
156             "/h/t/p/s/nowhere".
157
158     set mercurial [bool]
159
160     set git [bool]
161             This setting is deprecated and was replaced by the ${branch} com‐
162             mand.  If no template was defined, it will add the branch infor‐
163             mation between the hostname and the path in the default template.
164
165     set hostname [bool]
166             This setting is deprecated and was replaced by the ${hostname}
167             command.  If no template was defined, it will add the hostname
168             information at the beginning of the default template.
169
170     set uid_indicator [bool]
171             This setting is deprecated and was replaced by the ${uid} com‐
172             mand.  If no template was defined, it will add the uid character
173             at the end of the default template.
174

EXAMPLE

176     This example configuration defines two aliases and a template with the
177     time:
178
179           alias $ports /usr/ports
180           alias $p /home/tamentis/projects
181
182           template "${date} ${hostname}:${branch}${sep :}${path -l 24}${uid} "
183

SEE ALSO

185     pwd(1), csh(1), ksh(1), sh(1), getcwd(3)
186

AUTHORS

188     prwd was written by Bertrand Janin <b@janin.com> and is distributed under
189     an ISC license (BSD compatible, OSI compatible).
190
191BSD                            December 31, 2019                           BSD
Impressum