<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rainer Endres</title>
	<atom:link href="http://physos.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://physos.com</link>
	<description>sysadmin pro, scripting pro, coding amateur, geek</description>
	<lastBuildDate>Thu, 04 Aug 2011 11:49:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Desktop Summit: beer and vegan food</title>
		<link>http://physos.com/2011/08/04/135/</link>
		<comments>http://physos.com/2011/08/04/135/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 10:49:09 +0000</pubDate>
		<dc:creator>Rainer</dc:creator>
				<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://physos.com/?p=135</guid>
		<description><![CDATA[Should you visit Desktop Summit and Berlin the coming week(end) you might be interested in some things I found while planning my stay. 15. Internationales Bierfestival: 300 breweries from 86 countries, 2,000 different beer specialities, 18 stages with live music and performances, free admittance. Anything else to say? :) 2011-08-05 &#8211; 2011-08-07 (Fri: 12-24 Sat: [...]]]></description>
			<content:encoded><![CDATA[<p>Should you visit Desktop Summit and Berlin the coming week(end) you might be interested in some things I found while planning my stay.</p>
<ul>
<li><a href="http://www.bierfestival-berlin.de/eng.html">15. Internationales Bierfestival</a>:  300 breweries from 86 countries, 2,000 different beer specialities, 18 stages with live music and performances, free admittance. Anything else to say? :)  2011-08-05 &#8211; 2011-08-07 (Fri: 12-24 Sat: 10-24 Sun: 10-22)</li>
<li>For the vegan Android users out there I stumbled over an app with nice tipps and search function for restaurants. <a href="https://market.android.com/details?id=org.berlin_vegan.bvapp">Berlin Vegan Guide</a></li>
</ul>
<p>I read something about the Fernsehturm being closed, but I can not find it anymore, so not sure about it. </p>
<p>I am looking forward to a week in Berlin meeting friends and meeting so many OSS people at the Desktop Summit. </p>
<p>Have a nice trip to Berlin.</p>
<p><img src="https://www.desktopsummit.org/sites/www.desktopsummit.org/files/DS2011banner.png" alt="DS 2011 banner" /> </p>
<p>Update: I should stop drafting blogs at 3 in the morning :) corrected the dates. Thank you for spotting this. </p>
]]></content:encoded>
			<wfw:commentRss>http://physos.com/2011/08/04/135/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My custom ZSH prompt</title>
		<link>http://physos.com/2010/09/24/my-custom-zsh-prompt/</link>
		<comments>http://physos.com/2010/09/24/my-custom-zsh-prompt/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 20:19:27 +0000</pubDate>
		<dc:creator>Rainer</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[ZSH]]></category>

		<guid isPermaLink="false">http://physos.com/?p=32</guid>
		<description><![CDATA[Some time ago, I posted my bash prompt. Since I am mostly using ZSH these days, I ported my prompt to ZSH and added some extras. After the old prompt was pretty popular I publish the new one in case somebody is interested. &#8220;physos&#8221; prompt theme: &#8220;physosvcs&#8221; prompt theme: Both themes are based on the [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, <a href="http://physos.org/2006/07/12/bash-prompting/">I posted my bash prompt</a>. Since I am mostly using <a href="http://www.zsh.org">ZSH</a> these days, I ported my prompt to ZSH and added some extras. After the old prompt was pretty popular I publish the new one in case somebody is interested. </p>
<p>&#8220;physos&#8221; prompt theme:</p>
<div id="attachment_55" class="wp-caption alignnone" style="width: 261px"><a href="http://physos.com/wp-content/uploads/physos_prompt.png"><img class="size-full wp-image-55" title="preview of the physos zsh prompt theme" src="http://physos.com/wp-content/uploads/physos_prompt.png" alt="preview of the physos ZSH prompt theme" width="251" height="38" /></a><p class="wp-caption-text">A preview of the physos zsh prompt theme</p></div>
<p>&#8220;physosvcs&#8221; prompt theme:</p>
<div id="attachment_56" class="wp-caption alignnone" style="width: 498px"><a href="http://physos.com/wp-content/uploads/physosvcs_prompt.png"><img class="size-full wp-image-56" title="A preview of the physos VCS ZSH prompt theme" src="http://physos.com/wp-content/uploads/physosvcs_prompt.png" alt="A preview of the physos VCS ZSH prompt theme" width="488" height="40" /></a><p class="wp-caption-text">A preview of the physos zsh prompt theme with version control support</p></div>
<p>Both themes are based on the prompt theming included with ZSH. I got most of the syntax from the ZSH manpages (mainly zshcontrib(1) for the theming and VCS informations and zshmisc(1) for the prompt formatting)</p>
<h3>Install Instructions</h3>
<p>To install my prompt:</p>
<ol>
<li>download the prompt files:<br />
            <a href="http://physos.com/wp-content/uploads/zsh_prompt_physos_1.1.tar.gz">Archive of the physos and physosvcs ZSH prompt themes</a>
        </li>
<li>copy or link the prompt_physos*_setup files to <code>/usr/share/zsh/[ZSH version here]/functions/</code>
        </li>
<li>Test it with:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> autoload <span style="color: #660033;">-U</span> promptinit
<span style="color: #000000; font-weight: bold;">%</span> prompt <span style="color: #660033;">-p</span> physos  <span style="color: #666666; font-style: italic;"># This gives you a preview of the prompt</span>
<span style="color: #000000; font-weight: bold;">%</span> prompt <span style="color: #660033;">-h</span> physos  <span style="color: #666666; font-style: italic;"># This gives you the help page</span></pre></div></div>

</li>
<li>
<p>Since the <code>-s</code> option of the <code>prompt</code> tool is not working yet, add the following lines to your <code>.zshrc</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">autoload <span style="color: #660033;">-Uz</span> vcs_info</pre></div></div>

<p>if you want to use the VCS version of the prompt and</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">setopt prompt_subst
autoload <span style="color: #660033;">-U</span> promptinit
promptinit
prompt physos green white blue black</pre></div></div>

</li>
</ol>
<h3>Code</h3>
<p>I will highlight the significant parts. I learned most of the syntax from looking into other prompt_*_setup files, and the man pages.</p>
<div class="toggleme">
<p><a href="#">Show</a> the <code>prompt_physos_setup</code> code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># physos ZSH prompt theme by &lt;rainer@physos.com&gt;</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;">#</span>
prompt_physos_help <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;'EOH'
&nbsp;
General Look
&nbsp;
  [user@host][12:34]
  [~/] %                                                                                                                      
Options
&nbsp;
  You can change the colours of the theme.
&nbsp;
  % prompt physos [&lt;colour1&gt; [&lt;colour2&gt; [&lt;colour3&gt; [&lt;colour4&gt; ]]]]
&nbsp;
                 colour1 : [user@host] 
                 colour2 : [24:00] (time)
                 colour3 : [~/dir/] (pwd)
		 colour4 : command
&nbsp;
  The defaults are green, white, blue, black respectively and
  work best with a white background.
&nbsp;
  Note:
    The default &quot;white&quot; for the time relies on your terminal
    foreground colour with ID 8 to be configured as &quot;grey&quot;.
&nbsp;
Example
&nbsp;
  prompt physos red magenta blue
&nbsp;
EOH</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
prompt_physos_setup <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Initialization</span>
&nbsp;
  <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #660033;">-A</span> pc
&nbsp;
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${1:-'green'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'time'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${2:-'white'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'pwd'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${3:-'blue'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'com'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${4:-'black'}</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># %F{$pc['colour']} to allow for colour configuration</span>
  <span style="color: #007800;">PROMPT</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['user']}[%n@%m]%F{<span style="color: #007800;">$pc</span>['time']}[%T]%f<span style="color: #007800;">$prompt_newline</span>%F{<span style="color: #007800;">$pc</span>['pwd']}[%~/] %# %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Use %_ to show why you are in a continued prompt</span>
  <span style="color: #007800;">PROMPT2</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%_&gt; %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
prompt_physos_setup <span style="color: #ff0000;">&quot;$@&quot;</span></pre></td></tr></table></div>

</div>
<p>The <code>prompt_physos_help()</code> function is called when you execute <code>prompt -h physos</code>. Simple enough. </p>
<p>The <code>prompt_physos_setup()</code> function is responsible for doing all the real work.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>40
41
42
43
44
45
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #660033;">-A</span> pc
&nbsp;
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${1:-'green'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'time'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${2:-'white'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'pwd'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${3:-'blue'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'com'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${4:-'black'}</span></pre></td></tr></table></div>

<p>Here I initialize and fill an array to make color switching a bit less cumbersome in the final prompt. <code>${1:-'green'}</code> reads the first argument given when the prompt is called and defaults to <code>'green'</code> if no argument is given.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>49
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #007800;">PROMPT</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['user']}[%n@%m]%F{<span style="color: #007800;">$pc</span>['time']}[%T]%f<span style="color: #007800;">$prompt_newline</span>%F{<span style="color: #007800;">$pc</span>['pwd']}[%~/] %# %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span></pre></td></tr></table></div>

<p>The prompt. Let us have a look at an uncolored version:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #007800;">PROMPT</span>=<span style="color: #ff0000;">&quot;[%n@%m][%T]<span style="color: #007800;">$prompt_newline</span>[%~/] %# &quot;</span></pre></div></div>

<p>The &#8220;<code>%</code>&#8221; is the escape character in the prompt. You can find all special prompt<br />
commands in the <code>zshmisc(1)</code> manpage. </p>
<dl>
<dt><code>%n</code></dt>
<dd>The username from <code>$USERNAME</code></dd>
<dt><code>%m</code></dt>
<dd>Hostname up to the first &#8220;.&#8221; or with %2m up to the second &#8220;.&#8221;, and so on.</dd>
<dt><code>%T</code></dt>
<dd>The time in 24-hour format (15:00). &#8220;%*&#8221; gives you 24h+seconds (15:00:00)</dd>
<dt><code>$prompt_newline</code></dt>
<dd>The stout alternative to &#8220;<code>\n</code>&#8221; in other prompts.</dd>
<dt><code>%~</code></dt>
<dd>shows <code>$PWD</code> and replaces <code>$HOME</code> with &#8220;~&#8221;</br><br />
      one alternative is <code>%/</code> which does no replacement. Both can be truncated on both ends.
  </dd>
<dt><code>%#</code></dt>
<dd>resolves to &#8220;#&#8221; for a privleged user (i.e. root) and &#8220;%&#8221; for nurmal user. </dd>
</dl>
<p>When you add colour handling everything looks a bit confusing, but it works.</p>
<dl>
<dt>%F{colour}</dt>
<dd>Switch to a named colour</dd>
<dt>%f</dt>
<dd>Switch off any colour</dd>
</dl>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>52
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #007800;">PROMPT2</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%_&gt; %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span></pre></td></tr></table></div>

<p>The &#8220;continuation prompt&#8221;</p>
<dl>
<dt>%_</dt>
<dd>shows why the prompt was continued. For example an uncomplete loop.</dd>
</dl>
<div id="attachment_90" class="wp-caption alignnone" style="width: 250px"><a href="http://physos.com/wp-content/uploads/zsh_prompt_continue_demo_tiny.gif"><img src="http://physos.com/wp-content/uploads/zsh_prompt_continue_demo_tiny.gif" alt="continue prompt demo" title="continue prompt demo" width="240" height="192" class="size-full wp-image-90" /></a><p class="wp-caption-text">prompt continuation demo</p></div>
<h3>Version Control</h3>
<div class="toggleme">
<p><a href="#">Show</a> the <code>prompt_physosvcs_setup</code> code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># physos ZSH prompt theme by &lt;rainer@physos.com&gt;</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;">#</span>
prompt_physosvcs_help <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;'EOH'
&nbsp;
General Look
&nbsp;
  [user@host][12:34]
  [~/] %                               [vcs|branch-revision]                                                                                       
Options
&nbsp;
  You can change the colours of the theme.
&nbsp;
  % prompt physosvcs [&lt;colour1&gt; [&lt;colour2&gt; [&lt;colour3&gt; [&lt;colour4&gt; ]]]]
&nbsp;
                 colour1 : [user@host] 
                 colour2 : [24:00] (time)
                 colour3 : [~/dir/] (pwd)
		 colour4 : command
&nbsp;
  The defaults are green, white, blue, black respectively and
  work best with a white background.
&nbsp;
  Note:
    The default &quot;white&quot; for the time relies on your terminal
    foreground colour with ID 8 to be configured as &quot;grey&quot;.
&nbsp;
  Note:
    The VCS display uses colour3.
&nbsp;
Example
&nbsp;
  prompt physosvcs red magenta blue
&nbsp;
EOH</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
prompt_physosvcs_setup <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Initialization</span>
&nbsp;
  <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #660033;">-A</span> pc
&nbsp;
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${1:-'green'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'time'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${2:-'white'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'pwd'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${3:-'blue'}</span>
  pc<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'com'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${4:-'black'}</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># zstyle setup of the vcs_info display</span>
<span style="color: #666666; font-style: italic;"># Information in &quot;man zshcontrib&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># check for changes in the git repository</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;"># can be slow, comment it out if you encounter delays</span>
  zstyle <span style="color: #ff0000;">':vcs_info:git:*'</span> check-for-changes <span style="color: #c20cb9; font-weight: bold;">true</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Format when some action is going on in </span>
<span style="color: #666666; font-style: italic;"># your repository (rebranch,merge conflict, ...)</span>
<span style="color: #666666; font-style: italic;">#</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> actionformats \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}[%s|%b|%a]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> actionformats \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%c %u [%s|%b|%a]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
<span style="color: #666666; font-style: italic;"># Default format: [git|master]  </span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> formats       \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}[%s|%b]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
  zstyle <span style="color: #ff0000;">':vcs_info:git:*'</span> formats       \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%c %u [%s|%b]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Different branch formats</span>
<span style="color: #666666; font-style: italic;"># [svn|www-1173739]</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> branchformat <span style="color: #ff0000;">'%b-%r'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Used VCS use </span>
<span style="color: #666666; font-style: italic;"># %  vcs_info_printsys </span>
<span style="color: #666666; font-style: italic;"># for supported systems </span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> <span style="color: #7a0874; font-weight: bold;">enable</span> <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">cvs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># get vcs_info to collect informations</span>
  precmd<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> 
&nbsp;
    vcs_info
&nbsp;
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #666666; font-style: italic;"># %F{$pc['colour']} to allow for color configuration</span>
  <span style="color: #007800;">PROMPT</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['user']}[%n@%m]%F{<span style="color: #007800;">$pc</span>['time']}[%T]%f<span style="color: #007800;">$prompt_newline</span>%F{<span style="color: #007800;">$pc</span>['pwd']}[%~/] %# %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Use %_ to show why you are in a continued prompt</span>
  <span style="color: #007800;">PROMPT2</span>=<span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%_&gt; %F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Print the VCS info</span>
  <span style="color: #007800;">RPROMPT</span>=<span style="color: #ff0000;">'${vcs_info_msg_0_}'</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
prompt_physosvcs_setup <span style="color: #ff0000;">&quot;$@&quot;</span></pre></td></tr></table></div>

</div>
<p>The physosvcs prompt uses the vcs_info() function included with current ZSH versions (zshcontrib(1)).</p>
<p>Here are the important changes:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>79
80
81
82
83
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  precmd<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span> 
&nbsp;
    vcs_info
&nbsp;
  <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>91
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #007800;">RPROMPT</span>=<span style="color: #ff0000;">'${vcs_info_msg_0_}'</span></pre></td></tr></table></div>

<p>First I load the vcs_info() function and in the second part I print the output of the function. Easy, isn&#8217;t it? The output ends up in $RPROMPT which is printed by ZSH on the right side of the terminal and automatically hidden when my commands become to long.</p>
<p><a href="http://physos.com/wp-content/uploads/zsh_git_prompt_tiny.gif"><img src="http://physos.com/wp-content/uploads/zsh_git_prompt_tiny.gif" alt="ZSH git prompt" title="ZSH git prompt" width="480" height="176" class="alignnone size-full wp-image-104" /></a></p>
<p>The output is assembled and formatted using zstyle commands.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># zstyle setup of the vcs_info display</span>
<span style="color: #666666; font-style: italic;"># Information in &quot;man zshcontrib&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># check for changes in the git repository</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;"># can be slow, comment it out if you encounter delays</span>
  zstyle <span style="color: #ff0000;">':vcs_info:git:*'</span> check-for-changes <span style="color: #c20cb9; font-weight: bold;">true</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Format when some action is going on in </span>
<span style="color: #666666; font-style: italic;"># your repository (rebranch,merge conflict, ...)</span>
<span style="color: #666666; font-style: italic;">#</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> actionformats \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}[%s|%b|%a]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> actionformats \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%c %u [%s|%b|%a]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
<span style="color: #666666; font-style: italic;"># Default format: [git|master]  </span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> formats       \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}[%s|%b]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
  zstyle <span style="color: #ff0000;">':vcs_info:git:*'</span> formats       \
    <span style="color: #ff0000;">&quot;%F{<span style="color: #007800;">$pc</span>['pwd']}%c %u [%s|%b]%F{<span style="color: #007800;">$pc</span>['com']}&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Different branch formats</span>
<span style="color: #666666; font-style: italic;"># [svn|www-1173739]</span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> branchformat <span style="color: #ff0000;">'%b-%r'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Used VCS use </span>
<span style="color: #666666; font-style: italic;"># %  vcs_info_printsys </span>
<span style="color: #666666; font-style: italic;"># for supported systems </span>
  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> <span style="color: #7a0874; font-weight: bold;">enable</span> <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">cvs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span></pre></td></tr></table></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  zstyle <span style="color: #ff0000;">':vcs_info:git:*'</span> check-for-changes <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p>The first zstyle command allows to look for local changes to a git repository.</p>
<p>The second and third are defining the actual output.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #ff0000;">&quot;[%s|%b|%a]&quot;</span></pre></div></div>

<p>This format is used when there is an action going on or needed (i.e. a merge)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #ff0000;">&quot;[%s|%b]&quot;</span></pre></div></div>

<p>This format is used without an action.</p>
<p><code>git</code> is a bit special since vcs_info() can show staged (<code>%c</code>) and unstaged (<code>%u</code>) changes.</p>
<dl>
<dt>%s</dt>
<dd>the VCS in use in the curent directory</dd>
<dt>%b</dt>
<dd>Information about the current branch (revision, branch, etc.; see below)</dd>
<dt>%a</dt>
<dd>the action</dd>
</dl>
<p>The <code>%b</code> from the general format can be configured in more detail in the <code>branchformat</code> lines.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>74
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> branchformat <span style="color: #ff0000;">'%b-%r'</span></pre></td></tr></table></div>

<dl>
<dt>%b</dt>
<dd>the branch name</dd>
<dt>%r</dt>
<dd>the current revision number</dd>
</dl>
<p>As is said in the comments, more information about the zstyle commands and complete placeholder lists can be found in the zshcontrib(1) manpage.</p>
<p>The final zstyle command is probably one you want to edit.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  zstyle <span style="color: #ff0000;">':vcs_info:*'</span> <span style="color: #7a0874; font-weight: bold;">enable</span> <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">cvs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span></pre></div></div>

<p>Here you can enable (or disable) the VCS systems you want to use. &#8220;<code>vcs_info_printsys</code>&#8221; on the commandline gives you a list of supported VCS. When I was writing this it gave me:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">## list of supported version control backends:                                               </span>
<span style="color: #666666; font-style: italic;">## disabled systems are prefixed by a hash sign (#)                                          </span>
<span style="color: #666666; font-style: italic;">#bzr                                                                                         </span>
<span style="color: #666666; font-style: italic;">#cdv                                                                                         </span>
<span style="color: #c20cb9; font-weight: bold;">cvs</span>                                                                                          
<span style="color: #666666; font-style: italic;">#darcs                                                                                       </span>
<span style="color: #c20cb9; font-weight: bold;">git</span>                                                                                          
<span style="color: #666666; font-style: italic;">#hg                                                                                          </span>
<span style="color: #666666; font-style: italic;">#mtn                                                                                         </span>
<span style="color: #666666; font-style: italic;">#p4                                                                                          </span>
<span style="color: #666666; font-style: italic;">#svk                                                                                         </span>
<span style="color: #c20cb9; font-weight: bold;">svn</span>                                                                                          
<span style="color: #666666; font-style: italic;">#tla                                                                                         </span>
<span style="color: #666666; font-style: italic;">## flavours (cannot be used in the enable or disable styles; they                            </span>
<span style="color: #666666; font-style: italic;">## are enabled and disabled with their master [git-svn -&gt; git])                              </span>
<span style="color: #666666; font-style: italic;">## they *can* be used contexts: ':vcs_info:git-svn:*'.                                       </span>
git-p4                                                                                       
<span style="color: #c20cb9; font-weight: bold;">git-svn</span></pre></div></div>

<p>Feel free to activate the ones you use. If you have zstyle patches for your prefered VCS please <a href="mailto:rainer@physos.com">send them my way</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://physos.com/2010/09/24/my-custom-zsh-prompt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>First Step</title>
		<link>http://physos.com/2010/09/17/first-step/</link>
		<comments>http://physos.com/2010/09/17/first-step/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 11:12:29 +0000</pubDate>
		<dc:creator>Rainer</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[websites]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://physos.com/?p=3</guid>
		<description><![CDATA[&#8220;A beginning is the time for taking the most delicate care that the balances are correct.&#8221; from Manual of Muad&#8217;Dib by the Princess Irulan (from Dune by Frank Herbert) I am working on some &#8220;orphaned for to long&#8221; programming projects. Some are going to end up as new webpages, some are going to be my [...]]]></description>
			<content:encoded><![CDATA[<p><cite>&#8220;A beginning is the time for taking the most delicate care that the balances are correct.&#8221;</cite> <br /><span style="font-size:0.7em">from Manual of Muad&#8217;Dib by the Princess Irulan (from Dune by Frank Herbert)</span></p>
<p>I am working on some &#8220;orphaned for to long&#8221; programming projects. Some are going to end up as new webpages, some are going to be my first published programs and some are just playgrounds for my own hard disk. Sparked by a friends interest in Qt I restored some backups and blew the dust away from some books.</p>
<p>So I invite you to follow my journey back into the lands of Qt and KDE programming and my adventures in system administration. </p>
]]></content:encoded>
			<wfw:commentRss>http://physos.com/2010/09/17/first-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

