hg-prompt/quickstart/index.html @ 310c8feb5645

hg-prompt: Update documentation.
author Steve Losh <steve@stevelosh.com>
date Tue, 15 Dec 2009 19:53:10 -0500
parents 8698c58f4ce2
children 383887c412c2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
    
    <title>
      hg-prompt ยป Quick Start
    </title>
    
    <link rel="stylesheet" type="text/css" href="/media/css/reset.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="/media/css/layout.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="/media/css/typography.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="/media/css/pygments.css" media="screen, projection" />
  </head>
  
  <body>
    
        <div id="breadcrumbs">
          <p>
              
                
                  <a href="/">index</a> &#187;
                
              
                
                  quickstart
                
              
          </p>
        </div> <!-- div#breadcrumbs -->
      
      
    <div id="content">
      
      
  <h1 id="quick-start">Quick Start</h1>
<p>This guide will get you up and running so you can put some useful information into your shell prompt.</p>
<p>If you haven't already <a href="../installation/">installed</a> it, do that now.</p>
<h2 id="a-simple-but-useful-prompt">A Simple (But Useful) Prompt</h2>
<p>Edit your <code>~/.bashrc</code> file to include something like this:</p>
<div class="codehilite"><pre>hg_ps1<span class="o">()</span> <span class="o">{</span>
    hg prompt <span class="s2">&quot;{ on {branch}}{ at {bookmark}}{status}&quot;</span> 2&gt; /dev/null
<span class="o">}</span>

<span class="nb">export </span><span class="nv">PS1</span><span class="o">=</span><span class="s1">&#39;\u at \h in \w$(hg_ps1)\n$ &#39;</span>
</pre></div>


<p><code>source ~/.bashrc</code> after to test it out.  Make sure you're in a Mercurial repository or you won't see anything.  This little prompt will give you something like this:</p>
<div class="codehilite"><pre><span class="go">steve at myhost in ~/src/hg-prompt on default at feature-bookmark?</span>
<span class="gp">$</span>
</pre></div>


<h2 id="an-advanced-prompt">An Advanced Prompt</h2>
<p>How about something a little more interesting?</p>
<div class="codehilite"><pre>hg_ps1<span class="o">()</span> <span class="o">{</span>
    hg prompt <span class="s2">&quot;{[+{incoming|count}]--&gt;}{root|basename}{/{branch}}{--&gt;[+{outgoing|count}]}{ at {bookmark}}{status}&quot;</span> 2&gt; /dev/null
<span class="o">}</span>

<span class="nb">export </span><span class="nv">PS1</span><span class="o">=</span><span class="s1">&#39;$(hg_ps1)\n\u at \h in \w\n$ &#39;</span>
</pre></div>


<p>And the result (this example assumes one incoming changeset and two outgoing):</p>
<div class="codehilite"><pre><span class="go">[+1]--&gt;hg-prompt/default--&gt;[+2] at feature-bookmark</span>
<span class="go">steve at myhost in ~/src/hg-prompt</span>
<span class="gp">$</span>
</pre></div>


<h2 id="learn-more">Learn More</h2>
<p>From here you can take a look at the <a href="../documentation/">full documentation</a> to see all the interesting things <code>hg-prompt</code> can do.</p>

    
    </div> <!-- div#content -->
    <div id="footer">
        <p>
            
            hg-prompt &mdash;
            
            Powered by <a href="http://bitbucket.org/zacharyvoase/markdoc">Markdoc</a>.
        </p>
    </div>
    
  </body>
</html>