Permalink
Browse files

Whole host of fixes and improvements from Simon Ruderich

  • Loading branch information...
1 parent d429efe commit e30f345e572460ed3923218d804e2d76261bfcee @runpaint committed Dec 8, 2009
@@ -11,28 +11,28 @@ <h3 id="visually-selecting-text">Visually Selecting Text</h3>
<h4>Solution</h4>
<p>To select text character by character change to <i>Visual</i> mode with
-<tt>&lt;Esc&gt;-v</tt>, then <a href="#basic-navigation">move the cursor as
+<tt>v</tt>, then <a href="#basic-navigation">move the cursor as
normal</a> using the <tt>h</tt>,<tt>j</tt>,<tt>k</tt>,<tt>l</tt> keys. For
example, to select the current character and the three that follow hit
-<tt>&lt;Esc&gt;-v</tt>, then <tt>3l</tt>. To select the current paragraph:
-<tt>&lt;Esc&gt;-v</tt>, then <tt>ap</tt>.</p>
+<tt>v</tt>, then <tt>3l</tt>. To select the current paragraph:
+<tt>v</tt>, then <tt>ap</tt>.</p>
<p>To select text by lines switch to <i>Visual Line</i> mode with
-<tt>&lt;Esc&gt;-V</tt>, then move upwards and downwards with <tt>k</tt> and
+<tt>V</tt>, then move upwards and downwards with <tt>k</tt> and
<tt>j</tt> as normal. For example, to select the current line and the 2
-following it hit <tt>&lt;Esc&gt;-V</tt>, then <tt>2j</tt>.</p>
+following it hit <tt>V</tt>, then <tt>2j</tt>.</p>
<p>To select text in vertical blocks, or 'columns' to the rest of us, you use
-<i>Visual Block</i> mode with <tt>&lt;Esc&gt;-&lt;Ctrl&gt;-v</tt>. For
+<i>Visual Block</i> mode with <tt>&lt;Ctrl&gt;-v</tt>. For
example, if you wanted to select the first two characters of the current line
and the 20 following, you'd position your cursor on the first character of the
-first line you're interested in, hit <tt>&lt;Esc&gt;-&lt;Ctrl&gt;-v</tt>, move
+first line you're interested in, hit <tt>&lt;Ctrl&gt;-v</tt>, move
one character to the right (<tt>l</tt>), then move down 20 lines with
<tt>20j</tt>.</p>
<p>If you want to switch selection mode mid-selection hit
-<tt>&lt;Esc&gt;-v</tt>, <tt>&lt;Esc&gt;-V</tt>, or
-<tt>&lt;Esc&gt;-&lt;Ctrl&gt;-v</tt>, as appropriate.</p>
+<tt>v</tt>, <tt>V</tt>, or
+<tt>&lt;Ctrl&gt;-v</tt>, as appropriate.</p>
<h4>Discussion</h4>
@@ -20,9 +20,9 @@ <h3 id="indenting-lines">Indenting Lines</h3>
indent or <kbd>&lt;</kbd> to unindent. </p>
<p>If you're in <i>Insert</i> or <i>Replace</i> mode you can use
-<kbd><kbd>&lt;Ctl&gt;</kbd>-<kbd>&lt;Shift&gt;</kbd>-<kbd>t</kbd></kbd> to
+<kbd><kbd>&lt;Ctrl&gt;</kbd>-<kbd>&lt;Shift&gt;</kbd>-<kbd>t</kbd></kbd> to
indent (mnemonic: <b>t</b>ab), and
-<kbd><kbd>&lt;Ctl&gt;</kbd>-<kbd>&lt;Shift&gt;</kbd>-<kbd>d</kbd></kbd> to
+<kbd><kbd>&lt;Ctrl&gt;</kbd>-<kbd>&lt;Shift&gt;</kbd>-<kbd>d</kbd></kbd> to
unident (mnemonic: <b>d</b>e-tab/indent).</p>
<p>More powerful are <a href="#selecting-text-with-motions">motions</a>
@@ -54,9 +54,10 @@ <h3 id="indenting-lines">Indenting Lines</h3>
shiftwidth=8</tt>, and <tt>:set noexpandtab</tt>. Tabs are now eight
columns wide; each indentation level is a single tab.</li>
<li>Convert tabs to spaces - Each press of the tab key should insert a certain
- number of spaces. The settings you need are <tt>:set tabstop=4</tt>,
+ number of spaces. The settings you need are <tt>:set tabstop=8</tt>,
<tt>:set shiftwidth=4</tt>, and <tt>:set expandtab</tt>. Tabs are now
- replaced with 4 spaces.</li>
+ replaced with 4 spaces. Real tabs are displayed 8 character wide, spaced
+ tabs 4 characters wide.</li>
</ul>
<p><tt>shiftwidth</tt> controls how many spaces are inserted when using the
@@ -90,6 +90,10 @@ <h3 id="selecting-text-with-motions">Selecting Text with Motions</h3>
<td>Up <var>count</var> characters.</td>
</tr>
<tr>
+ <td><kbd>$</kbd></td>
+ <td>To end of the line.</td>
+ </tr>
+ <tr>
<td><kbd><var>count</var>$</kbd></td>
<td>To end of the line <var>count</var>-1 lines downward.</td>
</tr>
@@ -12,7 +12,7 @@ <h3 id="repeating-commands">Repeating Commands</h3>
new current line. In other words, it repeats the command twice.</p>
<p>To repeat a command entered in <i>Command</i> mode hit
-<kbd><kbd>&lt;Esc&gt;</kbd>+<kbd>:</kbd></kbd>, then <kbd>&#x2191;</kbd> to
+<kbd><kbd>:</kbd></kbd>, then <kbd>&#x2191;</kbd> to
scroll back through your command history. If you type the first few letters of
the command before using <kbd>&#x2191;</kbd>, the history will be limited
appropriately.</p>
@@ -28,7 +28,7 @@ <h3 id="changing-case-of-text">Changing the Case of Text</h3>
<dl>
<dt><kbd>VU</kbd></dt>
<dd>Uppercase current line.</dd>
- <dt><kbd>guu</kbd></dt>
+ <dt><kbd>guw</kbd></dt>
<dd>Lowercases current word.</dd>
</dl>
@@ -98,3 +98,7 @@ <h3 id="using-templates">Using Templates</h3>
<img src="vim-html-template.png" width="580" height="202"
alt="Screenshot of GVim displaying a template for a HTML document.">
+
+<p>See <a href="#inserting-snippets">below</a> for ways to automatically jump
+to the placeholders and for inserting smaller code fragments by using
+snippets.</p>
@@ -18,7 +18,8 @@ <h3 id="auto-completing-text">Auto-Completing Text</h3>
<p>Another source of words is a dictionary. Get one, using the sidebar for
reference, then point Vim to it with <tt>:set
dictionary=<var>file</var></tt>. Then add the dictionary to list of places
-Vim looks for words: <tt>:set complete+=k</tt>.</p>
+Vim looks for words: <tt>:set complete+=k</tt>. The <tt>'complete'</tt>
+options controls where Vim looks for possible matches.</p>
<blockquote class="callout">
@@ -80,8 +81,9 @@ <h5 id="getting-dictionaries">Getting Dictionaries</h5>
\ endif
endif</code></pre>
-<p>To use Omni-Completion hit <kbd><kbd>Ctrl</kbd>+<kbd>o</kbd></kbd> to be
-presented with a list of choices for the text behind the cursor.</p>
+<p>To use Omni-Completion hit <kbd><kbd>Ctrl</kbd>Ctrl</kbd>+<kbd>x</kbd>
+<kbd>Ctrl</kbd>+<kbd>o</kbd></kbd> to be presented with a list of choices for
+the text behind the cursor.</p>
<p>Apart from programming languages, Omni-Completion also works for HTML and
CSS. For example, you can type <kbd>&lt;p cl</kbd>,
@@ -85,6 +85,10 @@ <h3 id="inserting-snippets">Inserting Snippets</h3>
<p>To learn more about <i>snipMate</i> and its features see <tt>:help
snipMate</tt>.</p>
+<p>There is also a similar snippet engine called <a
+href="http://www.vim.org/scripts/script.php?script_id=2611">XPTemplate</a>.
+</p>
+
<blockquote class="callout">
<h5>Comparison of Techniques to Auto-Complete Text</h5>
@@ -61,3 +61,8 @@ <h3 id="navigating-buffers">Navigating Buffers</h3>
<p>To quickly navigate between buffers its common to map <tt>:bnext</tt> and/or
<tt>:bprev</tt> to a key. For example <tt>map &lt;F6&gt; :bn&lt;CR&gt;</tt> lets you hit
<kbd>&lt;F6&gt;</kbd> to cycle through the open buffers.</p>
+
+<p>You can also switch buffers very quickly by using <tt>:buffer</tt> (and its
+shortcut <tt>:b</tt>). It supports (partial) file matching thus if you have
+first.txt and second.txt loaded you can use <tt>:b fir</tt> (or even just
+<tt>:b f</tt>) to switch to first.txt.</p>

0 comments on commit e30f345

Please sign in to comment.