web/html/ch03-session4.html~
author amit@thunder
Mon, 25 Jan 2010 18:56:45 +0530
changeset 0 8083d21c0020
permissions -rw-r--r--
The first commit of all the required files for the review app
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     1
<html>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     2
<head>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     4
<title>Chapter 1. </title>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     5
<link rel="stylesheet" href="/review/support/styles.css" type="text/css">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     7
<link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     8
<script type="text/javascript" src="/review/support/jquery-min.js"></script>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     9
<script type="text/javascript" src="/review/support/form.js"></script>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    10
<script type="text/javascript" src="/review/support/hsbook.js"></script>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    11
</head>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    12
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    13
<div class="chapter" id="ch03-session4">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    14
<div class="titlepage"></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    15
<div class="toc">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    16
<p><b>Table of Contents</b></p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    17
<dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    18
<dt><span class="article"><a href="#id2404065">More text processing</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    19
<dd><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    20
<dt><span class="section"><a href="#uniq">1. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    21
      <code class="literal">uniq</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    22
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    23
<dt><span class="section"><a href="#join">2.       <code class="literal">join</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    24
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    25
<dt><span class="section"><a href="#generating-a-word-frequency-list">3. Generating a word frequency list</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    26
<dt><span class="section"><a href="#basic-editing-and-editors">4. Basic editing and editors</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    27
<dd><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    28
<dt><span class="section"><a href="#vim">4.1. vim</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    29
<dt><span class="section"><a href="#scite">4.2. SciTE</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    30
</dl></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    31
<dt><span class="section"><a href="#personalizing-your-environment">5. Personalizing your Environment</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    32
<dd><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    33
<dt><span class="section"><a href="#bashrc">5.1. .bashrc</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    34
<dt><span class="section"><a href="#vimrc">5.2. .vimrc</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    35
</dl></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    36
<dt><span class="section"><a href="#subshells-and-source">6. Subshells and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    37
      <code class="literal">source</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    38
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    39
</dl></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    40
</dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    41
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    42
<div class="article" title="More text processing">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    43
<div class="titlepage">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    44
<div><div><h2 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    45
<a name="id2404065"></a>More text processing</h2></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    46
<hr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    47
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    48
<div class="toc">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    49
<p><b>Table of Contents</b></p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    50
<dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    51
<dt><span class="section"><a href="#uniq">1. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    52
      <code class="literal">uniq</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    53
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    54
<dt><span class="section"><a href="#join">2.       <code class="literal">join</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    55
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    56
<dt><span class="section"><a href="#generating-a-word-frequency-list">3. Generating a word frequency list</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    57
<dt><span class="section"><a href="#basic-editing-and-editors">4. Basic editing and editors</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    58
<dd><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    59
<dt><span class="section"><a href="#vim">4.1. vim</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    60
<dt><span class="section"><a href="#scite">4.2. SciTE</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    61
</dl></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    62
<dt><span class="section"><a href="#personalizing-your-environment">5. Personalizing your Environment</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    63
<dd><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    64
<dt><span class="section"><a href="#bashrc">5.1. .bashrc</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    65
<dt><span class="section"><a href="#vimrc">5.2. .vimrc</a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    66
</dl></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    67
<dt><span class="section"><a href="#subshells-and-source">6. Subshells and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    68
      <code class="literal">source</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    69
    </a></span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    70
</dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    71
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    72
<code class="literal">sort</code><p id="x_e"></a>Let's say we have a file which lists a few of the stalwarts of the open source community and a few details about them, like their "other" name, their homepage address, and what they are well known for or their claim to fame.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    73
<pre class="programlisting">Richard Stallman%rms%GNU Project
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    74
Eric Raymond%ESR%Jargon File
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    75
Ian Murdock% %Debian
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    76
Lawrence Lessig% %Creative Commons
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    77
Linus Torvalds% %Linux Kernel
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    78
Guido van Rossum%BDFL%Python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    79
Larry Wall% %Perl
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    80
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    81
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    82
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    83
<p id="x_f"></a>The sort command enables us to do this in a flash! Just running the sort command with the file name as a parameter sorts the lines of the file alphabetically and prints the output on the terminal. :</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    84
<pre class="programlisting">$ sort stalwarts.txt 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    85
Eric Raymond%ESR%Jargon File
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    86
Guido van Rossum%BDFL%Python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    87
Ian Murdock% %Debian
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    88
Larry Wall% %Perl
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    89
Lawrence Lessig% %Creative Commons
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    90
Linus Torvalds% %Linux Kernel
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    91
Richard Stallman%rms%GNU Project
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    92
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    93
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    94
<p id="x_10"></a>If you wish to sort them reverse alphabetically, you just need to pass the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    95
    <code class="literal">-r</code> option. Now, you might want to sort the lines, based on each person's claim to fame or their "other" name. What do we do in that case?
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    96
  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    97
<p id="x_11"></a>Below is an example that sorts the file based on "other" names. :</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    98
<pre class="programlisting">$ sort -t % -k 2,2  stalwarts.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    99
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   100
Ian Murdock% %Debian
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   101
Larry Wall% %Perl
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   102
Lawrence Lessig% %Creative Commons
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   103
Linus Torvalds% %Linux Kernel
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   104
Guido van Rossum%BDFL%Python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   105
Eric Raymond%ESR%Jargon File
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   106
Richard Stallman%rms%GNU Project
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   107
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   108
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   109
<p id="x_12"></a>Sort command assumes white space to be the default delimiter for columns in each line. The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   110
    <code class="literal">-t</code> option specifies the delimiting character, which is 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   111
    <code class="literal">%</code> in this case.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   112
  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   113
<p id="x_13"></a>The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   114
    <code class="literal">-k</code> option starts a key at position 2 and ends it at 2, essentially telling the sort command that it should sort based on the 2nd column, which is the other name. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   115
    <code class="literal">sort</code> also supports conflict resolution using multiple columns for sorting. You can see that the first three lines have nothing in the "other" names column. We could resolve the conflict by sorting based on the project names (the 3rd column).
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   116
  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   117
<pre class="programlisting">$ sort -t % -k 2,2 -k 3,3  stalwarts.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   118
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   119
Lawrence Lessig% %Creative Commons
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   120
Ian Murdock% %Debian
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   121
Linus Torvalds% %Linux Kernel
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   122
Larry Wall% %Perl
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   123
Guido van Rossum%BDFL%Python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   124
Eric Raymond%ESR%Jargon File
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   125
Richard Stallman%rms%GNU Project
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   126
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   127
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   128
<p id="x_14"></a>    <code class="literal">sort</code> also has a lot of other options like ignoring case differences, month sort(JAN&lt;FEB&lt;...), merging already sorted files. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   129
    <code class="literal">man sort</code> would give you a lot of information.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   130
  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   131
<div class="section" title="1.  uniq">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   132
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   133
<a name="uniq"></a>1. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   134
      <code class="literal">uniq</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   135
    </h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   136
<p id="x_15"></a>Suppose we have a list of items, say books, and we wish to obtain a list which names of all the books only once, without any duplicates. We use the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   137
      <code class="literal">uniq</code> command to achieve this.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   138
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   139
<pre class="programlisting">Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   140
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   141
The Mythical Man Month: Essays on Software Engineering 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   142
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   143
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   144
Structure and Interpretation of Computer Programs
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   145
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   146
Compilers: Principles, Techniques, and Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   147
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   148
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   149
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   150
The Art of Computer Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   151
Introduction to Algorithms
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   152
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   153
The Pragmatic Programmer: From Journeyman to Master
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   154
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   155
Unix Power Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   156
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   157
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   158
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   159
<p id="x_16"></a>Let us try and get rid of the duplicate lines from this file using the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   160
      <code class="literal">uniq</code> command.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   161
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   162
<pre class="programlisting">$ uniq items.txt 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   163
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   164
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   165
The Mythical Man Month: Essays on Software Engineering 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   166
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   167
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   168
Structure and Interpretation of Computer Programs
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   169
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   170
Compilers: Principles, Techniques, and Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   171
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   172
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   173
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   174
The Art of Computer Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   175
Introduction to Algorithms
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   176
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   177
The Pragmatic Programmer: From Journeyman to Master
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   178
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   179
Unix Power Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   180
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   181
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   182
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   183
<p id="x_17"></a>Nothing happens! Why? The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   184
      <code class="literal">uniq</code> command removes duplicate lines only when they are next to each other. So, we get a sorted file from the original file and work with that file, henceforth.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   185
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   186
<pre class="programlisting">$ sort items.txt &gt; items-sorted.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   187
$ uniq items-sorted.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   188
Compilers: Principles, Techniques, and Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   189
Introduction to Algorithms
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   190
Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   191
Structure and Interpretation of Computer Programs
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   192
The Art of Computer Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   193
The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   194
The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   195
The Mythical Man Month: Essays on Software Engineering 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   196
The Pragmatic Programmer: From Journeyman to Master
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   197
Unix Power Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   198
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   199
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   200
<p id="x_18"></a>      <code class="literal">uniq -u</code> command gives the lines which are unique and do not have any duplicates in the file. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   201
      <code class="literal">uniq -d</code> outputs only those lines which have duplicates. The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   202
      <code class="literal">-c</code> option displays the number of times each line occurs in the file. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   203
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   204
<pre class="programlisting">$ uniq -u items-sorted.txt 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   205
Compilers: Principles, Techniques, and Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   206
Introduction to Algorithms
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   207
Structure and Interpretation of Computer Programs
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   208
The Art of Computer Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   209
The Mythical Man Month: Essays on Software Engineering 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   210
The Pragmatic Programmer: From Journeyman to Master
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   211
Unix Power Tools
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   212
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   213
$ uniq -dc items-sorted.txt      
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   214
5 Programming Pearls
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   215
3 The Art of UNIX Programming
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   216
3 The C Programming Language
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   217
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   218
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   219
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   220
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   221
<div class="section" title="2.  join">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   222
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   223
<a name="join"></a>2.       <code class="literal">join</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   224
    </h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   225
<p id="x_19"></a>Now suppose we had the file 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   226
      <code class="literal">stalwarts1.txt</code>, which lists the home pages of all the people listed in 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   227
      <code class="literal">stalwarts.txt</code>. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   228
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   229
<pre class="programlisting">Richard Stallman%http://www.stallman.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   230
Eric Raymond%http://www.catb.org/~esr/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   231
Ian Murdock%http://ianmurdock.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   232
Lawrence Lessig%http://lessig.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   233
Linus Torvalds%http://torvalds-family.blogspot.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   234
Guido van Rossum%http://www.python.org/~guido/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   235
Larry Wall%http://www.wall.org/~larry/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   236
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   237
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   238
<p id="x_1a"></a>It would be nice to have a single file with the information in both the files. To achieve this we use the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   239
      <code class="literal">join</code> command. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   240
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   241
<pre class="programlisting">$ join stalwarts.txt stalwarts1.txt -t %
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   242
Richard Stallman%rms%GNU Project%http://www.stallman.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   243
Eric Raymond%ESR%Jargon File%http://www.catb.org/~esr/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   244
Ian Murdock% %Debian%http://ianmurdock.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   245
Lawrence Lessig% %Creative Commons%http://lessig.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   246
Linus Torvalds% %Linux Kernel%http://torvalds-family.blogspot.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   247
Guido van Rossum%BDFL%Python%http://www.python.org/~guido/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   248
Larry Wall% %Perl%http://www.wall.org/~larry/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   249
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   250
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   251
<p id="x_1b"></a>The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   252
      <code class="literal">join</code> command joins the two files, based on the common field present in both the files, which is the name, in this case.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   253
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   254
<p id="x_1c"></a>The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   255
      <code class="literal">-t</code> option again specifies the delimiting character. Unless that is specified, join assumes that the fields are separated by spaces.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   256
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   257
<p id="x_1d"></a>Note that, for 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   258
      <code class="literal">join</code> to work, the common field should be in the same order in both the files. If this is not so, you could use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   259
      <code class="literal">sort</code>, to sort the files on the common field and then join the files. In the above example, we have the common field to be the first column in both the files. If this is not the case we could use the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   260
      <code class="literal">-1</code> and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   261
      <code class="literal">-2</code> options to specify the field to be used for joining the files. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   262
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   263
<pre class="programlisting">$ join -2 2 stalwarts.txt stalwarts2.txt -t %
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   264
Richard Stallman%rms%GNU Project%http://www.stallman.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   265
Eric Raymond%ESR%Jargon File%http://www.catb.org/~esr/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   266
Ian Murdock% %Debian%http://ianmurdock.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   267
Lawrence Lessig% %Creative Commons%http://lessig.org
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   268
Linus Torvalds% %Linux Kernel%http://torvalds-family.blogspot.com/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   269
Guido van Rossum%BDFL%Python%http://www.python.org/~guido/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   270
Larry Wall% %Perl%http://www.wall.org/~larry/
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   271
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   272
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   273
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   274
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   275
<div class="section" title="3. Generating a word frequency list">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   276
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   277
<a name="generating-a-word-frequency-list"></a>3. Generating a word frequency list</h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   278
<p id="x_1e"></a>Now, let us use the tools we have learnt to use, to generate a word frequency list of a text file. We shall use the free text of Alice in Wonderland.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   279
<p id="x_1f"></a>The basic steps to achieve this task would be -</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   280
<div class="orderedlist"><ol class="orderedlist" type="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   281
<li class="listitem"><p id="x_20"></a>Eliminate the punctuation and spaces from the document.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   282
<li class="listitem"><p id="x_21"></a>Generate a list of words.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   283
<li class="listitem"><p id="x_22"></a>Count the words.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   284
</ol></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   285
<p id="x_23"></a>We first use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   286
      <code class="literal">grep</code> and some elementary 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   287
      <code class="literal">regex</code> to eliminate the non-alpha-characters. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   288
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   289
<pre class="programlisting">$ grep "[A-Za-z]*" alice-in-wonderland.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   290
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   291
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   292
<p id="x_24"></a>This outputs all the lines which has any alphabetic characters on it. This isn't of much use, since we haven't done anything with the code. We only require the alphabetic characters, without any of the other junk. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   293
      <code class="literal">man grep</code> shows us the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   294
      <code class="literal">-o</code> option for outputting only the text which matches the regular expression. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   295
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   296
<pre class="programlisting">$ grep "[A-Za-z]*" -o alice-in-wonderland.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   297
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   298
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   299
<p id="x_25"></a>Not very surprisingly, we have all the words, spit out in the form of a list! Now that we have a list of words, it is quite simple to count the occurrences of the words. You would've realized that we can make use of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   300
      <code class="literal">sort</code> and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   301
      <code class="literal">uniq</code> commands. We pipe the output from the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   302
      <code class="literal">grep</code> to the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   303
      <code class="literal">sort</code> and then pipe it's output to 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   304
      <code class="literal">uniq</code>. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   305
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   306
<pre class="programlisting">$ grep "[A-Za-z]*" -o alice-in-wonderland.txt | sort | uniq -c 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   307
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   308
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   309
<p id="x_26"></a>Notice that you get the list of all words in the document in the alphabetical order, with it's frequency written next to it. But, you might have observed that Capitalized words and lower case words are being counted as different words. We therefore, replace all the Upper case characters with lower case ones, using the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   310
      <code class="literal">tr</code> command. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   311
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   312
<pre class="programlisting">$ grep  "[A-Za-z]*" -o alice-in-wonderland.txt | tr 'A-Z' 'a-z' | sort | uniq -c 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   313
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   314
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   315
<p id="x_27"></a>Now, it would also be nice to have the list ordered in the decreasing order of the frequency of the appearance of the words. We sort the output of the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   316
      <code class="literal">uniq</code> command with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   317
      <code class="literal">-n</code> and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   318
      <code class="literal">-r</code> options, to get the desired output. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   319
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   320
<pre class="programlisting">$ grep  "[A-Za-z]*" -o alice-in-wonderland.txt | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   321
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   322
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   323
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   324
<div class="section" title="4. Basic editing and editors">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   325
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   326
<a name="basic-editing-and-editors"></a>4. Basic editing and editors</h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   327
<div class="section" title="4.1. vim">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   328
<div class="titlepage"><div><div><h3 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   329
<a name="vim"></a>4.1. vim</h3></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   330
<p id="x_28"></a>Vim is a very powerful editor. It has a lot of commands, and all of them cannot be explained here. We shall try and look at a few, so that you can find your way around in vim.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   331
<p id="x_29"></a>To open a file in vim, we pass the filename as a parameter to the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   332
        <code class="literal">vim</code> command. If a file with that filename does not exist, a new file is created. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   333
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   334
<pre class="programlisting">$ vim first.txt
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   335
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   336
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   337
<p id="x_2a"></a>To start inserting text into the new file that we have opened, we need to press the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   338
        <code class="literal">i</code> key. This will take us into the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   339
        <span class="emphasis"><em>insert</em></span> mode from the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   340
        <span class="emphasis"><em>command</em></span> mode. Hitting the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   341
        <code class="literal">esc</code> key, will bring us back to the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   342
        <span class="emphasis"><em>command</em></span> mode. There is also another mode of vim, called the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   343
        <span class="emphasis"><em>visual</em></span> mode which will be discussed later in the course.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   344
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   345
<p id="x_2b"></a>In general, it is good to spend as little time as possible in the insert mode and extensively use the command mode to achieve various tasks.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   346
<p id="x_2c"></a>To save the file, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   347
        <code class="literal">:w</code> in the command mode. From here on, it is understood that we are in the command mode, whenever we are issuing any command to vim.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   348
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   349
<p id="x_2d"></a>To save a file and continue editing, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   350
        <code class="literal">:w FILENAME</code> The file name is optional. If you do not specify a filename, it is saved in the same file that you opened. If a file name different from the one you opened is specified, the text is saved with the new name, but you continue editing the file that you opened. The next time you save it without specifying a name, it gets saved with the name of the file that you initially opened.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   351
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   352
<p id="x_2e"></a>To save file with a new name and continue editing the new file, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   353
        <code class="literal">:saveas FILENAME</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   354
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   355
<p id="x_2f"></a>To save and quit, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   356
        <code class="literal">:wq</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   357
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   358
<p id="x_30"></a>To quit, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   359
        <code class="literal">:q</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   360
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   361
<p id="x_31"></a>To quit without saving, use 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   362
        <code class="literal">:q!</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   363
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   364
<div class="section" title="4.1.1. Moving around">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   365
<div class="titlepage"><div><div><h4 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   366
<a name="moving-around"></a>4.1.1. Moving around</h4></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   367
<p id="x_32"></a>While you are typing in a file, it is in-convenient to keep moving your fingers from the standard position for typing to the arrow keys. Vim, therefore, provides alternate keys for moving in the document. Note again that, you should be in the command mode, when issuing any commands to vim.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   368
<p id="x_33"></a>The basic cursor movement can be achieved using the keys, 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   369
          <code class="literal">h</code> (left), 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   370
          <code class="literal">l</code> (right), 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   371
          <code class="literal">k</code> (up) and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   372
          <code class="literal">j</code> (down). :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   373
        </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   374
<pre class="programlisting">^
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   375
k              
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   376
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   377
<div class="variablelist"><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   378
<dt><span class="term">&lt; h       l &gt;</span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   379
<dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   380
<p></p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   381
<p id="x_34"></a>j v</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   382
</dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   383
</dl></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   384
<p id="x_35"></a>Note: Most commands can be prefixed with a number, to repeat the command. For instance, 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   385
          <code class="literal">10j</code> will move the cursor down 10 lines.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   386
        </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   387
<div class="section" title="4.1.1.1. Moving within a line">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   388
<div class="titlepage"><div><div><h5 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   389
<a name="moving-within-a-line"></a>4.1.1.1. Moving within a line</h5></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   390
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   391
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   392
<col width="41">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   393
<col width="10">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   394
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   395
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   396
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   397
                    <p id="x_36"></a>Cursor Movement</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   398
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   399
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   400
                    <p id="x_37"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   401
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   402
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   403
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   404
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   405
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   406
                    <p id="x_38"></a>Beginning of line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   407
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   408
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   409
                    <p id="x_39"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   410
                      <code class="literal">0</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   411
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   412
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   413
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   414
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   415
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   416
                    <p id="x_3a"></a>First non-space character of line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   417
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   418
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   419
                    <p id="x_3b"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   420
                      <code class="literal">^</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   421
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   422
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   423
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   424
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   425
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   426
                    <p id="x_3c"></a>End of line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   427
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   428
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   429
                    <p id="x_3d"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   430
                      <code class="literal">$</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   431
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   432
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   433
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   434
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   435
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   436
                    <p id="x_3e"></a>Last non-space character of line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   437
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   438
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   439
                    <p id="x_3f"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   440
                      <code class="literal">g_</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   441
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   442
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   443
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   444
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   445
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   446
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   447
<div class="section" title="4.1.1.2. Moving by words and sentences">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   448
<div class="titlepage"><div><div><h5 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   449
<a name="moving-by-words-and-sentences"></a>4.1.1.2. Moving by words and sentences</h5></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   450
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   451
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   452
<col width="31">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   453
<col width="10">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   454
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   455
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   456
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   457
                    <p id="x_40"></a>Cursor Movement</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   458
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   459
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   460
                    <p id="x_41"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   461
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   462
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   463
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   464
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   465
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   466
                    <p id="x_42"></a>Forward, word beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   467
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   468
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   469
                    <p id="x_43"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   470
                      <code class="literal">w</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   471
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   472
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   473
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   474
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   475
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   476
                    <p id="x_44"></a>Backward, word beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   477
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   478
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   479
                    <p id="x_45"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   480
                      <code class="literal">b</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   481
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   482
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   483
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   484
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   485
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   486
                    <p id="x_46"></a>Forward, word end</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   487
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   488
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   489
                    <p id="x_47"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   490
                      <code class="literal">e</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   491
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   492
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   493
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   494
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   495
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   496
                    <p id="x_48"></a>Backward, word end</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   497
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   498
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   499
                    <p id="x_49"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   500
                      <code class="literal">ge</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   501
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   502
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   503
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   504
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   505
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   506
                    <p id="x_4a"></a>Forward, sentence beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   507
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   508
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   509
                    <p id="x_4b"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   510
                      <code class="literal">)</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   511
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   512
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   513
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   514
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   515
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   516
                    <p id="x_4c"></a>Backward, sentence beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   517
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   518
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   519
                    <p id="x_4d"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   520
                      <code class="literal">(</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   521
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   522
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   523
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   524
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   525
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   526
                    <p id="x_4e"></a>Forward, paragraph beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   527
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   528
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   529
                    <p id="x_4f"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   530
                      <code class="literal">}</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   531
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   532
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   533
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   534
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   535
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   536
                    <p id="x_50"></a>Backward, paragraph beginning</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   537
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   538
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   539
                    <p id="x_51"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   540
                      <code class="literal">{</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   541
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   542
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   543
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   544
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   545
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   546
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   547
<div class="section" title="4.1.1.3. More movement commands">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   548
<div class="titlepage"><div><div><h5 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   549
<a name="more-movement-commands"></a>4.1.1.3. More movement commands</h5></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   550
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   551
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   552
<col width="34">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   553
<col width="13">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   554
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   555
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   556
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   557
                    <p id="x_52"></a>Cursor Movement</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   558
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   559
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   560
                    <p id="x_53"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   561
                  </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   562
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   563
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   564
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   565
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   566
                    <p id="x_54"></a>Forward by a screenful of text</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   567
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   568
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   569
                    <p id="x_55"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   570
                      <code class="literal">C-f</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   571
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   572
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   573
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   574
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   575
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   576
                    <p id="x_56"></a>Backward by a screenful of text</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   577
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   578
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   579
                    <p id="x_57"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   580
                      <code class="literal">C-b</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   581
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   582
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   583
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   584
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   585
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   586
                    <p id="x_58"></a>Beginning of the screen</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   587
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   588
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   589
                    <p id="x_59"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   590
                      <code class="literal">H</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   591
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   592
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   593
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   594
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   595
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   596
                    <p id="x_5a"></a>Middle of the screen</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   597
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   598
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   599
                    <p id="x_5b"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   600
                      <code class="literal">M</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   601
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   602
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   603
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   604
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   605
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   606
                    <p id="x_5c"></a>End of the screen</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   607
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   608
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   609
                    <p id="x_5d"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   610
                      <code class="literal">L</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   611
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   612
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   613
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   614
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   615
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   616
                    <p id="x_5e"></a>End of file</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   617
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   618
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   619
                    <p id="x_5f"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   620
                      <code class="literal">G</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   621
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   622
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   623
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   624
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   625
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   626
                    <p id="x_60"></a>Line number 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   627
                      <code class="literal">num</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   628
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   629
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   630
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   631
                    <p id="x_61"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   632
                      <code class="literal">[num]G</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   633
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   634
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   635
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   636
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   637
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   638
                    <p id="x_62"></a>Beginning of file</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   639
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   640
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   641
                    <p id="x_63"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   642
                      <code class="literal">gg</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   643
                    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   644
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   645
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   646
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   647
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   648
                    <p id="x_64"></a>Next occurrence of the text under the cursor</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   649
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   650
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   651
                    <div class="variablelist"><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   652
<dt><span class="term">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   653
                          <code class="literal">*</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   654
                        </span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   655
<dd><p></p></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   656
</dl></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   657
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   658
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   659
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   660
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   661
                    <p id="x_65"></a>Previous occurrence of the text under the cursor</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   662
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   663
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   664
                    <div class="variablelist"><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   665
<dt><span class="term">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   666
                          <code class="literal">#</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   667
                        </span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   668
<dd><p></p></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   669
</dl></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   670
                  </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   671
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   672
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   673
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   674
<p id="x_66"></a>Note: 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   675
            <code class="literal">C-x</code> is 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   676
            <code class="literal">Ctrl</code> + 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   677
            <code class="literal">x</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   678
          </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   679
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   680
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   681
<div class="section" title="4.1.2. The visual mode">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   682
<div class="titlepage"><div><div><h4 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   683
<a name="the-visual-mode"></a>4.1.2. The visual mode</h4></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   684
<p id="x_67"></a>The visual mode is a special mode that is not present in the original vi editor. It allows us to highlight text and perform actions on it. All the movement commands that have been discussed till now work in the visual mode also. The editing commands that will be discussed in the future work on the visual blocks selected, too.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   685
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   686
<div class="section" title="4.1.3. Editing commands">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   687
<div class="titlepage"><div><div><h4 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   688
<a name="editing-commands"></a>4.1.3. Editing commands</h4></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   689
<p id="x_68"></a>The editing commands usually take the movements as arguments. A movement is equivalent to a selection in the visual mode. The cursor is assumed to have moved over the text in between the initial and the final points of the movement. The motion or the visual block that's been highlighted can be passed as arguments to the editing commands.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   690
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   691
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   692
<col width="26">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   693
<col width="10">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   694
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   695
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   696
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   697
                  <p id="x_69"></a>Editing effect</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   698
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   699
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   700
                  <p id="x_6a"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   701
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   702
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   703
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   704
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   705
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   706
                  <p id="x_6b"></a>Cutting text</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   707
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   708
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   709
                  <p id="x_6c"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   710
                    <code class="literal">d</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   711
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   712
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   713
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   714
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   715
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   716
                  <p id="x_6d"></a>Copying/Yanking text</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   717
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   718
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   719
                  <p id="x_6e"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   720
                    <code class="literal">y</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   721
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   722
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   723
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   724
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   725
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   726
                  <p id="x_6f"></a>Pasting copied/cut text</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   727
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   728
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   729
                  <p id="x_70"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   730
                    <code class="literal">p</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   731
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   732
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   733
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   734
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   735
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   736
<p id="x_71"></a>The cut and copy commands take the motions or visual blocks as arguments and act on them. For instance, if you wish to delete the text from the current text position to the beginning of the next word, type 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   737
          <code class="literal">dw</code>. If you wish to copy the text from the current position to the end of this sentence, type 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   738
          <code class="literal">y)</code>.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   739
        </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   740
<p id="x_72"></a>Apart from the above commands, that take any motion or visual block as an argument, there are additional special commands.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   741
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   742
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   743
<col width="41">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   744
<col width="10">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   745
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   746
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   747
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   748
                  <p id="x_73"></a>Editing effect</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   749
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   750
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   751
                  <p id="x_74"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   752
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   753
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   754
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   755
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   756
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   757
                  <p id="x_75"></a>Cut the character under the cursor</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   758
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   759
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   760
                  <p id="x_76"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   761
                    <code class="literal">x</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   762
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   763
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   764
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   765
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   766
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   767
                  <p id="x_77"></a>Replace the character under the cursor with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   768
                    <code class="literal">a</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   769
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   770
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   771
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   772
                  <div class="variablelist"><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   773
<dt><span class="term">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   774
                        <code class="literal">ra</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   775
                      </span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   776
<dd><p></p></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   777
</dl></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   778
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   779
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   780
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   781
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   782
                  <p id="x_78"></a>Cut an entire line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   783
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   784
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   785
                  <p id="x_79"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   786
                    <code class="literal">dd</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   787
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   788
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   789
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   790
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   791
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   792
                  <p id="x_7a"></a>Copy/yank an entire line</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   793
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   794
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   795
                  <p id="x_7b"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   796
                    <code class="literal">yy</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   797
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   798
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   799
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   800
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   801
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   802
<p id="x_7c"></a>Note: You can prefix numbers to any of the commands, to repeat them.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   803
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   804
<div class="section" title="4.1.4. Undo and Redo">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   805
<div class="titlepage"><div><div><h4 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   806
<a name="undo-and-redo"></a>4.1.4. Undo and Redo</h4></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   807
<p id="x_7d"></a>You can undo almost anything using 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   808
          <code class="literal">u</code>.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   809
        </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   810
<p id="x_7e"></a>To undo the undo command type 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   811
          <code class="literal">C-r</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   812
        </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   813
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   814
<div class="section" title="4.1.5. Searching and Replacing">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   815
<div class="titlepage"><div><div><h4 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   816
<a name="searching-and-replacing"></a>4.1.5. Searching and Replacing</h4></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   817
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   818
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   819
<col width="42">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   820
<col width="10">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   821
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   822
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   823
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   824
                  <p id="x_7f"></a>Finding</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   825
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   826
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   827
                  <p id="x_80"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   828
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   829
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   830
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   831
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   832
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   833
                  <p id="x_81"></a>Next occurrence of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   834
                    <code class="literal">text</code>, forward
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   835
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   836
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   837
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   838
                  <p id="x_82"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   839
                    <code class="literal">\text</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   840
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   841
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   842
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   843
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   844
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   845
                  <p id="x_83"></a>Next occurrence of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   846
                    <code class="literal">text</code>, backward
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   847
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   848
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   849
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   850
                  <p id="x_84"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   851
                    <code class="literal">?text</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   852
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   853
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   854
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   855
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   856
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   857
                  <p id="x_85"></a>Search again in the same direction</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   858
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   859
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   860
                  <p id="x_86"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   861
                    <code class="literal">n</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   862
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   863
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   864
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   865
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   866
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   867
                  <p id="x_87"></a>Search again in the opposite direction</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   868
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   869
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   870
                  <p id="x_88"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   871
                    <code class="literal">N</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   872
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   873
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   874
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   875
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   876
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   877
                  <p id="x_89"></a>Next occurrence of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   878
                    <code class="literal">x</code> in the line
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   879
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   880
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   881
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   882
                  <p id="x_8a"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   883
                    <code class="literal">fx</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   884
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   885
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   886
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   887
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   888
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   889
                  <p id="x_8b"></a>Previous occurrence of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   890
                    <code class="literal">x</code> in the line
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   891
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   892
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   893
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   894
                  <p id="x_8c"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   895
                    <code class="literal">Fx</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   896
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   897
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   898
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   899
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   900
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   901
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   902
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   903
<col width="40">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   904
<col width="19">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   905
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   906
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   907
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   908
                  <p id="x_8d"></a>Finding and Replacing</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   909
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   910
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   911
                  <p id="x_8e"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   912
                </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   913
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   914
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   915
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   916
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   917
                  <p id="x_8f"></a>Replace the first instance of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   918
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   919
                    <code class="literal">new</code> in the current line.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   920
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   921
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   922
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   923
                  <p id="x_90"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   924
                    <code class="literal">:s/old/new</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   925
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   926
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   927
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   928
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   929
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   930
                  <p id="x_91"></a>Replace all instances of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   931
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   932
                    <code class="literal">new</code> in the current line.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   933
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   934
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   935
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   936
                  <p id="x_92"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   937
                    <code class="literal">:s/old/new/g</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   938
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   939
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   940
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   941
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   942
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   943
                  <p id="x_93"></a>Replace all instances of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   944
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   945
                    <code class="literal">new</code> in the current line, but ask for confirmation each time.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   946
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   947
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   948
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   949
                  <p id="x_94"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   950
                    <code class="literal">:s/old/new/gc</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   951
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   952
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   953
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   954
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   955
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   956
                  <p id="x_95"></a>Replace the first instance of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   957
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   958
                    <code class="literal">new</code> in the entire file.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   959
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   960
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   961
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   962
                  <p id="x_96"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   963
                    <code class="literal">:%s/old/new</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   964
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   965
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   966
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   967
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   968
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   969
                  <p id="x_97"></a>Replace all instances of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   970
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   971
                    <code class="literal">new</code> in the entire file.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   972
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   973
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   974
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   975
                  <p id="x_98"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   976
                    <code class="literal">:%s/old/new/g</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   977
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   978
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   979
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   980
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   981
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   982
                  <p id="x_99"></a>Replace all instances of 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   983
                    <code class="literal">old</code> with 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   984
                    <code class="literal">new</code> in the entire file but ask for confirmation each time.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   985
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   986
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   987
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   988
                  <p id="x_9a"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   989
                    <code class="literal">:%s/old/new/gc</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   990
                  </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   991
                </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   992
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   993
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   994
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   995
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   996
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   997
<div class="section" title="4.2. SciTE">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   998
<div class="titlepage"><div><div><h3 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   999
<a name="scite"></a>4.2. SciTE</h3></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1000
<p id="x_9b"></a>SciTE is a 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1001
        <span class="emphasis"><em>source code</em></span> editor, that has a feel similar to the commonly used GUI text editors. It has a wide range of features that are extremely useful for a programmer, editing code. Also it aims to keep configuration simple, and the user needs to edit a text file to configure SciTE to his/her liking.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1002
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1003
<p id="x_9c"></a>Opening, Saving, Editing files with SciTE is extremely simple and trivial. Knowledge of using a text editor will suffice.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1004
<p id="x_9d"></a>SciTE can syntax highlight code in various languages. It also has auto-indentation, code-folding and other such features which are useful when editing code.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1005
<p id="x_9e"></a>SciTE also gives you the option to (compile and) run your code, from within the editor.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1006
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1007
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1008
<div class="section" title="5. Personalizing your Environment">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1009
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1010
<a name="personalizing-your-environment"></a>5. Personalizing your Environment</h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1011
<div class="section" title="5.1. .bashrc">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1012
<div class="titlepage"><div><div><h3 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1013
<a name="bashrc"></a>5.1. .bashrc</h3></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1014
<p id="x_9f"></a>What would you do, if you want bash to execute a particular command each time you start it up? For instance, say you want the current directory to be your Desktop instead of your home folder, each time bash starts up. How would you achieve this? Bash reads and executes commands in a whole bunch of files called start-up files, when it starts up.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1015
<p id="x_a0"></a>When bash starts up as an interactive login shell, it reads the files 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1016
        <code class="literal">/etc/profile</code>, 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1017
        <code class="literal">~/.bash_profile</code>, 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1018
        <code class="literal">~/.bash_login</code>, and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1019
        <code class="literal">~/.profile</code> in that order.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1020
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1021
<p id="x_a1"></a>When it is a shell that is not a login shell, 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1022
        <code class="literal">~/.bashrc</code> is read and the commands in it are executed. This can be prevented using the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1023
        <code class="literal">--norc</code> option. To force bash to use another file, instead of the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1024
        <code class="literal">~/.bashrc</code> file on start-up, the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1025
        <code class="literal">--rcfile</code> option may be used.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1026
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1027
<p id="x_a2"></a>Now, you know what you should do, to change the current directory to you Desktop. Just put a 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1028
        <code class="literal">cd ~/Desktop</code> into your 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1029
        <code class="literal">~/.bashrc</code> and you are set!
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1030
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1031
<p id="x_a3"></a>This example is quite a simple and lame one. The start-up files are used for a lot more complex things than this. You could set (or unset) aliases and a whole bunch of environment variables in the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1032
        <code class="literal">.bashrc</code>. We shall look at them, in the next section where we look at environment variables and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1033
        <code class="literal">set</code> command.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1034
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1035
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1036
<div class="section" title="5.2. .vimrc">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1037
<div class="titlepage"><div><div><h3 class="title">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1038
<a name="vimrc"></a>5.2. .vimrc</h3></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1039
<p id="x_a4"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1040
        <code class="literal">.vimrc</code> is a file similar to 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1041
        <code class="literal">.bashrc</code> for vim. It is a start-up file that vim reads and executes, each time it starts up. The options that you would like to be set every time you use vim, are placed in the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1042
        <code class="literal">.vimrc</code> file, so that they are automatically set each time vim starts. The recommended place for having your 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1043
        <code class="literal">.vimrc</code> is also your home directory.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1044
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1045
<p id="x_a5"></a>The file 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1046
        <code class="literal">/etc/vimrc</code> is the global config file and shouldn't usually be edited. You can instead edit the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1047
        <code class="literal">~/.vimrc</code> file that is present in your home folder.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1048
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1049
<p id="x_a6"></a>There are a whole bunch of variables that you could set in the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1050
        <code class="literal">.vimrc</code> file. You can look at all the options available, using the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1051
        <code class="literal">:set all</code> command in vim. You could use the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1052
        <code class="literal">:help option_name</code> to get more information about the option that you want to set. Once you are comfortable with what you want to set a particular variable to, you could add it to 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1053
        <code class="literal">.vimrc</code>. You should also look at 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1054
        <code class="literal">:help vimrc</code> for more info on the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1055
        <code class="literal">.vimrc</code> file. If you already have a 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1056
        <code class="literal">.vimrc</code> file, you can edit it from within vim, using 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1057
        <code class="literal">:e $MYVIMRC</code> command. We shall look at some of the most commonly used options.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1058
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1059
<div class="informaltable"><table border="1">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1060
<colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1061
<col width="35">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1062
<col width="84">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1063
</colgroup>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1064
<thead><tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1065
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1066
                <p id="x_a7"></a>Command</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1067
              </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1068
<th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1069
                <p id="x_a8"></a>Vim action</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1070
              </th>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1071
</tr></thead>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1072
<tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1073
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1074
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1075
                <p id="x_a9"></a>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1076
                  <code class="literal">set nocompatible</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1077
                </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1078
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1079
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1080
                <p id="x_aa"></a>Explicitly disable compatibility with vi</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1081
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1082
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1083
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1084
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1085
                <div class="variablelist"><dl>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1086
<dt><span class="term">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1087
                      <code class="literal">set backspace=indent,eol,start</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1088
                    </span></dt>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1089
<dd><p></p></dd>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1090
</dl></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1091
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1092
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1093
                <p id="x_ab"></a>In the insert mode, vim allows the backspace key to delete white spaces at the start of line, line breaks and the character before which insert mode started.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1094
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1095
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1096
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1097
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1098
                <p id="x_ac"></a>set autoindent</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1099
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1100
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1101
                <p id="x_ad"></a>Vim indents a new line with the same indentation of the previous line.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1102
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1103
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1104
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1105
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1106
                <p id="x_ae"></a>set backup</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1107
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1108
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1109
                <p id="x_af"></a>Vim keeps a backup copy of a file when overwriting it.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1110
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1111
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1112
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1113
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1114
                <p id="x_b0"></a>set history=50</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1115
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1116
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1117
                <p id="x_b1"></a>Vim keeps 50 commands and 50 search patterns in the history.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1118
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1119
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1120
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1121
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1122
                <p id="x_b2"></a>set ruler</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1123
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1124
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1125
                <p id="x_b3"></a>Displays the current cursor position in the lower right corner of the vim window.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1126
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1127
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1128
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1129
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1130
                <p id="x_b4"></a>set showcmd</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1131
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1132
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1133
                <p id="x_b5"></a>Displays the incomplete command in the lower right corner.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1134
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1135
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1136
<tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1137
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1138
                <p id="x_b6"></a>set incsearch</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1139
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1140
<td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1141
                <p id="x_b7"></a>Turns on incremental searching. Displays search results while you type.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1142
              </td>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1143
</tr>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1144
</tbody>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1145
</table></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1146
<p id="x_b8"></a>You can see the effect of the changes made to your 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1147
        <code class="literal">.vimrc</code> file by restarting vim. If you want to see the changes that you made to your 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1148
        <code class="literal">.vimrc</code> file immediately, you could source the file from within vim.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1149
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1150
<p id="x_b9"></a>If the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1151
        <code class="literal">.vimrc</code> file has been sourced when this instance of vim was started, you could just resource the file again:
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1152
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1153
<p id="x_ba"></a>:so $MYVIMRC</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1154
<p id="x_bb"></a>If you just created the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1155
        <code class="literal">.vimrc</code> file or it was not sourced when you stared this instance of vim, just replace the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1156
        <code class="literal">$MYVIMRC</code> variable above, with the location of the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1157
        <code class="literal">.vimrc</code> file that you created/edited.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1158
      </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1159
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1160
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1161
<div class="section" title="6. Subshells and source">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1162
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1163
<a name="subshells-and-source"></a>6. Subshells and 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1164
      <code class="literal">source</code>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1165
    </h2></div></div></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1166
<p id="x_bc"></a>A subshell is just a separate instance of the shell which is a child process of the shell that launches it. Bash creates a subshell in various circumstances. Creation of subshells allows the execution of various processes simultaneously.</p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1167
<div class="blockquote"><blockquote class="blockquote"><div class="itemizedlist"><ul class="itemizedlist" type="*">
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1168
<li class="listitem" style="list-style-type: *"><p id="x_bd"></a>When an external command is executed, a new subshell is created. Any built-in commands of bash are executed with int the same shell, and no new subshell is started. When an external command is run, the bash shell copies itself (along with it's environment) creating a subshell and the process is changed to the external command executed. The subshell is a child process of this shell.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1169
<li class="listitem" style="list-style-type: *"><p id="x_be"></a>Any pipes being used, create a subshell. The commands on the input and output ends of the pipe are run in different subshells.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1170
<li class="listitem" style="list-style-type: *"><p id="x_bf"></a>You could also, explicitly tell bash to start a subshell by enclosing a list of commands between parentheses. Each of the commands in the list is executed within a single new subshell.</p></li>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1171
</ul></div></blockquote></div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1172
<p id="x_c0"></a>To avoid creating a subshell, when running a shell script, you could use the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1173
      <code class="literal">source</code> command. :
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1174
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1175
<pre class="programlisting">$ source script.sh
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1176
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1177
</pre>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1178
<p id="x_c1"></a>This will run the 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1179
      <code class="literal">script.sh</code> within the present shell without creating a subshell. The 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1180
      <code class="literal">.</code> command is an alias for the source command. 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1181
      <code class="literal">. script.sh</code> is therefore equivalent to 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1182
      <code class="literal">source script.sh</code>.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1183
    </p>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1184
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1185
</div>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1186
</div></body>
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
  1187
</html>