1PRWDRC(5) BSD File Formats Manual PRWDRC(5)
2
4 prwdrc — prwd configuration file
5
7 ~/.prwdrc
8
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
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
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
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 one level deep if you have a complicated directory
112 hierarchy.
113
114 alias *prwd /home/tamentis/projects/prwd
115 alias *prwddoc *prwd/doc
116
117 Since you already define your aliases in your prwdrc file, you might want
118 to use them in your shell. If you prefix your aliases with a '$' and add
119 the following line to your .profile, you will be able to have your
120 aliases available as environment variables. Add this to your profile or
121 shell configuration file:
122
123 eval `prwd -a`
124
125 Then use your aliases like any environment variable:
126
127 cd $py3k
128 Note that ~ is a default alias for prwd.
129
131 Settings are defined with the set command, the first argument is the name
132 of the setting, the second is the value:
133
134 set maxlength [length]
135 This setting is deprecated and was replaced by the -l parameter
136 of the path command. If no template is defined, this will set
137 the path length in the default template.
138
139 set filler [value]
140 This setting is deprecated and was replaced by the -f parameter
141 of the path command. If no template is defined, it sets the path
142 filler/ellipsis in the default template.
143
144 set cleancut [bool]
145 This setting is deprecated and was replaced by the -c parameter
146 of the path command. If no template is defined, it sets the
147 cleancut flag on in the default template, avoiding prwd from cut‐
148 ting path in the middle. For example "...rwd/doc/html" will be
149 returned as ".../doc/html".
150
151 set newsgroup [bool]
152 This setting is deprecated and was replaced by the -n parameter
153 of the path command. If no template is defined, it sets the
154 newsgroup flag on in the default template, shortening the path by
155 only displaying the first letter of each path components. For
156 example "/home/tamentis/projects/prwd/src/nowhere" is turned into
157 "/h/t/p/s/nowhere".
158
159 set mercurial [bool]
160
161 set git [bool]
162 This setting is deprecated and was replaced by the ${branch} com‐
163 mand. If no template was defined, it will add the branch infor‐
164 mation between the hostname and the path in the default template.
165
166 set hostname [bool]
167 This setting is deprecated and was replaced by the ${hostname}
168 command. If no template was defined, it will add the hostname
169 information at the beginning of the default template.
170
171 set uid_indicator [bool]
172 This setting is deprecated and was replaced by the ${uid} com‐
173 mand. If no template was defined, it will add the uid character
174 at the end of the default template.
175
177 This example configuration defines two aliases and a template with the
178 time:
179
180 alias $ports /usr/ports
181 alias $p /home/tamentis/projects
182
183 template "${date} ${hostname}:${branch}${sep :}${path -l 24}${uid} "
184
186 pwd(1), csh(1), ksh(1), sh(1), getcwd(3)
187
189 prwd was written by Bertrand Janin <b@janin.com> and is distributed under
190 an ISC license (BSD compatible, OSI compatible).
191
192BSD June 20, 2019 BSD