hg-prompt/quickstart/index.html @ 3f3e2c21221e

roul: Update site.
author Steve Losh <steve@stevelosh.com>
date Tue, 10 Apr 2012 10:13:09 -0400
parents abcf6f68470c
children 9419dfa1bff9
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
    "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:foaf="http://xmlns.com/foaf/0.1/">
  
  <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="content">
        
        
      
        
          
            <div id="breadcrumbs">
              <p>
                  
                    
                      <a href="../">index</a> &#187;
                    
                  
                    
                      quickstart
                    
                  
              </p>
            </div> <!-- div#breadcrumbs -->
          
        
      
        <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>
      
        
          <p id="footer">
            
              hg-prompt —
            
            Powered by <a href="http://bitbucket.org/zacharyvoase/markdoc">Markdoc</a>.
          </p>
        
      </div> <!-- div#content -->
    
      
      
  
    
  </body>
</html>