slackware-current/slackbook/html/vi-keys.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

279 lines
6.3 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Vi Keys</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Vi" href="vi.html" />
<link rel="PREVIOUS" title="vi Configuration" href="vi-configuration.html" />
<link rel="NEXT" title="Emacs" href="emacs.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href="vi-configuration.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 16 Vi</td>
<td width="10%" align="right" valign="bottom"><a href="emacs.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="VI-KEYS" name="VI-KEYS">16.7 Vi Keys</a></h1>
<p>This section is a quick reference of many common <tt class="COMMAND">vi</tt> commands.
Some of these were discussed earlier in the chapter, while many will be new.</p>
<div class="TABLE"><a id="AEN5773" name="AEN5773"></a>
<p><b>Table 16-1. Movement</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>left, down, up, right</td>
<td align="CENTER"><b class="KEYCAP">h</b>, <b class="KEYCAP">j</b>, <b
class="KEYCAP">k</b>, <b class="KEYCAP">l</b></td>
</tr>
<tr>
<td>To the end of the line</td>
<td align="CENTER"><b class="KEYCAP">$</b></td>
</tr>
<tr>
<td>To the beginning of the line</td>
<td align="CENTER"><b class="KEYCAP">^</b></td>
</tr>
<tr>
<td>To the end of the file</td>
<td align="CENTER"><b class="KEYCAP">G</b></td>
</tr>
<tr>
<td>To the beginning of the file</td>
<td align="CENTER"><b class="KEYCAP">:1</b></td>
</tr>
<tr>
<td>To line 47</td>
<td align="CENTER"><b class="KEYCAP">:47</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5808" name="AEN5808"></a>
<p><b>Table 16-2. Editing</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Removing a line</td>
<td align="CENTER"><b class="KEYCAP">dd</b></td>
</tr>
<tr>
<td>Removing five lines</td>
<td align="CENTER"><b class="KEYCAP">5dd</b></td>
</tr>
<tr>
<td>Replacing a character</td>
<td align="CENTER"><b class="KEYCAP">r</b></td>
</tr>
<tr>
<td>Removing a character</td>
<td align="CENTER"><b class="KEYCAP">x</b></td>
</tr>
<tr>
<td>Removing ten characters</td>
<td align="CENTER"><b class="KEYCAP">10x</b></td>
</tr>
<tr>
<td>Undo last action</td>
<td align="CENTER"><b class="KEYCAP">u</b></td>
</tr>
<tr>
<td>Join current and next lines</td>
<td align="CENTER"><b class="KEYCAP">J</b></td>
</tr>
<tr>
<td>Replace old with new, globally</td>
<td align="CENTER"><b class="KEYCAP">%s'old'new'g</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5848" name="AEN5848"></a>
<p><b>Table 16-3. Searching</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Search for &#8220;asdf&#8221;</td>
<td align="CENTER"><b class="KEYCAP">/asdf</b></td>
</tr>
<tr>
<td>Search backwards for &#8220;asdf&#8221;</td>
<td align="CENTER"><b class="KEYCAP">?asdf</b></td>
</tr>
<tr>
<td>Repeat last search forwards</td>
<td align="CENTER"><b class="KEYCAP">/</b></td>
</tr>
<tr>
<td>Repeat last search backwards</td>
<td align="CENTER"><b class="KEYCAP">?</b></td>
</tr>
<tr>
<td>Repeat last search, same direction</td>
<td align="CENTER"><b class="KEYCAP">n</b></td>
</tr>
<tr>
<td>Repeat last search, opposite direction</td>
<td align="CENTER"><b class="KEYCAP">N</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5882" name="AEN5882"></a>
<p><b>Table 16-4. Saving and Quitting</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Quit</td>
<td align="CENTER"><b class="KEYCAP">:q</b></td>
</tr>
<tr>
<td>Quit without saving</td>
<td align="CENTER"><b class="KEYCAP">:q!</b></td>
</tr>
<tr>
<td>Write and quit</td>
<td align="CENTER"><b class="KEYCAP">:wq</b></td>
</tr>
<tr>
<td>Write, without quitting</td>
<td align="CENTER"><b class="KEYCAP">:w</b></td>
</tr>
<tr>
<td>Reload currently open file</td>
<td align="CENTER"><b class="KEYCAP">:e!</b></td>
</tr>
<tr>
<td>Write buffer to file <tt class="FILENAME">asdf</tt></td>
<td align="CENTER"><b class="KEYCAP">:w asdf</b></td>
</tr>
<tr>
<td>Open file <tt class="FILENAME">hejaz</tt></td>
<td align="CENTER"><b class="KEYCAP">:e hejaz</b></td>
</tr>
<tr>
<td>Read file <tt class="FILENAME">asdf</tt> into buffer</td>
<td align="CENTER"><b class="KEYCAP">:r asdf</b></td>
</tr>
<tr>
<td>Read output of <tt class="COMMAND">ls</tt> into buffer</td>
<td align="CENTER"><b class="KEYCAP">:r !ls</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="vi-configuration.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="emacs.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">vi Configuration</td>
<td width="34%" align="center" valign="top"><a href="vi.html" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Emacs</td>
</tr>
</table>
</div>
</body>
</html>