⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch31_01.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 31] Creating Custom Commands in vi</TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:46:08Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="part05.htm"TITLE="V. Text Editing "><LINKREL="prev"HREF="ch30_38.htm"TITLE="30.38 Finding Your Place with Undo "><LINKREL="next"HREF="ch31_02.htm"TITLE="31.2 Save Time and Typing with the vi map Commands "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch30_38.htm"TITLE="30.38 Finding Your Place with Undo "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 30.38 Finding Your Place with Undo "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 31</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch31_02.htm"TITLE="31.2 Save Time and Typing with the vi map Commands "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 31.2 Save Time and Typing with the vi map Commands "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="CHAPTER"><H1CLASS="chapter"><ACLASS="title"NAME="UPT-CHP-31">31. Creating Custom Commands in vi</A></H1><DIVCLASS="htmltoc"><P><B>Contents:</B><BR><ACLASS="sect1"HREF="#UPT-ART-9600"TITLE="31.1 Why Type More Than You Have To? ">Why Type More Than You Have To? </A><BR><ACLASS="sect1"HREF="ch31_02.htm"TITLE="31.2 Save Time and Typing with the vi map Commands ">Save Time and Typing with the vi map Commands </A><BR><ACLASS="sect1"HREF="ch31_03.htm"TITLE="31.3 What You Lose When You Use map! ">What You Lose When You Use map! </A><BR><ACLASS="sect1"HREF="ch31_04.htm"TITLE="31.4 vi @-Functions ">vi @-Functions </A><BR><ACLASS="sect1"HREF="ch31_05.htm"TITLE="31.5 Keymaps for Pasting into a Window Running vi ">Keymaps for Pasting into a Window Running vi </A><BR><ACLASS="sect1"HREF="ch31_06.htm"TITLE="31.6 Protecting Keys from Interpretation by ex ">Protecting Keys from Interpretation by ex </A><BR><ACLASS="sect1"HREF="ch31_07.htm"TITLE="31.7 Maps for Repeated Edits ">Maps for Repeated Edits </A><BR><ACLASS="sect1"HREF="ch31_08.htm"TITLE="31.8 More Examples of Mapping Keys in vi ">More Examples of Mapping Keys in vi </A><BR><ACLASS="sect1"HREF="ch31_09.htm"TITLE="31.9 Good Stuff for Your .exrc File ">Good Stuff for Your .exrc File </A><BR><ACLASS="sect1"HREF="ch31_10.htm"TITLE="31.10 Repeating a vi Keymap ">Repeating a vi Keymap </A><BR><ACLASS="sect1"HREF="ch31_11.htm"TITLE="31.11 Typing in Uppercase Without CAPS LOCK ">Typing in Uppercase Without CAPS LOCK </A><BR><ACLASS="sect1"HREF="ch31_12.htm"TITLE="31.12 Text-Input Mode Cursor Motion with No Arrow Keys ">Text-Input Mode Cursor Motion with No Arrow Keys </A><BR><ACLASS="sect1"HREF="ch31_13.htm"TITLE="31.13 Making Cursor Keys Work in vi Text-input Mode ">Making Cursor Keys Work in vi Text-input Mode </A><BR><ACLASS="sect1"HREF="ch31_14.htm"TITLE="31.14 Don't Lose Important Functions with vi Maps: Use noremap">Don't Lose Important Functions with vi Maps: Use noremap</A><BR><ACLASS="sect1"HREF="ch31_15.htm"TITLE="31.15 Fooling vi into Allowing Complex Macros ">Fooling vi into Allowing Complex Macros </A><BR><ACLASS="sect1"HREF="ch31_16.htm"TITLE="31.16 vi Macro for Splitting Long Lines ">vi Macro for Splitting Long Lines </A></P><P></P></DIV><DIVCLASS="sect1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-9600">31.1 Why Type More Than You Have To? </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-34771"></A>Keymapping&nbsp;- storing complex command sequences so that they can beexecuted with a single keystroke&nbsp;- is one of my favorite timesavers. There's nothinglike typing one key and watching a whole string of work take place. For repetitive edits (e.g., font changes) it's a real wrist-saver, too. In this chapter we show you how to: </P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">Save time by mapping keys: articles<ACLASS="xref"HREF="ch31_02.htm"TITLE="Save Time and Typing with the vi map Commands ">31.2</A>,<ACLASS="xref"HREF="ch31_04.htm"TITLE="vi @-Functions ">31.4</A>,<ACLASS="xref"HREF="ch31_07.htm"TITLE="Maps for Repeated Edits ">31.7</A>,and<ACLASS="xref"HREF="ch31_08.htm"TITLE="More Examples of Mapping Keys in vi ">31.8</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Know when to map a key and when not to: article<ACLASS="xref"HREF="ch31_03.htm"TITLE="What You Lose When You Use map! ">31.3</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Map keys like ESC and RETURN: article<ACLASS="xref"HREF="ch31_06.htm"TITLE="Protecting Keys from Interpretation by ex ">31.6</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Move around the file without leavingtext-input mode: articles<ACLASS="xref"HREF="ch31_12.htm"TITLE="Text-Input Mode Cursor Motion with No Arrow Keys ">31.12</A>and<ACLASS="xref"HREF="ch31_13.htm"TITLE="Making Cursor Keys Work in vi Text-input Mode ">31.13</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Protect the text you're pasting in from another window: article  <ACLASS="xref"HREF="ch31_05.htm"TITLE="Keymaps for Pasting into a Window Running vi ">31.5</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Put custom commands in your <EMCLASS="emphasis">.exrc</EM> file: articles<ACLASS="xref"HREF="ch31_09.htm"TITLE="Good Stuff for Your .exrc File ">31.9</A>,<ACLASS="xref"HREF="ch31_10.htm"TITLE="Repeating a vi Keymap ">31.10</A>,and<ACLASS="xref"HREF="ch31_14.htm"TITLE="Don't Lose Important Functions with vi Maps: Use noremap">31.14</A>.</P></LI><LICLASS="listitem"><PCLASS="para">Break long lines of text: article<ACLASS="xref"HREF="ch31_16.htm"TITLE="vi Macro for Splitting Long Lines ">31.16</A>.</P></LI></UL><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">EK</SPAN></P></DIV></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch30_38.htm"TITLE="30.38 Finding Your Place with Undo "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 30.38 Finding Your Place with Undo "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch31_02.htm"TITLE="31.2 Save Time and Typing with the vi map Commands "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 31.2 Save Time and Typing with the vi map Commands "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">30.38 Finding Your Place with Undo </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">31.2 Save Time and Typing with the vi map Commands </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -