annotate man/vip.texi @ 76576:f117baed9372

Fix typo in last commit.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 19 Mar 2007 15:53:24 +0000
parents 3d45362f1d38
children 88224dc74061 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1 \input texinfo
Dave Love <fx@gnu.org>
parents:
diff changeset
2
Dave Love <fx@gnu.org>
parents:
diff changeset
3 @setfilename ../info/vip
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @settitle VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
5
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
6 @copying
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52979
diff changeset
7 Copyright @copyright{} 1987, 2001, 2002, 2003, 2004,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71224
diff changeset
8 2005, 2006, 2007 Free Software Foundation, Inc.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
9
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
10 @quotation
37405
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
11 Permission is granted to copy, distribute and/or modify this document
65555
69b3598a61c5 Update all manuals to specify GFDL version 1.2.
Romain Francoise <romain@orebokech.com>
parents: 64890
diff changeset
12 under the terms of the GNU Free Documentation License, Version 1.2 or
37405
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
13 any later version published by the Free Software Foundation; with no
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
14 Invariant Sections, with the Front-Cover texts being ``A GNU
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
15 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
16 license is included in the section entitled ``GNU Free Documentation
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
17 License'' in the Emacs manual.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
18
37405
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
19 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
20 this GNU Manual, like GNU software. Copies published by the Free
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
21 Software Foundation raise funds for GNU development.''
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
22
37405
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
23 This document is part of a collection distributed under the GNU Free
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
24 Documentation License. If you want to distribute this document
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
25 separately from the collection, you can do so by adding a copy of the
36711f1790e0 Use GNU Free Documentation License.
Gerd Moellmann <gerd@gnu.org>
parents: 30009
diff changeset
26 license to the document, as described in section 6 of the license.
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
27 @end quotation
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
28 @end copying
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
29
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
30 @titlepage
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
31 @sp 10
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
32 @center @titlefont{VIP}
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
33 @sp 1
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
34 @center A Vi Package for GNU Emacs
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
35 @center (Version 3.5, September 15, 1987)
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
36 @sp 2
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
37 @center Masahiko Sato
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
38 @page
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
39 @vskip 0pt plus1filll
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
40 @insertcopying
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
41 @end titlepage
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
42
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
43 @dircategory Emacs
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
44 @direntry
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
45 * VIP: (vip). An older VI-emulation for Emacs.
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
46 @end direntry
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
47
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
48 @finalout
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
49
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
50 @ifnottex
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
51 @node Top, Survey,, (DIR)
Dave Love <fx@gnu.org>
parents:
diff changeset
52 @top VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 VIP is a Vi emulating package written in Emacs Lisp. VIP implements most
Dave Love <fx@gnu.org>
parents:
diff changeset
55 Vi commands including Ex commands. It is therefore hoped that this package
Dave Love <fx@gnu.org>
parents:
diff changeset
56 will enable you to do Vi style editing under the powerful GNU Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
57 environment. This info file describes the usage of VIP assuming that you
Dave Love <fx@gnu.org>
parents:
diff changeset
58 are fairly accustomed to Vi but not so much with Emacs. Also we will
Dave Love <fx@gnu.org>
parents:
diff changeset
59 concentrate mainly on differences from Vi, especially features unique to
Dave Love <fx@gnu.org>
parents:
diff changeset
60 VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
61
Dave Love <fx@gnu.org>
parents:
diff changeset
62 It is recommended that you read nodes on survey and on customization before
Dave Love <fx@gnu.org>
parents:
diff changeset
63 you start using VIP. Other nodes may be visited as needed.
Dave Love <fx@gnu.org>
parents:
diff changeset
64
Dave Love <fx@gnu.org>
parents:
diff changeset
65 Comments and bug reports are welcome. Please send messages to
Dave Love <fx@gnu.org>
parents:
diff changeset
66 @code{ms@@Sail.Stanford.Edu} if you are outside of Japan and to
Dave Love <fx@gnu.org>
parents:
diff changeset
67 @code{masahiko@@sato.riec.tohoku.junet} if you are in Japan.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
68
47737
0a70200bde27 use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents: 37987
diff changeset
69 @end ifnottex
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
70
Dave Love <fx@gnu.org>
parents:
diff changeset
71 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
72 * Survey:: A survey of VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
73 * Vi Commands:: Details of Vi commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
74 * Ex Commands:: Details of Ex commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
75 * Customization:: How to customize VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
76 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
77 @iftex
Dave Love <fx@gnu.org>
parents:
diff changeset
78 @unnumbered Introduction
Dave Love <fx@gnu.org>
parents:
diff changeset
79
Dave Love <fx@gnu.org>
parents:
diff changeset
80 VIP is a Vi emulating package written in Emacs Lisp. VIP implements most
Dave Love <fx@gnu.org>
parents:
diff changeset
81 Vi commands including Ex commands. It is therefore hoped that this package
Dave Love <fx@gnu.org>
parents:
diff changeset
82 will enable you to do Vi style editing under the powerful GNU Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
83 environment. This manual describes the usage of VIP assuming that you are
Dave Love <fx@gnu.org>
parents:
diff changeset
84 fairly accustomed to Vi but not so much with Emacs. Also we will
Dave Love <fx@gnu.org>
parents:
diff changeset
85 concentrate mainly on differences from Vi, especially features unique to
Dave Love <fx@gnu.org>
parents:
diff changeset
86 VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
87
Dave Love <fx@gnu.org>
parents:
diff changeset
88 It is recommended that you read chapters on survey and on customization
Dave Love <fx@gnu.org>
parents:
diff changeset
89 before you start using VIP. Other chapters may be used as future
Dave Love <fx@gnu.org>
parents:
diff changeset
90 references.
Dave Love <fx@gnu.org>
parents:
diff changeset
91
Dave Love <fx@gnu.org>
parents:
diff changeset
92 Comments and bug reports are welcome. Please send messages to
Dave Love <fx@gnu.org>
parents:
diff changeset
93 @code{ms@@Sail.Stanford.Edu} if you are outside of Japan and to
Dave Love <fx@gnu.org>
parents:
diff changeset
94 @code{masahiko@@unsun.riec.tohoku.junet} if you are in Japan.
Dave Love <fx@gnu.org>
parents:
diff changeset
95 @end iftex
Dave Love <fx@gnu.org>
parents:
diff changeset
96
Dave Love <fx@gnu.org>
parents:
diff changeset
97 @node Survey, Basic Concepts, Top, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
98 @chapter A Survey of VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
99
Dave Love <fx@gnu.org>
parents:
diff changeset
100 In this chapter we describe basics of VIP with emphasis on the features not
Dave Love <fx@gnu.org>
parents:
diff changeset
101 found in Vi and on how to use VIP under GNU Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
102
Dave Love <fx@gnu.org>
parents:
diff changeset
103 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
104 * Basic Concepts:: Basic concepts in Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
105 * Loading VIP:: How to load VIP automatically.
Dave Love <fx@gnu.org>
parents:
diff changeset
106 * Modes in VIP:: VIP has three modes, which are orthogonal to modes
Dave Love <fx@gnu.org>
parents:
diff changeset
107 in Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
108 * Differences from Vi:: Differences of VIP from Vi is explained.
Dave Love <fx@gnu.org>
parents:
diff changeset
109 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
110
Dave Love <fx@gnu.org>
parents:
diff changeset
111 @node Basic Concepts, Loading VIP, Survey, Survey
Dave Love <fx@gnu.org>
parents:
diff changeset
112 @section Basic Concepts
Dave Love <fx@gnu.org>
parents:
diff changeset
113
Dave Love <fx@gnu.org>
parents:
diff changeset
114 We begin by explaining some basic concepts of Emacs. These concepts are
Dave Love <fx@gnu.org>
parents:
diff changeset
115 explained in more detail in the GNU Emacs Manual.
Dave Love <fx@gnu.org>
parents:
diff changeset
116
Dave Love <fx@gnu.org>
parents:
diff changeset
117 @cindex buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
118 @cindex point
Dave Love <fx@gnu.org>
parents:
diff changeset
119 @cindex mark
Dave Love <fx@gnu.org>
parents:
diff changeset
120 @cindex text
Dave Love <fx@gnu.org>
parents:
diff changeset
121 @cindex looking at
Dave Love <fx@gnu.org>
parents:
diff changeset
122 @cindex end (of buffer)
Dave Love <fx@gnu.org>
parents:
diff changeset
123 @cindex region
Dave Love <fx@gnu.org>
parents:
diff changeset
124
52979
3649390c0f91 Replace @sc{ascii} and ASCII with @acronym{ASCII}.
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
125 Conceptually, a @dfn{buffer} is just a string of @acronym{ASCII} characters and two
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
126 special characters @key{PNT} (@dfn{point}) and @key{MRK} (@dfn{mark}) such
Dave Love <fx@gnu.org>
parents:
diff changeset
127 that the character @key{PNT} occurs exactly once and @key{MRK} occurs at
Dave Love <fx@gnu.org>
parents:
diff changeset
128 most once. The @dfn{text} of a buffer is obtained by deleting the
Dave Love <fx@gnu.org>
parents:
diff changeset
129 occurrences of @key{PNT} and @key{MRK}. If, in a buffer, there is a
Dave Love <fx@gnu.org>
parents:
diff changeset
130 character following @key{PNT} then we say that point is @dfn{looking at}
Dave Love <fx@gnu.org>
parents:
diff changeset
131 the character; otherwise we say that point is @dfn{at the end of buffer}.
Dave Love <fx@gnu.org>
parents:
diff changeset
132 @key{PNT} and @key{MRK} are used
Dave Love <fx@gnu.org>
parents:
diff changeset
133 to indicate positions in a buffer and they are not part of the text of the
Dave Love <fx@gnu.org>
parents:
diff changeset
134 buffer. If a buffer contains a @key{MRK} then the text between @key{MRK}
Dave Love <fx@gnu.org>
parents:
diff changeset
135 and @key{PNT} is called the @dfn{region} of the buffer.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
136
Dave Love <fx@gnu.org>
parents:
diff changeset
137 @cindex window
Dave Love <fx@gnu.org>
parents:
diff changeset
138
Dave Love <fx@gnu.org>
parents:
diff changeset
139 Emacs provides (multiple) @dfn{windows} on the screen, and you can see the
Dave Love <fx@gnu.org>
parents:
diff changeset
140 content of a buffer through the window associated with the buffer. The
Dave Love <fx@gnu.org>
parents:
diff changeset
141 cursor of the screen is always positioned on the character after @key{PNT}.
Dave Love <fx@gnu.org>
parents:
diff changeset
142 @refill
Dave Love <fx@gnu.org>
parents:
diff changeset
143
Dave Love <fx@gnu.org>
parents:
diff changeset
144 @cindex mode
Dave Love <fx@gnu.org>
parents:
diff changeset
145 @cindex keymap
Dave Love <fx@gnu.org>
parents:
diff changeset
146 @cindex local keymap
Dave Love <fx@gnu.org>
parents:
diff changeset
147 @cindex global keymap
Dave Love <fx@gnu.org>
parents:
diff changeset
148
Dave Love <fx@gnu.org>
parents:
diff changeset
149 A @dfn{keymap} is a table that records the bindings between characters and
Dave Love <fx@gnu.org>
parents:
diff changeset
150 command functions. There is the @dfn{global keymap} common to all the
Dave Love <fx@gnu.org>
parents:
diff changeset
151 buffers. Each buffer has its @dfn{local keymap} that determines the
Dave Love <fx@gnu.org>
parents:
diff changeset
152 @dfn{mode} of the buffer. Local keymap overrides global keymap, so that if
Dave Love <fx@gnu.org>
parents:
diff changeset
153 a function is bound to some key in the local keymap then that function will
Dave Love <fx@gnu.org>
parents:
diff changeset
154 be executed when you type the key. If no function is bound to a key in the
Dave Love <fx@gnu.org>
parents:
diff changeset
155 local map, however, the function bound to the key in the global map becomes
Dave Love <fx@gnu.org>
parents:
diff changeset
156 in effect.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
157
Dave Love <fx@gnu.org>
parents:
diff changeset
158 @node Loading VIP, Modes in VIP, Basic Concepts, Survey
Dave Love <fx@gnu.org>
parents:
diff changeset
159 @section Loading VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
160
Dave Love <fx@gnu.org>
parents:
diff changeset
161 The recommended way to load VIP automatically is to include the line:
Dave Love <fx@gnu.org>
parents:
diff changeset
162 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
163 (load "vip")
Dave Love <fx@gnu.org>
parents:
diff changeset
164 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
165 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
166 in your @file{.emacs} file. The @file{.emacs} file is placed in your home
Dave Love <fx@gnu.org>
parents:
diff changeset
167 directory and it will be executed every time you invoke Emacs. If you wish
Dave Love <fx@gnu.org>
parents:
diff changeset
168 to be in vi mode whenever Emacs starts up, you can include the following
Dave Love <fx@gnu.org>
parents:
diff changeset
169 line in your @file{.emacs} file instead of the above line:
Dave Love <fx@gnu.org>
parents:
diff changeset
170 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
171 (setq term-setup-hook 'vip-mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
172 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
173 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
174 (@xref{Vi Mode}, for the explanation of vi mode.)
Dave Love <fx@gnu.org>
parents:
diff changeset
175
Dave Love <fx@gnu.org>
parents:
diff changeset
176 Even if your @file{.emacs} file does not contain any of the above lines,
Dave Love <fx@gnu.org>
parents:
diff changeset
177 you can load VIP and enter vi mode by typing the following from within
Dave Love <fx@gnu.org>
parents:
diff changeset
178 Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
179 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
180 M-x vip-mode
Dave Love <fx@gnu.org>
parents:
diff changeset
181 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
182 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
183
Dave Love <fx@gnu.org>
parents:
diff changeset
184 @node Modes in VIP, Emacs Mode, Loading VIP, Survey
Dave Love <fx@gnu.org>
parents:
diff changeset
185 @section Modes in VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
186
Dave Love <fx@gnu.org>
parents:
diff changeset
187 @kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi})
Dave Love <fx@gnu.org>
parents:
diff changeset
188 @kindex 0301 @kbd{C-x C-z} (@code{suspend-emacs})
Dave Love <fx@gnu.org>
parents:
diff changeset
189
Dave Love <fx@gnu.org>
parents:
diff changeset
190 Loading VIP has the effect of globally binding @kbd{C-z} (@kbd{Control-z})
Dave Love <fx@gnu.org>
parents:
diff changeset
191 to the function @code{vip-change-mode-to-vi}. The default binding of @kbd{C-z}
Dave Love <fx@gnu.org>
parents:
diff changeset
192 in GNU Emacs is @code{suspend-emacs}, but, you can also call
Dave Love <fx@gnu.org>
parents:
diff changeset
193 @code{suspend-emacs} by typing @kbd{C-x C-z}. Other than this, all the
Dave Love <fx@gnu.org>
parents:
diff changeset
194 key bindings of Emacs remain the same after loading VIP.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
195
Dave Love <fx@gnu.org>
parents:
diff changeset
196 @cindex vi mode
Dave Love <fx@gnu.org>
parents:
diff changeset
197
Dave Love <fx@gnu.org>
parents:
diff changeset
198 Now, if you hit @kbd{C-z}, the function @code{vip-change-mode-to-vi} will be
Dave Love <fx@gnu.org>
parents:
diff changeset
199 called and you will be in @dfn{vi mode}. (Some major modes may locally bind
Dave Love <fx@gnu.org>
parents:
diff changeset
200 @kbd{C-z} to some special functions. In such cases, you can call
Dave Love <fx@gnu.org>
parents:
diff changeset
201 @code{vip-change-mode-to-vi} by @code{execute-extended-command} which is
Dave Love <fx@gnu.org>
parents:
diff changeset
202 invoked by @kbd{M-x}. Here @kbd{M-x} means @kbd{Meta-x}, and if your
Dave Love <fx@gnu.org>
parents:
diff changeset
203 terminal does not have a @key{META} key you can enter it by typing
Dave Love <fx@gnu.org>
parents:
diff changeset
204 @kbd{@key{ESC} x}. The same effect can also be achieve by typing
Dave Love <fx@gnu.org>
parents:
diff changeset
205 @kbd{M-x vip-mode}.)@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
206
Dave Love <fx@gnu.org>
parents:
diff changeset
207 @cindex mode line
Dave Love <fx@gnu.org>
parents:
diff changeset
208
Dave Love <fx@gnu.org>
parents:
diff changeset
209 You can observe the change of mode by looking at the @dfn{mode line}. For
Dave Love <fx@gnu.org>
parents:
diff changeset
210 instance, if the mode line is:@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
211 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
212 -----Emacs: *scratch* (Lisp Interaction)----All------------
Dave Love <fx@gnu.org>
parents:
diff changeset
213 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
214 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
215 then it will change to:
Dave Love <fx@gnu.org>
parents:
diff changeset
216 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
217 -----Vi: *scratch* (Lisp Interaction)----All------------
Dave Love <fx@gnu.org>
parents:
diff changeset
218 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
219 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
220 Thus the word @samp{Emacs} in the mode line will change to @samp{Vi}.
Dave Love <fx@gnu.org>
parents:
diff changeset
221
Dave Love <fx@gnu.org>
parents:
diff changeset
222 @cindex insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
223 @cindex emacs mode
Dave Love <fx@gnu.org>
parents:
diff changeset
224
Dave Love <fx@gnu.org>
parents:
diff changeset
225 You can go back to the original @dfn{emacs mode} by typing @kbd{C-z} in
Dave Love <fx@gnu.org>
parents:
diff changeset
226 vi mode. Thus @kbd{C-z} toggles between these two modes.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
227
Dave Love <fx@gnu.org>
parents:
diff changeset
228 Note that modes in VIP exist orthogonally to modes in Emacs. This means
Dave Love <fx@gnu.org>
parents:
diff changeset
229 that you can be in vi mode and at the same time, say, shell mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
230
Dave Love <fx@gnu.org>
parents:
diff changeset
231 Vi mode corresponds to Vi's command mode. From vi mode you can enter
Dave Love <fx@gnu.org>
parents:
diff changeset
232 @dfn{insert mode} (which corresponds to Vi's insert mode) by usual Vi command
Dave Love <fx@gnu.org>
parents:
diff changeset
233 keys like @kbd{i}, @kbd{a}, @kbd{o} @dots{} etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
234
Dave Love <fx@gnu.org>
parents:
diff changeset
235 In insert mode, the mode line will look like this:
Dave Love <fx@gnu.org>
parents:
diff changeset
236 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
237 -----Insert *scratch* (Lisp Interaction)----All------------
Dave Love <fx@gnu.org>
parents:
diff changeset
238 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
239 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
240 You can exit from insert mode by hitting @key{ESC} key as you do in Vi.
Dave Love <fx@gnu.org>
parents:
diff changeset
241
Dave Love <fx@gnu.org>
parents:
diff changeset
242 That VIP has three modes may seem very complicated, but in fact it is not
Dave Love <fx@gnu.org>
parents:
diff changeset
243 so. VIP is implemented so that you can do most editing remaining only
Dave Love <fx@gnu.org>
parents:
diff changeset
244 in the two modes for Vi (that is vi mode and insert mode).
Dave Love <fx@gnu.org>
parents:
diff changeset
245
Dave Love <fx@gnu.org>
parents:
diff changeset
246 @ifinfo
Dave Love <fx@gnu.org>
parents:
diff changeset
247 The figure below shows the transition of three modes in VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
248 @display
Dave Love <fx@gnu.org>
parents:
diff changeset
249
Dave Love <fx@gnu.org>
parents:
diff changeset
250
Dave Love <fx@gnu.org>
parents:
diff changeset
251 === C-z ==> == i,o ... ==>
Dave Love <fx@gnu.org>
parents:
diff changeset
252 emacs mode vi mode insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
253 <== X-z === <=== ESC ====
Dave Love <fx@gnu.org>
parents:
diff changeset
254 @end display
Dave Love <fx@gnu.org>
parents:
diff changeset
255 @end ifinfo
Dave Love <fx@gnu.org>
parents:
diff changeset
256
Dave Love <fx@gnu.org>
parents:
diff changeset
257 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
258 * Emacs Mode:: This is the mode you should know better.
Dave Love <fx@gnu.org>
parents:
diff changeset
259 * Vi Mode:: Vi commands are executed in this mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
260 * Insert Mode:: You can enter text, and also can do editing if you
Dave Love <fx@gnu.org>
parents:
diff changeset
261 know enough Emacs commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
262 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
263
Dave Love <fx@gnu.org>
parents:
diff changeset
264 @node Emacs Mode, Vi Mode, Modes in VIP, Modes in VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
265 @subsection Emacs Mode
Dave Love <fx@gnu.org>
parents:
diff changeset
266
Dave Love <fx@gnu.org>
parents:
diff changeset
267 @kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi})
Dave Love <fx@gnu.org>
parents:
diff changeset
268
Dave Love <fx@gnu.org>
parents:
diff changeset
269 You will be in this mode just after you loaded VIP. You can do all
Dave Love <fx@gnu.org>
parents:
diff changeset
270 normal Emacs editing in this mode. Note that the key @kbd{C-z} is globally
Dave Love <fx@gnu.org>
parents:
diff changeset
271 bound to @code{vip-change-mode-to-vi}. So, if you type @kbd{C-z} in this mode
Dave Love <fx@gnu.org>
parents:
diff changeset
272 then you will be in vi mode.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
273
Dave Love <fx@gnu.org>
parents:
diff changeset
274 @node Vi Mode, Insert Mode, Emacs Mode, Modes in VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
275 @subsection Vi Mode
Dave Love <fx@gnu.org>
parents:
diff changeset
276
Dave Love <fx@gnu.org>
parents:
diff changeset
277 This mode corresponds to Vi's command mode. Most Vi commands work as they
Dave Love <fx@gnu.org>
parents:
diff changeset
278 do in Vi. You can go back to emacs mode by typing @kbd{C-z}. You can
Dave Love <fx@gnu.org>
parents:
diff changeset
279 enter insert mode, just as in Vi, by typing @kbd{i}, @kbd{a} etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
280
Dave Love <fx@gnu.org>
parents:
diff changeset
281 @node Insert Mode, Differences from Vi, Vi Mode, Modes in VIP
Dave Love <fx@gnu.org>
parents:
diff changeset
282 @subsection Insert Mode
Dave Love <fx@gnu.org>
parents:
diff changeset
283
Dave Love <fx@gnu.org>
parents:
diff changeset
284 The key bindings in this mode is the same as in the emacs mode except for
Dave Love <fx@gnu.org>
parents:
diff changeset
285 the following 4 keys. So, you can move around in the buffer and change
Dave Love <fx@gnu.org>
parents:
diff changeset
286 its content while you are in insert mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
287
Dave Love <fx@gnu.org>
parents:
diff changeset
288 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
289 @item @key{ESC}
Dave Love <fx@gnu.org>
parents:
diff changeset
290 @kindex 033 @kbd{ESC} (@code{vip-change-mode-to-vi}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
291 This key will take you back to vi mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
292 @item C-h
Dave Love <fx@gnu.org>
parents:
diff changeset
293 @kindex 010 @kbd{C-h} (@code{vip-delete-backward-char}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
294 Delete previous character.
Dave Love <fx@gnu.org>
parents:
diff changeset
295 @item C-w
Dave Love <fx@gnu.org>
parents:
diff changeset
296 @kindex 027 @kbd{C-w} (@code{vip-delete-backward-word}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
297 Delete previous word.
Dave Love <fx@gnu.org>
parents:
diff changeset
298 @item C-z
Dave Love <fx@gnu.org>
parents:
diff changeset
299 @kindex 032 @kbd{C-z} (@code{vip-ESC}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
300 Typing this key has the same effect as typing @key{ESC} in emacs mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
301 Thus typing @kbd{C-z x} in insert mode will have the same effect as typing
Dave Love <fx@gnu.org>
parents:
diff changeset
302 @kbd{ESC x} in emacs mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
303 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
304
Dave Love <fx@gnu.org>
parents:
diff changeset
305 @node Differences from Vi, Undoing, Insert Mode, Survey
Dave Love <fx@gnu.org>
parents:
diff changeset
306 @section Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
307
Dave Love <fx@gnu.org>
parents:
diff changeset
308 The major differences from Vi are explained below.
Dave Love <fx@gnu.org>
parents:
diff changeset
309
Dave Love <fx@gnu.org>
parents:
diff changeset
310 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
311 * Undoing:: You can undo more in VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
312 * Changing:: Commands for changing the text.
Dave Love <fx@gnu.org>
parents:
diff changeset
313 * Searching:: Search commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
314 * z Command:: You can now use zH, zM and zL as well as z- etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
315 * Counts:: Some Vi commands which do not accept a count now
Dave Love <fx@gnu.org>
parents:
diff changeset
316 accept one.
Dave Love <fx@gnu.org>
parents:
diff changeset
317 * Marking:: You can now mark the current point, beginning of
Dave Love <fx@gnu.org>
parents:
diff changeset
318 the buffer etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
319 * Region Commands:: You can now give a region as an argument for delete
Dave Love <fx@gnu.org>
parents:
diff changeset
320 commands etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
321 * New Commands:: Some new commands not available in Vi are added.
Dave Love <fx@gnu.org>
parents:
diff changeset
322 * New Bindings:: Bindings of some keys are changed for the
Dave Love <fx@gnu.org>
parents:
diff changeset
323 convenience of editing under Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
324 * Window Commands:: Commands for moving among windows etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
325 * Buffer Commands:: Commands for selecting buffers etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
326 * File Commands:: Commands for visiting files etc.
Dave Love <fx@gnu.org>
parents:
diff changeset
327 * Misc Commands:: Other useful commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
328 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
329
Dave Love <fx@gnu.org>
parents:
diff changeset
330 @node Undoing, Changing, Differences from Vi, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
331 @subsection Undoing
Dave Love <fx@gnu.org>
parents:
diff changeset
332
Dave Love <fx@gnu.org>
parents:
diff changeset
333 @kindex 165 @kbd{u} (@code{vip-undo})
Dave Love <fx@gnu.org>
parents:
diff changeset
334 @kindex 056 @kbd{.} (@code{vip-repeat})
Dave Love <fx@gnu.org>
parents:
diff changeset
335
Dave Love <fx@gnu.org>
parents:
diff changeset
336 You can repeat undoing by the @kbd{.} key. So, @kbd{u} will undo
Dave Love <fx@gnu.org>
parents:
diff changeset
337 a single change, while @kbd{u .@: .@: .@:}, for instance, will undo 4 previous
Dave Love <fx@gnu.org>
parents:
diff changeset
338 changes. Undo is undoable as in Vi. So the content of the buffer will
Dave Love <fx@gnu.org>
parents:
diff changeset
339 be the same before and after @kbd{u u}.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
340
Dave Love <fx@gnu.org>
parents:
diff changeset
341 @node Changing, Searching, Undoing, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
342 @subsection Changing
Dave Love <fx@gnu.org>
parents:
diff changeset
343
Dave Love <fx@gnu.org>
parents:
diff changeset
344 Some commands which change a small number of characters are executed
Dave Love <fx@gnu.org>
parents:
diff changeset
345 slightly differently. Thus, if point is at the beginning of a word
Dave Love <fx@gnu.org>
parents:
diff changeset
346 @samp{foo} and you wished to change it to @samp{bar} by typing @w{@kbd{c w}},
Dave Love <fx@gnu.org>
parents:
diff changeset
347 then VIP will prompt you for a new word in the minibuffer by the prompt
Dave Love <fx@gnu.org>
parents:
diff changeset
348 @samp{foo => }. You can then enter @samp{bar} followed by @key{RET} or
Dave Love <fx@gnu.org>
parents:
diff changeset
349 @key{ESC} to complete the command. Before you enter @key{RET} or
Dave Love <fx@gnu.org>
parents:
diff changeset
350 @key{ESC} you can abort the command by typing @kbd{C-g}. In general,
Dave Love <fx@gnu.org>
parents:
diff changeset
351 @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit})
Dave Love <fx@gnu.org>
parents:
diff changeset
352 you can abort a partially formed command by typing @kbd{C-g}.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
353
Dave Love <fx@gnu.org>
parents:
diff changeset
354 @node Searching, z Command, Changing, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
355 @subsection Searching
Dave Love <fx@gnu.org>
parents:
diff changeset
356
Dave Love <fx@gnu.org>
parents:
diff changeset
357 @kindex 057 @kbd{/} (@code{vip-search-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
358 @kindex 077 @kbd{?} (@code{vip-search-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
359
Dave Love <fx@gnu.org>
parents:
diff changeset
360 As in Vi, searching is done by @kbd{/} and @kbd{?}. The string will be
Dave Love <fx@gnu.org>
parents:
diff changeset
361 searched literally by default. To invoke a regular expression search,
Dave Love <fx@gnu.org>
parents:
diff changeset
362 first execute the search command @kbd{/} (or @kbd{?}) with empty search
Dave Love <fx@gnu.org>
parents:
diff changeset
363 string. (I.e, type @kbd{/} followed by @key{RET}.)
Dave Love <fx@gnu.org>
parents:
diff changeset
364 A search for empty string will toggle the search mode between vanilla
Dave Love <fx@gnu.org>
parents:
diff changeset
365 search and regular expression search. You cannot give an offset to the
Dave Love <fx@gnu.org>
parents:
diff changeset
366 search string. (It is a limitation.) By default, search will wrap around
Dave Love <fx@gnu.org>
parents:
diff changeset
367 the buffer as in Vi. You can change this by rebinding the variable
Dave Love <fx@gnu.org>
parents:
diff changeset
368 @code{vip-search-wrap-around}. @xref{Customization}, for how to do this.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
369
Dave Love <fx@gnu.org>
parents:
diff changeset
370 @node z Command, Counts, Searching, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
371 @subsection z Command
Dave Love <fx@gnu.org>
parents:
diff changeset
372
Dave Love <fx@gnu.org>
parents:
diff changeset
373 @kindex 1723 @kbd{z H} (@code{vip-line-to-top})
Dave Love <fx@gnu.org>
parents:
diff changeset
374 @kindex 1721 @kbd{z RET} (@code{vip-line-to-top})
Dave Love <fx@gnu.org>
parents:
diff changeset
375 @kindex 1723 @kbd{z M} (@code{vip-line-to-middle})
Dave Love <fx@gnu.org>
parents:
diff changeset
376 @kindex 1722 @kbd{z .} (@code{vip-line-to-middle})
Dave Love <fx@gnu.org>
parents:
diff changeset
377 @kindex 1723 @kbd{z L} (@code{vip-line-to-bottom})
Dave Love <fx@gnu.org>
parents:
diff changeset
378 @kindex 1722 @kbd{z -} (@code{vip-line-to-bottom})
Dave Love <fx@gnu.org>
parents:
diff changeset
379
Dave Love <fx@gnu.org>
parents:
diff changeset
380 For those of you who cannot remember which of @kbd{z} followed by @key{RET},
Dave Love <fx@gnu.org>
parents:
diff changeset
381 @kbd{.}@: and @kbd{-} do what. You can also use @kbd{z} followed by @kbd{H},
Dave Love <fx@gnu.org>
parents:
diff changeset
382 @kbd{M} and @kbd{L} to place the current line in the Home (Middle, and
Dave Love <fx@gnu.org>
parents:
diff changeset
383 Last) line of the window.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
384
Dave Love <fx@gnu.org>
parents:
diff changeset
385 @node Counts, Marking, z Command, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
386 @subsection Counts
Dave Love <fx@gnu.org>
parents:
diff changeset
387
Dave Love <fx@gnu.org>
parents:
diff changeset
388 Some Vi commands which do not accept a count now accept one
Dave Love <fx@gnu.org>
parents:
diff changeset
389
Dave Love <fx@gnu.org>
parents:
diff changeset
390 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
391 @item p
Dave Love <fx@gnu.org>
parents:
diff changeset
392 @itemx P
Dave Love <fx@gnu.org>
parents:
diff changeset
393 @kindex 160 @kbd{p} (@code{vip-put-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
394 @kindex 120 @kbd{P} (@code{vip-Put-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
395 Given counts, text will be yanked (in Vi's sense) that many times. Thus
Dave Love <fx@gnu.org>
parents:
diff changeset
396 @kbd{3 p} is the same as @kbd{p p p}.
Dave Love <fx@gnu.org>
parents:
diff changeset
397 @item o
Dave Love <fx@gnu.org>
parents:
diff changeset
398 @itemx O
Dave Love <fx@gnu.org>
parents:
diff changeset
399 @kindex 157 @kbd{o} (@code{vip-open-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
400 @kindex 117 @kbd{O} (@code{vip-Open-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
401 Given counts, that many copies of text will be inserted. Thus
Dave Love <fx@gnu.org>
parents:
diff changeset
402 @kbd{o a b c @key{ESC}} will insert 3 lines of @samp{abc} below the current
Dave Love <fx@gnu.org>
parents:
diff changeset
403 line.
Dave Love <fx@gnu.org>
parents:
diff changeset
404 @item /
Dave Love <fx@gnu.org>
parents:
diff changeset
405 @itemx ?
Dave Love <fx@gnu.org>
parents:
diff changeset
406 @kindex 057 @kbd{/} (@code{vip-search-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
407 @kindex 077 @kbd{?} (@code{vip-search-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
408 Given a count @var{n}, @var{n}-th occurrence will be searched.
Dave Love <fx@gnu.org>
parents:
diff changeset
409 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
410
Dave Love <fx@gnu.org>
parents:
diff changeset
411 @node Marking, Region Commands, Counts, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
412 @subsection Marking
Dave Love <fx@gnu.org>
parents:
diff changeset
413
Dave Love <fx@gnu.org>
parents:
diff changeset
414 Typing an @kbd{m} followed by a lower-case character @var{ch} marks the
Dave Love <fx@gnu.org>
parents:
diff changeset
415 point to the register named @var{ch} as in Vi. In addition to these, we
Dave Love <fx@gnu.org>
parents:
diff changeset
416 have following key bindings for marking.
Dave Love <fx@gnu.org>
parents:
diff changeset
417
Dave Love <fx@gnu.org>
parents:
diff changeset
418 @kindex 155 @kbd{m} (@code{vip-mark-point})
Dave Love <fx@gnu.org>
parents:
diff changeset
419
Dave Love <fx@gnu.org>
parents:
diff changeset
420 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
421 @item m <
Dave Love <fx@gnu.org>
parents:
diff changeset
422 Set mark at the beginning of buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
423 @item m >
Dave Love <fx@gnu.org>
parents:
diff changeset
424 Set mark at the end of buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
425 @item m .
Dave Love <fx@gnu.org>
parents:
diff changeset
426 Set mark at point (and push old mark on mark ring).
Dave Love <fx@gnu.org>
parents:
diff changeset
427 @item m ,
Dave Love <fx@gnu.org>
parents:
diff changeset
428 Jump to mark (and pop mark off the mark ring).
Dave Love <fx@gnu.org>
parents:
diff changeset
429 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
430
Dave Love <fx@gnu.org>
parents:
diff changeset
431 @node Region Commands, New Commands, Marking, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
432 @subsection Region Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
433
Dave Love <fx@gnu.org>
parents:
diff changeset
434 @cindex region
Dave Love <fx@gnu.org>
parents:
diff changeset
435
Dave Love <fx@gnu.org>
parents:
diff changeset
436 Vi operators like @kbd{d}, @kbd{c} etc. are usually used in combination
Dave Love <fx@gnu.org>
parents:
diff changeset
437 with motion commands. It is now possible to use current region as the
Dave Love <fx@gnu.org>
parents:
diff changeset
438 argument to these operators. (A @dfn{region} is a part of buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
439 delimited by point and mark.) The key @kbd{r} is used for this purpose.
Dave Love <fx@gnu.org>
parents:
diff changeset
440 Thus @kbd{d r} will delete the current region. If @kbd{R} is used instead
Dave Love <fx@gnu.org>
parents:
diff changeset
441 of @kbd{r} the region will first be enlarged so that it will become the
Dave Love <fx@gnu.org>
parents:
diff changeset
442 smallest region containing the original region and consisting of whole
Dave Love <fx@gnu.org>
parents:
diff changeset
443 lines. Thus @kbd{m .@: d R} will have the same effect as @kbd{d d}.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
444
Dave Love <fx@gnu.org>
parents:
diff changeset
445 @node New Commands, New Bindings, Region Commands, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
446 @subsection Some New Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
447
Dave Love <fx@gnu.org>
parents:
diff changeset
448 Note that the keys below (except for @kbd{R}) are not used in Vi.
Dave Love <fx@gnu.org>
parents:
diff changeset
449
Dave Love <fx@gnu.org>
parents:
diff changeset
450 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
451 @item C-a
Dave Love <fx@gnu.org>
parents:
diff changeset
452 @kindex 001 @kbd{C-a} (@code{vip-beginning-of-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
453 Move point to the beginning of line.
Dave Love <fx@gnu.org>
parents:
diff changeset
454 @item C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
455 @kindex 016 @kbd{C-n} (@code{vip-next-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
456 If you have two or more windows in the screen, this key will move point to
Dave Love <fx@gnu.org>
parents:
diff changeset
457 the next window.
Dave Love <fx@gnu.org>
parents:
diff changeset
458 @item C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
459 @kindex 017 @kbd{C-o} (@code{vip-open-line-at-point})
Dave Love <fx@gnu.org>
parents:
diff changeset
460 Insert a newline and leave point before it, and then enter insert mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
461 @item C-r
Dave Love <fx@gnu.org>
parents:
diff changeset
462 @kindex 022 @kbd{C-r} (@code{isearch-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
463 Backward incremental search.
Dave Love <fx@gnu.org>
parents:
diff changeset
464 @item C-s
Dave Love <fx@gnu.org>
parents:
diff changeset
465 @kindex 023 @kbd{C-s} (@code{isearch-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
466 Forward incremental search.
Dave Love <fx@gnu.org>
parents:
diff changeset
467 @item C-c
Dave Love <fx@gnu.org>
parents:
diff changeset
468 @itemx C-x
Dave Love <fx@gnu.org>
parents:
diff changeset
469 @itemx @key{ESC}
Dave Love <fx@gnu.org>
parents:
diff changeset
470 @kindex 003 @kbd{C-c} (@code{vip-ctl-c})
Dave Love <fx@gnu.org>
parents:
diff changeset
471 @kindex 0300 @kbd{C-x} (@code{vip-ctl-x})
Dave Love <fx@gnu.org>
parents:
diff changeset
472 @kindex 033 @kbd{ESC} (@code{vip-ESC})
Dave Love <fx@gnu.org>
parents:
diff changeset
473 These keys will exit from vi mode and return to emacs mode temporarily. If
Dave Love <fx@gnu.org>
parents:
diff changeset
474 you hit one of these keys, Emacs will be in emacs mode and will believe
Dave Love <fx@gnu.org>
parents:
diff changeset
475 that you hit that key in emacs mode. For example, if you hit @kbd{C-x}
Dave Love <fx@gnu.org>
parents:
diff changeset
476 followed by @kbd{2}, then the current window will be split into 2 and you
Dave Love <fx@gnu.org>
parents:
diff changeset
477 will be in vi mode again.
Dave Love <fx@gnu.org>
parents:
diff changeset
478 @item \
Dave Love <fx@gnu.org>
parents:
diff changeset
479 @kindex 134 @kbd{\} (@code{vip-escape-to-emacs})
Dave Love <fx@gnu.org>
parents:
diff changeset
480 Escape to emacs mode. Hitting @kbd{\} will take you to emacs mode, and you
Dave Love <fx@gnu.org>
parents:
diff changeset
481 can execute a single Emacs command. After executing the Emacs command you
Dave Love <fx@gnu.org>
parents:
diff changeset
482 will be in vi mode again. You can give a count before typing @kbd{\}.
Dave Love <fx@gnu.org>
parents:
diff changeset
483 Thus @kbd{5 \ *}, as well as @kbd{\ C-u 5 *}, will insert @samp{*****}
Dave Love <fx@gnu.org>
parents:
diff changeset
484 before point. Similarly @kbd{1 0 \ C-p} will move the point 10 lines above
Dave Love <fx@gnu.org>
parents:
diff changeset
485 the current line.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
486 @item K
Dave Love <fx@gnu.org>
parents:
diff changeset
487 @kindex 113 @kbd{K} (@code{vip-kill-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
488 Kill current buffer if it is not modified. Useful when you selected a
Dave Love <fx@gnu.org>
parents:
diff changeset
489 buffer which you did not want.
Dave Love <fx@gnu.org>
parents:
diff changeset
490 @item Q
Dave Love <fx@gnu.org>
parents:
diff changeset
491 @itemx R
Dave Love <fx@gnu.org>
parents:
diff changeset
492 @kindex 121 @kbd{Q} (@code{vip-query-replace})
Dave Love <fx@gnu.org>
parents:
diff changeset
493 @kindex 122 @kbd{R} (@code{vip-replace-string})
Dave Love <fx@gnu.org>
parents:
diff changeset
494 @kbd{Q} is for query replace and @kbd{R} is for replace. By default,
Dave Love <fx@gnu.org>
parents:
diff changeset
495 string to be replaced are treated literally. If you wish to do a regular
Dave Love <fx@gnu.org>
parents:
diff changeset
496 expression replace, first do replace with empty string as the string to be
Dave Love <fx@gnu.org>
parents:
diff changeset
497 replaced. In this way, you can toggle between vanilla and regular
Dave Love <fx@gnu.org>
parents:
diff changeset
498 expression replacement.
Dave Love <fx@gnu.org>
parents:
diff changeset
499 @item v
Dave Love <fx@gnu.org>
parents:
diff changeset
500 @itemx V
Dave Love <fx@gnu.org>
parents:
diff changeset
501 @kindex 166 @kbd{v} (@code{vip-find-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
502 @kindex 126 @kbd{V} (@code{vip-find-file-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
503 These keys are used to Visit files. @kbd{v} will switch to a buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
504 visiting file whose name can be entered in the minibuffer. @kbd{V} is
Dave Love <fx@gnu.org>
parents:
diff changeset
505 similar, but will use window different from the current window.
Dave Love <fx@gnu.org>
parents:
diff changeset
506 @item #
Dave Love <fx@gnu.org>
parents:
diff changeset
507 @kindex 0430 @kbd{#} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
508 If followed by a certain character @var{ch}, it becomes an operator whose
Dave Love <fx@gnu.org>
parents:
diff changeset
509 argument is the region determined by the motion command that follows.
Dave Love <fx@gnu.org>
parents:
diff changeset
510 Currently, @var{ch} can be one of @kbd{c}, @kbd{C}, @kbd{g}, @kbd{q} and
Dave Love <fx@gnu.org>
parents:
diff changeset
511 @kbd{s}.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
512 @item # c
Dave Love <fx@gnu.org>
parents:
diff changeset
513 @kindex 0432 @kbd{# c} (@code{downcase-region})
Dave Love <fx@gnu.org>
parents:
diff changeset
514 Change upper-case characters in the region to lower case
Dave Love <fx@gnu.org>
parents:
diff changeset
515 (@code{downcase-region}).
Dave Love <fx@gnu.org>
parents:
diff changeset
516 @item # C
Dave Love <fx@gnu.org>
parents:
diff changeset
517 @kindex 0431 @kbd{# C} (@code{upcase-region})
Dave Love <fx@gnu.org>
parents:
diff changeset
518 Change lower-case characters in the region to upper case. For instance,
Dave Love <fx@gnu.org>
parents:
diff changeset
519 @kbd{# C 3 w} will capitalize 3 words from the current point
Dave Love <fx@gnu.org>
parents:
diff changeset
520 (@code{upcase-region}).
Dave Love <fx@gnu.org>
parents:
diff changeset
521 @item # g
Dave Love <fx@gnu.org>
parents:
diff changeset
522 @kindex 0432 @kbd{# g} (@code{vip-global-execute})
Dave Love <fx@gnu.org>
parents:
diff changeset
523 Execute last keyboard macro for each line in the region
Dave Love <fx@gnu.org>
parents:
diff changeset
524 (@code{vip-global-execute}).@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
525 @item # q
Dave Love <fx@gnu.org>
parents:
diff changeset
526 @kindex 0432 @kbd{# q} (@code{vip-quote-region})
Dave Love <fx@gnu.org>
parents:
diff changeset
527 Insert specified string at the beginning of each line in the region
Dave Love <fx@gnu.org>
parents:
diff changeset
528 (@code{vip-quote-region}).
Dave Love <fx@gnu.org>
parents:
diff changeset
529 @item # s
Dave Love <fx@gnu.org>
parents:
diff changeset
530 @kindex 0432 @kbd{# s} (@code{spell-region})
Dave Love <fx@gnu.org>
parents:
diff changeset
531 Check spelling of words in the region (@code{spell-region}).
Dave Love <fx@gnu.org>
parents:
diff changeset
532 @item *
Dave Love <fx@gnu.org>
parents:
diff changeset
533 @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro})
Dave Love <fx@gnu.org>
parents:
diff changeset
534 Call last keyboard macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
535 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
536
Dave Love <fx@gnu.org>
parents:
diff changeset
537 @node New Bindings, Window Commands, New Commands, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
538 @subsection New Key Bindings
Dave Love <fx@gnu.org>
parents:
diff changeset
539
Dave Love <fx@gnu.org>
parents:
diff changeset
540 In VIP the meanings of some keys are entirely different from Vi. These key
Dave Love <fx@gnu.org>
parents:
diff changeset
541 bindings are done deliberately in the hope that editing under Emacs will
Dave Love <fx@gnu.org>
parents:
diff changeset
542 become easier. It is however possible to rebind these keys to functions
Dave Love <fx@gnu.org>
parents:
diff changeset
543 which behave similarly as in Vi. @xref{Customizing Key Bindings}, for
Dave Love <fx@gnu.org>
parents:
diff changeset
544 details.
Dave Love <fx@gnu.org>
parents:
diff changeset
545
Dave Love <fx@gnu.org>
parents:
diff changeset
546 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
547 @item C-g
Dave Love <fx@gnu.org>
parents:
diff changeset
548 @itemx g
Dave Love <fx@gnu.org>
parents:
diff changeset
549 @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit})
Dave Love <fx@gnu.org>
parents:
diff changeset
550 @kindex 147 @kbd{g} (@code{vip-info-on-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
551 In Vi, @kbd{C-g} is used to get information about the file associated to
Dave Love <fx@gnu.org>
parents:
diff changeset
552 the current buffer. Here, @kbd{g} will do that, and @kbd{C-g} is
Dave Love <fx@gnu.org>
parents:
diff changeset
553 used to abort a command (this is for compatibility with emacs mode.)
Dave Love <fx@gnu.org>
parents:
diff changeset
554 @item SPC
Dave Love <fx@gnu.org>
parents:
diff changeset
555 @itemx @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
556 @kindex 040 @kbd{SPC} (@code{vip-scroll})
Dave Love <fx@gnu.org>
parents:
diff changeset
557 @kindex 015 @kbd{RET} (@code{vip-scroll-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
558 Now these keys will scroll up and down the text of current window.
Dave Love <fx@gnu.org>
parents:
diff changeset
559 Convenient for viewing the text.
Dave Love <fx@gnu.org>
parents:
diff changeset
560 @item s
Dave Love <fx@gnu.org>
parents:
diff changeset
561 @itemx S
Dave Love <fx@gnu.org>
parents:
diff changeset
562 @kindex 163 @kbd{s} (@code{vip-switch-to-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
563 @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
564 They are used to switch to a specified buffer. Useful for switching to
Dave Love <fx@gnu.org>
parents:
diff changeset
565 already existing buffer since buffer name completion is provided. Also
Dave Love <fx@gnu.org>
parents:
diff changeset
566 a default buffer will be given as part of the prompt, to which you can
Dave Love <fx@gnu.org>
parents:
diff changeset
567 switch by just typing @key{RET} key. @kbd{s} is used to select buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
568 in the current window, while @kbd{S} selects buffer in another window.
Dave Love <fx@gnu.org>
parents:
diff changeset
569 @item C
Dave Love <fx@gnu.org>
parents:
diff changeset
570 @itemx X
Dave Love <fx@gnu.org>
parents:
diff changeset
571 @kindex 103 @kbd{C} (@code{vip-ctl-c-equivalent})
Dave Love <fx@gnu.org>
parents:
diff changeset
572 @kindex 1300 @kbd{X} (@code{vip-ctl-x-equivalent})
Dave Love <fx@gnu.org>
parents:
diff changeset
573 These keys will exit from vi mode and return to emacs mode temporarily.
Dave Love <fx@gnu.org>
parents:
diff changeset
574 If you type @kbd{C} (@kbd{X}), Emacs will be in emacs mode and will believe
Dave Love <fx@gnu.org>
parents:
diff changeset
575 that you have typed @kbd{C-c} (@kbd{C-x}, resp.) in emacs mode. Moreover,
Dave Love <fx@gnu.org>
parents:
diff changeset
576 if the following character you type is an upper-case letter, then Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
577 will believe that you have typed the corresponding control character.
Dave Love <fx@gnu.org>
parents:
diff changeset
578 You will be in vi mode again after the command is executed. For example,
Dave Love <fx@gnu.org>
parents:
diff changeset
579 typing @kbd{X S} in vi mode is the same as typing @kbd{C-x C-s} in emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
580 mode. You get the same effect by typing @kbd{C-x C-s} in vi mode, but
Dave Love <fx@gnu.org>
parents:
diff changeset
581 the idea here is that you can execute useful Emacs commands without typing
Dave Love <fx@gnu.org>
parents:
diff changeset
582 control characters. For example, if you hit @kbd{X} (or @kbd{C-x}) followed
Dave Love <fx@gnu.org>
parents:
diff changeset
583 by @kbd{2}, then the current window will be split into 2 and you will be in
Dave Love <fx@gnu.org>
parents:
diff changeset
584 vi mode again.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
585 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
586
Dave Love <fx@gnu.org>
parents:
diff changeset
587 In addition to these, @code{ctl-x-map} is slightly modified:
Dave Love <fx@gnu.org>
parents:
diff changeset
588
Dave Love <fx@gnu.org>
parents:
diff changeset
589 @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows})
Dave Love <fx@gnu.org>
parents:
diff changeset
590
Dave Love <fx@gnu.org>
parents:
diff changeset
591 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
592 @item X 3
Dave Love <fx@gnu.org>
parents:
diff changeset
593 @itemx C-x 3
Dave Love <fx@gnu.org>
parents:
diff changeset
594 This is equivalent to @kbd{C-x 1 C-x 2} (1 + 2 = 3).
Dave Love <fx@gnu.org>
parents:
diff changeset
595 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
596
Dave Love <fx@gnu.org>
parents:
diff changeset
597 @node Window Commands, Buffer Commands, New Bindings, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
598 @subsection Window Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
599
Dave Love <fx@gnu.org>
parents:
diff changeset
600 In this and following subsections, we give a summary of key bindings for
Dave Love <fx@gnu.org>
parents:
diff changeset
601 basic functions related to windows, buffers and files.
Dave Love <fx@gnu.org>
parents:
diff changeset
602
Dave Love <fx@gnu.org>
parents:
diff changeset
603 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
604 @item C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
605 @kindex 016 @kbd{C-n} (@code{vip-next-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
606 Switch to next window.
Dave Love <fx@gnu.org>
parents:
diff changeset
607 @item X 1
Dave Love <fx@gnu.org>
parents:
diff changeset
608 @itemx C-x 1
Dave Love <fx@gnu.org>
parents:
diff changeset
609 @kindex 1301 @kbd{X 1} (@code{delete-other-windows})
Dave Love <fx@gnu.org>
parents:
diff changeset
610 Delete other windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
611 @item X 2
Dave Love <fx@gnu.org>
parents:
diff changeset
612 @itemx C-x 2
Dave Love <fx@gnu.org>
parents:
diff changeset
613 @kindex 1301 @kbd{X 2} (@code{split-window-vertically})
Dave Love <fx@gnu.org>
parents:
diff changeset
614 Split current window into two windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
615 @item X 3
Dave Love <fx@gnu.org>
parents:
diff changeset
616 @itemx C-x 3
Dave Love <fx@gnu.org>
parents:
diff changeset
617 @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows})
Dave Love <fx@gnu.org>
parents:
diff changeset
618 Show current buffer in two windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
619 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
620
Dave Love <fx@gnu.org>
parents:
diff changeset
621 @node Buffer Commands, File Commands, Window Commands, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
622 @subsection Buffer Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
623
Dave Love <fx@gnu.org>
parents:
diff changeset
624 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
625 @item s
Dave Love <fx@gnu.org>
parents:
diff changeset
626 @kindex 163 @kbd{s} (@code{vip-switch-to-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
627 Switch to the specified buffer in the current window
Dave Love <fx@gnu.org>
parents:
diff changeset
628 (@code{vip-switch-to-buffer}).
Dave Love <fx@gnu.org>
parents:
diff changeset
629 @item S
Dave Love <fx@gnu.org>
parents:
diff changeset
630 @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
631 Switch to the specified buffer in another window
Dave Love <fx@gnu.org>
parents:
diff changeset
632 (@code{vip-switch-to-buffer-other-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
633 @item K
Dave Love <fx@gnu.org>
parents:
diff changeset
634 @kindex 113 @kbd{K} (@code{vip-kill-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
635 Kill the current buffer if it is not modified.
Dave Love <fx@gnu.org>
parents:
diff changeset
636 @item X S
Dave Love <fx@gnu.org>
parents:
diff changeset
637 @itemx C-x C-s
Dave Love <fx@gnu.org>
parents:
diff changeset
638 @kindex 1302 @kbd{X S} (@code{save-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
639 Save the current buffer in the file associated to the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
640 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
641
Dave Love <fx@gnu.org>
parents:
diff changeset
642 @node File Commands, Misc Commands, Buffer Commands, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
643 @subsection File Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
644
Dave Love <fx@gnu.org>
parents:
diff changeset
645 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
646 @item v
Dave Love <fx@gnu.org>
parents:
diff changeset
647 @kindex 166 @kbd{v} (@code{vip-find-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
648 Visit specified file in the current window.
Dave Love <fx@gnu.org>
parents:
diff changeset
649 @item V
Dave Love <fx@gnu.org>
parents:
diff changeset
650 @kindex 126 @kbd{V} (@code{vip-find-file-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
651 Visit specified file in another window.
Dave Love <fx@gnu.org>
parents:
diff changeset
652 @item X W
Dave Love <fx@gnu.org>
parents:
diff changeset
653 @itemx C-x C-w
Dave Love <fx@gnu.org>
parents:
diff changeset
654 @kindex 1302 @kbd{X W} (@code{write-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
655 Write current buffer into the specified file.
Dave Love <fx@gnu.org>
parents:
diff changeset
656 @item X I
Dave Love <fx@gnu.org>
parents:
diff changeset
657 @itemx C-x C-i
Dave Love <fx@gnu.org>
parents:
diff changeset
658 @kindex 1302 @kbd{X I} (@code{insert-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
659
Dave Love <fx@gnu.org>
parents:
diff changeset
660 Insert specified file at point.
Dave Love <fx@gnu.org>
parents:
diff changeset
661 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
662
Dave Love <fx@gnu.org>
parents:
diff changeset
663 @node Misc Commands, Vi Commands, File Commands, Differences from Vi
Dave Love <fx@gnu.org>
parents:
diff changeset
664 @subsection Miscellaneous Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
665
Dave Love <fx@gnu.org>
parents:
diff changeset
666 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
667 @item X (
Dave Love <fx@gnu.org>
parents:
diff changeset
668 @itemx C-x (
Dave Love <fx@gnu.org>
parents:
diff changeset
669 @kindex 1301 @kbd{X (} (@code{start-kbd-macro})
Dave Love <fx@gnu.org>
parents:
diff changeset
670 Start remembering keyboard macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
671 @item X )
Dave Love <fx@gnu.org>
parents:
diff changeset
672 @itemx C-x )
Dave Love <fx@gnu.org>
parents:
diff changeset
673 @kindex 1301 @kbd{X )} (@code{end-kbd-macro})
Dave Love <fx@gnu.org>
parents:
diff changeset
674 Finish remembering keyboard macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
675 @item *
Dave Love <fx@gnu.org>
parents:
diff changeset
676 @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro})
Dave Love <fx@gnu.org>
parents:
diff changeset
677 Call last remembered keyboard macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
678 @item X Z
Dave Love <fx@gnu.org>
parents:
diff changeset
679 @itemx C-x C-z
Dave Love <fx@gnu.org>
parents:
diff changeset
680 @kindex 1302 @kbd{X Z} (@code{suspend-emacs})
Dave Love <fx@gnu.org>
parents:
diff changeset
681 Suspend Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
682 @item Z Z
Dave Love <fx@gnu.org>
parents:
diff changeset
683 Exit Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
684 @itemx Q
Dave Love <fx@gnu.org>
parents:
diff changeset
685 Query replace.
Dave Love <fx@gnu.org>
parents:
diff changeset
686 @itemx R
Dave Love <fx@gnu.org>
parents:
diff changeset
687 Replace.
Dave Love <fx@gnu.org>
parents:
diff changeset
688 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
689
Dave Love <fx@gnu.org>
parents:
diff changeset
690 @node Vi Commands, Numeric Arguments, Misc Commands, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
691 @chapter Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
692
Dave Love <fx@gnu.org>
parents:
diff changeset
693 This chapter describes Vi commands other than Ex commands implemented in
Dave Love <fx@gnu.org>
parents:
diff changeset
694 VIP. Except for the last section which discusses insert mode, all the
Dave Love <fx@gnu.org>
parents:
diff changeset
695 commands described in this chapter are to be used in vi mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
696
Dave Love <fx@gnu.org>
parents:
diff changeset
697 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
698 * Numeric Arguments:: Many commands accept numeric arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
699 * Important Keys:: Some very important keys.
Dave Love <fx@gnu.org>
parents:
diff changeset
700 * Buffers and Windows:: Commands for handling buffers and windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
701 * Files:: Commands for handling files.
Dave Love <fx@gnu.org>
parents:
diff changeset
702 * Viewing the Buffer:: How you can view the current buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
703 * Mark Commands:: Marking positions in a buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
704 * Motion Commands:: Commands for moving point.
Dave Love <fx@gnu.org>
parents:
diff changeset
705 * Searching and Replacing:: Commands for searching and replacing.
Dave Love <fx@gnu.org>
parents:
diff changeset
706 * Modifying Commands:: Commands for modifying the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
707 * Other Vi Commands:: Miscellaneous Commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
708 * Commands in Insert Mode:: Commands for entering insert mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
709 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
710
Dave Love <fx@gnu.org>
parents:
diff changeset
711 @node Numeric Arguments, Important Keys, Vi Commands, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
712 @section Numeric Arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
713
Dave Love <fx@gnu.org>
parents:
diff changeset
714 @cindex numeric arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
715 @cindex count
Dave Love <fx@gnu.org>
parents:
diff changeset
716 @kindex 061 @kbd{1} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
717 @kindex 062 @kbd{2} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
718 @kindex 063 @kbd{3} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
719 @kindex 064 @kbd{4} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
720 @kindex 065 @kbd{5} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
721 @kindex 066 @kbd{6} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
722 @kindex 067 @kbd{7} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
723 @kindex 068 @kbd{8} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
724 @kindex 069 @kbd{9} (numeric argument)
Dave Love <fx@gnu.org>
parents:
diff changeset
725
Dave Love <fx@gnu.org>
parents:
diff changeset
726 Most Vi commands accept a @dfn{numeric argument} which can be supplied as
Dave Love <fx@gnu.org>
parents:
diff changeset
727 a prefix to the commands. A numeric argument is also called a @dfn{count}.
Dave Love <fx@gnu.org>
parents:
diff changeset
728 In many cases, if a count is given, the command is executed that many times.
Dave Love <fx@gnu.org>
parents:
diff changeset
729 For instance, @kbd{5 d d} deletes 5 lines while simple @kbd{d d} deletes a
Dave Love <fx@gnu.org>
parents:
diff changeset
730 line. In this manual the metavariable @var{n} will denote a count.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
731
Dave Love <fx@gnu.org>
parents:
diff changeset
732 @node Important Keys, Buffers and Windows, Numeric Arguments, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
733 @section Important Keys
Dave Love <fx@gnu.org>
parents:
diff changeset
734
Dave Love <fx@gnu.org>
parents:
diff changeset
735 The keys @kbd{C-g} and @kbd{C-l} are unique in that their associated
Dave Love <fx@gnu.org>
parents:
diff changeset
736 functions are the same in any of emacs, vi and insert mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
737
Dave Love <fx@gnu.org>
parents:
diff changeset
738 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
739 @item C-g
Dave Love <fx@gnu.org>
parents:
diff changeset
740 @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit})
Dave Love <fx@gnu.org>
parents:
diff changeset
741 Quit. Cancel running or partially typed command (@code{keyboard-quit}).
Dave Love <fx@gnu.org>
parents:
diff changeset
742 @item C-l
Dave Love <fx@gnu.org>
parents:
diff changeset
743 @kindex 014 @kbd{C-l} (@code{recenter})
Dave Love <fx@gnu.org>
parents:
diff changeset
744 Clear the screen and reprint everything (@code{recenter}).
Dave Love <fx@gnu.org>
parents:
diff changeset
745 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
746
Dave Love <fx@gnu.org>
parents:
diff changeset
747 In Emacs many commands are bound to the key strokes that start with
Dave Love <fx@gnu.org>
parents:
diff changeset
748 @kbd{C-x}, @kbd{C-c} and @key{ESC}. These commands can be
Dave Love <fx@gnu.org>
parents:
diff changeset
749 accessed from vi mode as easily as from emacs mode.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
750
Dave Love <fx@gnu.org>
parents:
diff changeset
751 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
752 @item C-x
Dave Love <fx@gnu.org>
parents:
diff changeset
753 @itemx C-c
Dave Love <fx@gnu.org>
parents:
diff changeset
754 @itemx @key{ESC}
Dave Love <fx@gnu.org>
parents:
diff changeset
755 @kindex 003 @kbd{C-c} (@code{vip-ctl-c})
Dave Love <fx@gnu.org>
parents:
diff changeset
756 @kindex 0300 @kbd{C-x} (@code{vip-ctl-x})
Dave Love <fx@gnu.org>
parents:
diff changeset
757 @kindex 033 @kbd{ESC} (@code{vip-ESC})
Dave Love <fx@gnu.org>
parents:
diff changeset
758 Typing one of these keys have the same effect as typing it in emacs mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
759 Appropriate command will be executed according as the keys you type after
Dave Love <fx@gnu.org>
parents:
diff changeset
760 it. You will be in vi mode again after the execution of the command.
Dave Love <fx@gnu.org>
parents:
diff changeset
761 For instance, if you type @kbd{@key{ESC} <} (in vi mode) then the cursor will
Dave Love <fx@gnu.org>
parents:
diff changeset
762 move to the beginning of the buffer and you will still be in vi mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
763 @item C
Dave Love <fx@gnu.org>
parents:
diff changeset
764 @itemx X
Dave Love <fx@gnu.org>
parents:
diff changeset
765 @kindex 103 @kbd{C} (@code{vip-ctl-c-equivalent})
Dave Love <fx@gnu.org>
parents:
diff changeset
766 @kindex 1300 @kbd{X} (@code{vip-ctl-x-equivalent})
Dave Love <fx@gnu.org>
parents:
diff changeset
767 Typing one of these keys have the effect of typing the corresponding
Dave Love <fx@gnu.org>
parents:
diff changeset
768 control character in emacs mode. Moreover, if you type an upper-case
Dave Love <fx@gnu.org>
parents:
diff changeset
769 character following it, that character will also be translated to the
Dave Love <fx@gnu.org>
parents:
diff changeset
770 corresponding control character. Thus typing @kbd{X W} in vi mode is the
Dave Love <fx@gnu.org>
parents:
diff changeset
771 same as typing @kbd{C-x C-w} in emacs mode. You will be in vi mode again
Dave Love <fx@gnu.org>
parents:
diff changeset
772 after the execution of a command.
Dave Love <fx@gnu.org>
parents:
diff changeset
773 @item \
Dave Love <fx@gnu.org>
parents:
diff changeset
774 @kindex 134 @kbd{\} (@code{vip-escape-to-emacs})
Dave Love <fx@gnu.org>
parents:
diff changeset
775 Escape to emacs mode. Hitting the @kbd{\} key will take you to emacs mode,
Dave Love <fx@gnu.org>
parents:
diff changeset
776 and you can execute a single Emacs command. After executing the
Dave Love <fx@gnu.org>
parents:
diff changeset
777 Emacs command you will be in vi mode again. You can give a count before
Dave Love <fx@gnu.org>
parents:
diff changeset
778 typing @kbd{\}. Thus @kbd{5 \ +}, as well as @kbd{\ C-u 5 +}, will insert
Dave Love <fx@gnu.org>
parents:
diff changeset
779 @samp{+++++} before point.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
780 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
781
Dave Love <fx@gnu.org>
parents:
diff changeset
782 @node Buffers and Windows, Files, Important Keys, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
783 @section Buffers and Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
784
Dave Love <fx@gnu.org>
parents:
diff changeset
785 @cindex buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
786 @cindex selected buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
787 @cindex current buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
788
Dave Love <fx@gnu.org>
parents:
diff changeset
789 In Emacs the text you edit is stored in a @dfn{buffer}.
37987
39cfe73648c8 selected buffer <=> current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 37405
diff changeset
790 See GNU Emacs Manual, for details. There is always one @dfn{current}
39cfe73648c8 selected buffer <=> current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 37405
diff changeset
791 buffer, also called the @dfn{selected buffer}.@refill
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
792
Dave Love <fx@gnu.org>
parents:
diff changeset
793 @cindex window
Dave Love <fx@gnu.org>
parents:
diff changeset
794 @cindex modified (buffer)
Dave Love <fx@gnu.org>
parents:
diff changeset
795
Dave Love <fx@gnu.org>
parents:
diff changeset
796 You can see the contents of buffers through @dfn{windows} created by Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
797 When you have multiple windows on the screen only one of them is selected.
Dave Love <fx@gnu.org>
parents:
diff changeset
798 Each buffer has a unique name, and each window has a mode line which shows
Dave Love <fx@gnu.org>
parents:
diff changeset
799 the name of the buffer associated with the window and other information
Dave Love <fx@gnu.org>
parents:
diff changeset
800 about the status of the buffer. You can change the format of the mode
Dave Love <fx@gnu.org>
parents:
diff changeset
801 line, but normally if you see @samp{**} at the beginning of a mode line it
Dave Love <fx@gnu.org>
parents:
diff changeset
802 means that the buffer is @dfn{modified}. If you write out the content of
Dave Love <fx@gnu.org>
parents:
diff changeset
803 the buffer to a file, then the buffer will become not modified. Also if
Dave Love <fx@gnu.org>
parents:
diff changeset
804 you see @samp{%%} at the beginning of the mode line, it means that the file
Dave Love <fx@gnu.org>
parents:
diff changeset
805 associated with the buffer is write protected.
Dave Love <fx@gnu.org>
parents:
diff changeset
806
Dave Love <fx@gnu.org>
parents:
diff changeset
807 We have the following commands related to windows and buffers.
Dave Love <fx@gnu.org>
parents:
diff changeset
808
Dave Love <fx@gnu.org>
parents:
diff changeset
809 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
810 @item C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
811 @kindex 016 @kbd{C-n} (@code{vip-next-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
812 Move cursor to the next-window (@code{vip-next-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
813 @item X 1
Dave Love <fx@gnu.org>
parents:
diff changeset
814 @kindex 1301 @kbd{X 1} (@code{delete-other-windows})
Dave Love <fx@gnu.org>
parents:
diff changeset
815 Delete other windows and make the selected window fill the screen
Dave Love <fx@gnu.org>
parents:
diff changeset
816 @*(@code{delete-other-windows}).
Dave Love <fx@gnu.org>
parents:
diff changeset
817 @item X 2
Dave Love <fx@gnu.org>
parents:
diff changeset
818 @kindex 1301 @kbd{X 2} (@code{split-window-vertically})
Dave Love <fx@gnu.org>
parents:
diff changeset
819 Split current window into two windows (@code{split-window-vertically}).
Dave Love <fx@gnu.org>
parents:
diff changeset
820 @item X 3
Dave Love <fx@gnu.org>
parents:
diff changeset
821 @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows})
Dave Love <fx@gnu.org>
parents:
diff changeset
822 Show current buffer in two windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
823 @item s @var{buffer} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
824 @kindex 163 @kbd{s} (@code{vip-switch-to-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
825 Select or create a buffer named @var{buffer} (@code{vip-switch-to-buffer}).
Dave Love <fx@gnu.org>
parents:
diff changeset
826 @item S @var{buffer} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
827 @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
828 Similar but select a buffer named @var{buffer} in another window
Dave Love <fx@gnu.org>
parents:
diff changeset
829 @*(@code{vip-switch-to-buffer-other-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
830 @item K
Dave Love <fx@gnu.org>
parents:
diff changeset
831 @kindex 113 @kbd{K} (@code{vip-kill-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
832 Kill the current buffer if it is not modified or if it is not associated
Dave Love <fx@gnu.org>
parents:
diff changeset
833 with a file @*(@code{vip-kill-buffer}).
Dave Love <fx@gnu.org>
parents:
diff changeset
834 @item X B
Dave Love <fx@gnu.org>
parents:
diff changeset
835 @kindex 1302 @kbd{X B} (@code{list-buffers})
Dave Love <fx@gnu.org>
parents:
diff changeset
836 List the existing buffers (@code{list-buffers}).
Dave Love <fx@gnu.org>
parents:
diff changeset
837 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
838
Dave Love <fx@gnu.org>
parents:
diff changeset
839 @cindex buffer name completion
Dave Love <fx@gnu.org>
parents:
diff changeset
840
Dave Love <fx@gnu.org>
parents:
diff changeset
841 As @dfn{buffer name completion} is provided, you have only to type in
Dave Love <fx@gnu.org>
parents:
diff changeset
842 initial substring of the buffer name which is sufficient to identify it
Dave Love <fx@gnu.org>
parents:
diff changeset
843 among names of existing buffers. After that, if you hit @key{TAB} the rest
Dave Love <fx@gnu.org>
parents:
diff changeset
844 of the buffer name will be supplied by the system, and you can confirm it
Dave Love <fx@gnu.org>
parents:
diff changeset
845 by @key{RET}. The default buffer name to switch to will also be prompted,
Dave Love <fx@gnu.org>
parents:
diff changeset
846 and you can select it by giving a simple @key{RET}. See GNU Emacs Manual
Dave Love <fx@gnu.org>
parents:
diff changeset
847 for details of completion.
Dave Love <fx@gnu.org>
parents:
diff changeset
848
Dave Love <fx@gnu.org>
parents:
diff changeset
849 @node Files, Viewing the Buffer, Buffers and Windows, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
850 @section Files
Dave Love <fx@gnu.org>
parents:
diff changeset
851
Dave Love <fx@gnu.org>
parents:
diff changeset
852 We have the following commands related to files. They are used to visit,
Dave Love <fx@gnu.org>
parents:
diff changeset
853 save and insert files.
Dave Love <fx@gnu.org>
parents:
diff changeset
854
Dave Love <fx@gnu.org>
parents:
diff changeset
855 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
856 @item v @var{file} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
857 @kindex 166 @kbd{v} (@code{vip-find-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
858 Visit specified file in the current window (@code{vip-find-file}).
Dave Love <fx@gnu.org>
parents:
diff changeset
859 @item V @var{file} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
860 @kindex 126 @kbd{V} (@code{vip-find-file-other-window})
Dave Love <fx@gnu.org>
parents:
diff changeset
861 Visit specified file in another window (@code{vip-find-file-other-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
862 @item X S
Dave Love <fx@gnu.org>
parents:
diff changeset
863 @kindex 1302 @kbd{X S} (@code{save-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
864 Save current buffer to the file associated with the buffer. If no file is
Dave Love <fx@gnu.org>
parents:
diff changeset
865 associated with the buffer, the name of the file to write out the content
Dave Love <fx@gnu.org>
parents:
diff changeset
866 of the buffer will be asked in the minibuffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
867 @item X W @var{file} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
868 @kindex 1302 @kbd{X W} (@code{write-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
869 Write current buffer into a specified file.
Dave Love <fx@gnu.org>
parents:
diff changeset
870 @item X I @var{file} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
871 @kindex 1302 @kbd{X I} (@code{insert-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
872 Insert a specified file at point.
Dave Love <fx@gnu.org>
parents:
diff changeset
873 @item g
Dave Love <fx@gnu.org>
parents:
diff changeset
874 @kindex 147 @kbd{g} (@code{vip-info-on-file})
Dave Love <fx@gnu.org>
parents:
diff changeset
875 Give information on the file associated with the current buffer. Tell you
Dave Love <fx@gnu.org>
parents:
diff changeset
876 the name of the file associated with the buffer, the line number of the
Dave Love <fx@gnu.org>
parents:
diff changeset
877 current point and total line numbers in the buffer. If no file is
Dave Love <fx@gnu.org>
parents:
diff changeset
878 associated with the buffer, this fact will be indicated by the null file
Dave Love <fx@gnu.org>
parents:
diff changeset
879 name @samp{""}.
Dave Love <fx@gnu.org>
parents:
diff changeset
880 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
881
Dave Love <fx@gnu.org>
parents:
diff changeset
882 @cindex visiting (a file)
Dave Love <fx@gnu.org>
parents:
diff changeset
883 @cindex default directory
Dave Love <fx@gnu.org>
parents:
diff changeset
884
Dave Love <fx@gnu.org>
parents:
diff changeset
885 In Emacs, you can edit a file by @dfn{visiting} it. If you wish to visit a
Dave Love <fx@gnu.org>
parents:
diff changeset
886 file in the current window, you can just type @kbd{v}. Emacs maintains the
Dave Love <fx@gnu.org>
parents:
diff changeset
887 @dfn{default directory} which is specific to each buffer. Suppose, for
Dave Love <fx@gnu.org>
parents:
diff changeset
888 instance, that the default directory of the current buffer is
Dave Love <fx@gnu.org>
parents:
diff changeset
889 @file{/usr/masahiko/lisp/}. Then you will get the following prompt in the
Dave Love <fx@gnu.org>
parents:
diff changeset
890 minibuffer.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
891 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
892 visit file: /usr/masahiko/lisp/
Dave Love <fx@gnu.org>
parents:
diff changeset
893 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
894 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
895 @cindex file name completion
Dave Love <fx@gnu.org>
parents:
diff changeset
896 If you wish to visit, say, @file{vip.el} in this directory, then you can
Dave Love <fx@gnu.org>
parents:
diff changeset
897 just type @samp{vip.el} followed by @key{RET}. If the file @file{vip.el}
Dave Love <fx@gnu.org>
parents:
diff changeset
898 already exists in the directory, Emacs will visit that file, and if not,
Dave Love <fx@gnu.org>
parents:
diff changeset
899 the file will be created. Emacs will use the file name (@file{vip.el}, in
Dave Love <fx@gnu.org>
parents:
diff changeset
900 this case) as the name of the buffer visiting the file. In order to make
Dave Love <fx@gnu.org>
parents:
diff changeset
901 the buffer name unique, Emacs may append @samp{<2>}, @samp{<3>} etc., to
Dave Love <fx@gnu.org>
parents:
diff changeset
902 the buffer name. As the @dfn{file name completion} is provided here, you
Dave Love <fx@gnu.org>
parents:
diff changeset
903 can sometime save typing. For instance, suppose there is only one file in the
Dave Love <fx@gnu.org>
parents:
diff changeset
904 default directory whose name starts with @samp{v}, that is @samp{vip.el}.
Dave Love <fx@gnu.org>
parents:
diff changeset
905 Then if you just type @kbd{v @key{TAB}} then it will be completed to
Dave Love <fx@gnu.org>
parents:
diff changeset
906 @samp{vip.el}. Thus, in this case, you just have to type @kbd{v v @key{TAB}
Dave Love <fx@gnu.org>
parents:
diff changeset
907 @key{RET}} to visit @file{/usr/masahiko/lisp/vip.el}. Continuing the
Dave Love <fx@gnu.org>
parents:
diff changeset
908 example, let us now suppose that you wished to visit the file
Dave Love <fx@gnu.org>
parents:
diff changeset
909 @file{/usr/masahiko/man/vip.texinfo}. Then to the same prompt which you get
Dave Love <fx@gnu.org>
parents:
diff changeset
910 after you typed @kbd{v}, you can enter @samp{/usr/masahiko/man/vip.texinfo} or
Dave Love <fx@gnu.org>
parents:
diff changeset
911 @samp{../man/vip.texinfo} followed by @key{RET}.
Dave Love <fx@gnu.org>
parents:
diff changeset
912
Dave Love <fx@gnu.org>
parents:
diff changeset
913 Use @kbd{V} instead of @kbd{v}, if you wish to visit a file in another
Dave Love <fx@gnu.org>
parents:
diff changeset
914 window.
Dave Love <fx@gnu.org>
parents:
diff changeset
915
Dave Love <fx@gnu.org>
parents:
diff changeset
916 You can verify which file you are editing by typing @kbd{g}. (You can also
71224
b7261e09f8e4 * cc-mode.texi (Getting Started, Indentation Commands, Config Basics)
Romain Francoise <romain@orebokech.com>
parents: 69681
diff changeset
917 type @kbd{X B} to get information on other buffers too.) If you type
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
918 @kbd{g} you will get an information like below in the echo area:@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
919 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
920 "/usr/masahiko/man/vip.texinfo" line 921 of 1949
Dave Love <fx@gnu.org>
parents:
diff changeset
921 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
922
Dave Love <fx@gnu.org>
parents:
diff changeset
923 After you edited the buffer (@samp{vip.texinfo}, in our example) for a while,
Dave Love <fx@gnu.org>
parents:
diff changeset
924 you may wish to save it in a file. If you wish to save it in the file
Dave Love <fx@gnu.org>
parents:
diff changeset
925 associated with the buffer (@file{/usr/masahiko/man/vip.texinfo}, in this
Dave Love <fx@gnu.org>
parents:
diff changeset
926 case), you can just say @kbd{X S}. If you wish to save it in another file,
Dave Love <fx@gnu.org>
parents:
diff changeset
927 you can type @kbd{X W}. You will then get a similar prompt as you get for
Dave Love <fx@gnu.org>
parents:
diff changeset
928 @kbd{v}, to which you can enter the file name.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
929
Dave Love <fx@gnu.org>
parents:
diff changeset
930 @node Viewing the Buffer, Mark Commands, Files, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
931 @section Viewing the Buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
932
Dave Love <fx@gnu.org>
parents:
diff changeset
933 In this and next section we discuss commands for moving around in the
Dave Love <fx@gnu.org>
parents:
diff changeset
934 buffer. These command do not change the content of the buffer. The
Dave Love <fx@gnu.org>
parents:
diff changeset
935 following commands are useful for viewing the content of the current
Dave Love <fx@gnu.org>
parents:
diff changeset
936 buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
937
Dave Love <fx@gnu.org>
parents:
diff changeset
938 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
939 @item @key{SPC}
Dave Love <fx@gnu.org>
parents:
diff changeset
940 @itemx C-f
Dave Love <fx@gnu.org>
parents:
diff changeset
941 @kindex 040 @kbd{SPC} (@code{vip-scroll})
Dave Love <fx@gnu.org>
parents:
diff changeset
942 @kindex 006 @kbd{C-f} (@code{vip-scroll-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
943 Scroll text of current window upward almost full screen. You can go
Dave Love <fx@gnu.org>
parents:
diff changeset
944 @i{forward} in the buffer by this command (@code{vip-scroll}).
Dave Love <fx@gnu.org>
parents:
diff changeset
945 @item @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
946 @itemx C-b
Dave Love <fx@gnu.org>
parents:
diff changeset
947 @kindex 015 @kbd{RET} (@code{vip-scroll-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
948 @kindex 002 @kbd{C-b} (@code{vip-scroll-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
949 Scroll text of current window downward almost full screen. You can go
Dave Love <fx@gnu.org>
parents:
diff changeset
950 @i{backward} in the buffer by this command (@code{vip-scroll-back}).
Dave Love <fx@gnu.org>
parents:
diff changeset
951 @itemx C-d
Dave Love <fx@gnu.org>
parents:
diff changeset
952 @kindex 004 @kbd{C-d} (@code{vip-scroll-up})
Dave Love <fx@gnu.org>
parents:
diff changeset
953 Scroll text of current window upward half screen. You can go
Dave Love <fx@gnu.org>
parents:
diff changeset
954 @i{down} in the buffer by this command (@code{vip-scroll-down}).
Dave Love <fx@gnu.org>
parents:
diff changeset
955 @itemx C-u
Dave Love <fx@gnu.org>
parents:
diff changeset
956 @kindex 025 @kbd{C-u} (@code{vip-scroll-down})
Dave Love <fx@gnu.org>
parents:
diff changeset
957 Scroll text of current window downward half screen. You can go
Dave Love <fx@gnu.org>
parents:
diff changeset
958 @i{up} in the buffer by this command (@code{vip-scroll-up}).
Dave Love <fx@gnu.org>
parents:
diff changeset
959 @item C-y
Dave Love <fx@gnu.org>
parents:
diff changeset
960 @kindex 031 @kbd{C-y} (@code{vip-scroll-down-one})
Dave Love <fx@gnu.org>
parents:
diff changeset
961 Scroll text of current window upward by one line (@code{vip-scroll-down-one}).
Dave Love <fx@gnu.org>
parents:
diff changeset
962 @item C-e
Dave Love <fx@gnu.org>
parents:
diff changeset
963 @kindex 005 @kbd{C-e} (@code{vip-scroll-up-one})
Dave Love <fx@gnu.org>
parents:
diff changeset
964 Scroll text of current window downward by one line (@code{vip-scroll-up-one}).
Dave Love <fx@gnu.org>
parents:
diff changeset
965 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
966 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
967 You can repeat these commands by giving a count. Thus, @kbd{2 @key{SPC}}
Dave Love <fx@gnu.org>
parents:
diff changeset
968 has the same effect as @kbd{@key{SPC} @key{SPC}}.
Dave Love <fx@gnu.org>
parents:
diff changeset
969
Dave Love <fx@gnu.org>
parents:
diff changeset
970 The following commands reposition point in the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
971
Dave Love <fx@gnu.org>
parents:
diff changeset
972 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
973 @item z H
Dave Love <fx@gnu.org>
parents:
diff changeset
974 @itemx z @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
975 @kindex 1723 @kbd{z H} (@code{vip-line-to-top})
Dave Love <fx@gnu.org>
parents:
diff changeset
976 @kindex 1721 @kbd{z RET} (@code{vip-line-to-top})
Dave Love <fx@gnu.org>
parents:
diff changeset
977 Put point on the top (@i{home}) line in the window. So the current line
Dave Love <fx@gnu.org>
parents:
diff changeset
978 becomes the top line in the window. Given a count @var{n}, point will be
Dave Love <fx@gnu.org>
parents:
diff changeset
979 placed in the @var{n}-th line from top (@code{vip-line-to-top}).
Dave Love <fx@gnu.org>
parents:
diff changeset
980 @item z M
Dave Love <fx@gnu.org>
parents:
diff changeset
981 @itemx z .
Dave Love <fx@gnu.org>
parents:
diff changeset
982 @kindex 1723 @kbd{z M} (@code{vip-line-to-middle})
Dave Love <fx@gnu.org>
parents:
diff changeset
983 @kindex 1722 @kbd{z .} (@code{vip-line-to-middle})
Dave Love <fx@gnu.org>
parents:
diff changeset
984 Put point on the @i{middle} line in the window. Given a count @var{n},
Dave Love <fx@gnu.org>
parents:
diff changeset
985 point will be placed in the @var{n}-th line from the middle line
Dave Love <fx@gnu.org>
parents:
diff changeset
986 (@code{vip-line-to-middle}).
Dave Love <fx@gnu.org>
parents:
diff changeset
987 @item z L
Dave Love <fx@gnu.org>
parents:
diff changeset
988 @itemx z -
Dave Love <fx@gnu.org>
parents:
diff changeset
989 @kindex 1723 @kbd{z L} (@code{vip-line-to-bottom})
Dave Love <fx@gnu.org>
parents:
diff changeset
990 @kindex 1722 @kbd{z -} (@code{vip-line-to-bottom})
Dave Love <fx@gnu.org>
parents:
diff changeset
991 Put point on the @i{bottom} line in the window. Given a count @var{n},
Dave Love <fx@gnu.org>
parents:
diff changeset
992 point will be placed in the @var{n}-th line from bottom
Dave Love <fx@gnu.org>
parents:
diff changeset
993 (@code{vip-line-to-bottom}).
Dave Love <fx@gnu.org>
parents:
diff changeset
994 @item C-l
Dave Love <fx@gnu.org>
parents:
diff changeset
995 Center point in window and redisplay screen (@code{recenter}).
Dave Love <fx@gnu.org>
parents:
diff changeset
996 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
997
Dave Love <fx@gnu.org>
parents:
diff changeset
998 @node Mark Commands, Motion Commands, Viewing the Buffer, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
999 @section Mark Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1000
Dave Love <fx@gnu.org>
parents:
diff changeset
1001 The following commands are used to mark positions in the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1002
Dave Love <fx@gnu.org>
parents:
diff changeset
1003 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1004 @item m @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1005 @kindex 155 @kbd{m} (@code{vip-mark-point})
Dave Love <fx@gnu.org>
parents:
diff changeset
1006 Store current point in the register @var{ch}. @var{ch} must be a
52979
3649390c0f91 Replace @sc{ascii} and ASCII with @acronym{ASCII}.
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
1007 lower-case @acronym{ASCII} letter.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1008 @item m <
Dave Love <fx@gnu.org>
parents:
diff changeset
1009 Set mark at the beginning of current buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1010 @item m >
Dave Love <fx@gnu.org>
parents:
diff changeset
1011 Set mark at the end of current buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1012 @item m .
Dave Love <fx@gnu.org>
parents:
diff changeset
1013 Set mark at point.
Dave Love <fx@gnu.org>
parents:
diff changeset
1014 @item m ,
Dave Love <fx@gnu.org>
parents:
diff changeset
1015 Jump to mark (and pop mark off the mark ring).
Dave Love <fx@gnu.org>
parents:
diff changeset
1016 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1017
Dave Love <fx@gnu.org>
parents:
diff changeset
1018 @cindex mark ring
Dave Love <fx@gnu.org>
parents:
diff changeset
1019
Dave Love <fx@gnu.org>
parents:
diff changeset
1020 Emacs uses the @dfn{mark ring} to store marked positions. The commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1021 @kbd{m <}, @kbd{m >} and @kbd{m .}@: not only set mark but also add it as the
Dave Love <fx@gnu.org>
parents:
diff changeset
1022 latest element of the mark ring (replacing the oldest one). By repeating
Dave Love <fx@gnu.org>
parents:
diff changeset
1023 the command `@kbd{m ,}' you can visit older and older marked positions. You
Dave Love <fx@gnu.org>
parents:
diff changeset
1024 will eventually be in a loop as the mark ring is a ring.
Dave Love <fx@gnu.org>
parents:
diff changeset
1025
Dave Love <fx@gnu.org>
parents:
diff changeset
1026 @node Motion Commands, Searching and Replacing, Mark Commands, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1027 @section Motion Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1028
Dave Love <fx@gnu.org>
parents:
diff changeset
1029 Commands for moving around in the current buffer are collected here. These
Dave Love <fx@gnu.org>
parents:
diff changeset
1030 commands are used as an `argument' for the delete, change and yank commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1031 to be described in the next section.
Dave Love <fx@gnu.org>
parents:
diff changeset
1032
Dave Love <fx@gnu.org>
parents:
diff changeset
1033 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1034 @item h
Dave Love <fx@gnu.org>
parents:
diff changeset
1035 @kindex 150 @kbd{h} (@code{vip-backward-char})
Dave Love <fx@gnu.org>
parents:
diff changeset
1036 Move point backward by one character. Signal error if point is at the
Dave Love <fx@gnu.org>
parents:
diff changeset
1037 beginning of buffer, but (unlike Vi) do not complain otherwise
Dave Love <fx@gnu.org>
parents:
diff changeset
1038 (@code{vip-backward-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1039 @item l
Dave Love <fx@gnu.org>
parents:
diff changeset
1040 @kindex 154 @kbd{l} (@code{vip-forward-char})
Dave Love <fx@gnu.org>
parents:
diff changeset
1041 Move point backward by one character. Signal error if point is at the
Dave Love <fx@gnu.org>
parents:
diff changeset
1042 end of buffer, but (unlike Vi) do not complain otherwise
Dave Love <fx@gnu.org>
parents:
diff changeset
1043 (@code{vip-forward-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1044 @item j
Dave Love <fx@gnu.org>
parents:
diff changeset
1045 @kindex 152 @kbd{j} (@code{vip-next-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1046 Move point to the next line keeping the current column. If point is on the
Dave Love <fx@gnu.org>
parents:
diff changeset
1047 last line of the buffer, a new line will be created and point will move to
Dave Love <fx@gnu.org>
parents:
diff changeset
1048 that line (@code{vip-next-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1049 @item k
Dave Love <fx@gnu.org>
parents:
diff changeset
1050 @kindex 153 @kbd{k} (@code{vip-previous-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1051 Move point to the previous line keeping the current column
Dave Love <fx@gnu.org>
parents:
diff changeset
1052 (@code{vip-next-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1053 @item +
Dave Love <fx@gnu.org>
parents:
diff changeset
1054 @kindex 053 @kbd{+} (@code{vip-next-line-at-bol})
Dave Love <fx@gnu.org>
parents:
diff changeset
1055 Move point to the next line at the first non-white character. If point is
Dave Love <fx@gnu.org>
parents:
diff changeset
1056 on the last line of the buffer, a new line will be created and point will
Dave Love <fx@gnu.org>
parents:
diff changeset
1057 move to the beginning of that line (@code{vip-next-line-at-bol}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1058 @item -
Dave Love <fx@gnu.org>
parents:
diff changeset
1059 @kindex 055 @kbd{-} (@code{vip-previous-line-at-bol})
Dave Love <fx@gnu.org>
parents:
diff changeset
1060 Move point to the previous line at the first non-white character
Dave Love <fx@gnu.org>
parents:
diff changeset
1061 (@code{vip-previous-line-at-bol}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1062 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1063 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1064 If a count is given to these commands, the commands will be repeated that
Dave Love <fx@gnu.org>
parents:
diff changeset
1065 many times.
Dave Love <fx@gnu.org>
parents:
diff changeset
1066
Dave Love <fx@gnu.org>
parents:
diff changeset
1067 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1068 @item 0
Dave Love <fx@gnu.org>
parents:
diff changeset
1069 @kindex 060 @kbd{0} (@code{vip-beginning-of-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1070 Move point to the beginning of line (@code{vip-beginning-of-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1071 @item ^
Dave Love <fx@gnu.org>
parents:
diff changeset
1072 @kindex 136 @kbd{^} (@code{vip-bol-and-skip-white})
Dave Love <fx@gnu.org>
parents:
diff changeset
1073 Move point to the first non-white character on the line
Dave Love <fx@gnu.org>
parents:
diff changeset
1074 (@code{vip-bol-and-skip-white}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1075 @item $
Dave Love <fx@gnu.org>
parents:
diff changeset
1076 @kindex 044 @kbd{$} (@code{vip-goto-eol})
Dave Love <fx@gnu.org>
parents:
diff changeset
1077 Move point to the end of line (@code{vip-goto-eol}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1078 @item @var{n} |
Dave Love <fx@gnu.org>
parents:
diff changeset
1079 @kindex 174 @kbd{|} (@code{vip-goto-col})
Dave Love <fx@gnu.org>
parents:
diff changeset
1080 Move point to the @var{n}-th column on the line (@code{vip-goto-col}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1081 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1082 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1083 Except for the @kbd{|} command, these commands neglect a count.
Dave Love <fx@gnu.org>
parents:
diff changeset
1084
Dave Love <fx@gnu.org>
parents:
diff changeset
1085 @cindex word
Dave Love <fx@gnu.org>
parents:
diff changeset
1086
Dave Love <fx@gnu.org>
parents:
diff changeset
1087 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1088 @item w
Dave Love <fx@gnu.org>
parents:
diff changeset
1089 @kindex 167 @kbd{w} (@code{vip-forward-word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1090 Move point forward to the beginning of the next word
Dave Love <fx@gnu.org>
parents:
diff changeset
1091 (@code{vip-forward-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1092 @item W
Dave Love <fx@gnu.org>
parents:
diff changeset
1093 @kindex 127 @kbd{W} (@code{vip-forward-Word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1094 Move point forward to the beginning of the next word, where a @dfn{word} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1095 considered as a sequence of non-white characters (@code{vip-forward-Word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1096 @item b
Dave Love <fx@gnu.org>
parents:
diff changeset
1097 @kindex 142 @kbd{b} (@code{vip-backward-word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1098 Move point backward to the beginning of a word (@code{vip-backward-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1099 @item B
Dave Love <fx@gnu.org>
parents:
diff changeset
1100 @kindex 102 @kbd{B} (@code{vip-backward-Word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1101 Move point backward to the beginning of a word, where a @i{word} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1102 considered as a sequence of non-white characters (@code{vip-forward-Word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1103 @item e
Dave Love <fx@gnu.org>
parents:
diff changeset
1104 @kindex 145 @kbd{e} (@code{vip-end-of-word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1105 Move point forward to the end of a word (@code{vip-end-of-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1106 @item E
Dave Love <fx@gnu.org>
parents:
diff changeset
1107 @kindex 105 @kbd{E} (@code{vip-end-of-Word})
Dave Love <fx@gnu.org>
parents:
diff changeset
1108 Move point forward to the end of a word, where a @i{word} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1109 considered as a sequence of non-white characters (@code{vip-end-of-Word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1110 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1111 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1112 @cindex syntax table
Dave Love <fx@gnu.org>
parents:
diff changeset
1113 Here the meaning of the word `word' for the @kbd{w}, @kbd{b} and @kbd{e}
Dave Love <fx@gnu.org>
parents:
diff changeset
1114 commands is determined by the @dfn{syntax table} effective in the current
Dave Love <fx@gnu.org>
parents:
diff changeset
1115 buffer. Each major mode has its syntax mode, and therefore the meaning of
Dave Love <fx@gnu.org>
parents:
diff changeset
1116 a word also changes as the major mode changes. See GNU Emacs Manual for
Dave Love <fx@gnu.org>
parents:
diff changeset
1117 details of syntax table.
Dave Love <fx@gnu.org>
parents:
diff changeset
1118
Dave Love <fx@gnu.org>
parents:
diff changeset
1119 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1120 @item H
Dave Love <fx@gnu.org>
parents:
diff changeset
1121 @kindex 110 @kbd{H} (@code{vip-window-top})
Dave Love <fx@gnu.org>
parents:
diff changeset
1122 Move point to the beginning of the @i{home} (top) line of the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
1123 Given a count @var{n}, go to the @var{n}-th line from top
Dave Love <fx@gnu.org>
parents:
diff changeset
1124 (@code{vip-window-top}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1125 @item M
Dave Love <fx@gnu.org>
parents:
diff changeset
1126 @kindex 115 @kbd{M} (@code{vip-window-middle})
Dave Love <fx@gnu.org>
parents:
diff changeset
1127 Move point to the beginning of the @i{middle} line of the window. Given
Dave Love <fx@gnu.org>
parents:
diff changeset
1128 a count @var{n}, go to the @var{n}-th line from the middle line
Dave Love <fx@gnu.org>
parents:
diff changeset
1129 (@code{vip-window-middle}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1130 @item L
Dave Love <fx@gnu.org>
parents:
diff changeset
1131 @kindex 114 @kbd{L} (@code{vip-window-bottom})
Dave Love <fx@gnu.org>
parents:
diff changeset
1132 Move point to the beginning of the @i{lowest} (bottom) line of the
Dave Love <fx@gnu.org>
parents:
diff changeset
1133 window. Given count, go to the @var{n}-th line from bottom
Dave Love <fx@gnu.org>
parents:
diff changeset
1134 (@code{vip-window-bottom}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1135 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1136 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1137 These commands can be used to go to the desired line visible on the screen.
Dave Love <fx@gnu.org>
parents:
diff changeset
1138
Dave Love <fx@gnu.org>
parents:
diff changeset
1139 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1140 @item (
Dave Love <fx@gnu.org>
parents:
diff changeset
1141 @kindex 050 @kbd{(} (@code{vip-backward-sentence})
Dave Love <fx@gnu.org>
parents:
diff changeset
1142 Move point backward to the beginning of the sentence
Dave Love <fx@gnu.org>
parents:
diff changeset
1143 (@code{vip-backward-sentence}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1144 @item )
Dave Love <fx@gnu.org>
parents:
diff changeset
1145 @kindex 051 @kbd{)} (@code{vip-forward-sentence})
Dave Love <fx@gnu.org>
parents:
diff changeset
1146 Move point forward to the end of the sentence
Dave Love <fx@gnu.org>
parents:
diff changeset
1147 (@code{vip-forward-sentence}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1148 @item @{
Dave Love <fx@gnu.org>
parents:
diff changeset
1149 @kindex 173 @kbd{@{} (@code{vip-backward-paragraph})
Dave Love <fx@gnu.org>
parents:
diff changeset
1150 Move point backward to the beginning of the paragraph
Dave Love <fx@gnu.org>
parents:
diff changeset
1151 (@code{vip-backward-paragraph}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1152 @item @}
Dave Love <fx@gnu.org>
parents:
diff changeset
1153 @kindex 175 @kbd{@}} (@code{vip-forward-paragraph})
Dave Love <fx@gnu.org>
parents:
diff changeset
1154 Move point forward to the end of the paragraph
Dave Love <fx@gnu.org>
parents:
diff changeset
1155 (@code{vip-forward-paragraph}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1156 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1157 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1158 A count repeats the effect for these commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
1159
Dave Love <fx@gnu.org>
parents:
diff changeset
1160 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1161 @item G
Dave Love <fx@gnu.org>
parents:
diff changeset
1162 @kindex 107 @kbd{G} (@code{vip-goto-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1163 Given a count @var{n}, move point to the @var{n}-th line in the buffer on
Dave Love <fx@gnu.org>
parents:
diff changeset
1164 the first non-white character. Without a count, go to the end of the buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
1165 (@code{vip-goto-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1166 @item ` `
Dave Love <fx@gnu.org>
parents:
diff changeset
1167 @kindex 140 @kbd{`} (@code{vip-goto-mark})
Dave Love <fx@gnu.org>
parents:
diff changeset
1168 Exchange point and mark (@code{vip-goto-mark}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1169 @item ` @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1170 Move point to the position stored in the register @var{ch}. @var{ch} must
Dave Love <fx@gnu.org>
parents:
diff changeset
1171 be a lower-case letter.
Dave Love <fx@gnu.org>
parents:
diff changeset
1172 @item ' '
Dave Love <fx@gnu.org>
parents:
diff changeset
1173 @kindex 047 @kbd{'} (@code{vip-goto-mark-and-skip-white})
Dave Love <fx@gnu.org>
parents:
diff changeset
1174 Exchange point and mark, and then move point to the first non-white
Dave Love <fx@gnu.org>
parents:
diff changeset
1175 character on the line (@code{vip-goto-mark-and-skip-white}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1176 @item ' @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1177 Move point to the position stored in the register @var{ch} and skip to the
Dave Love <fx@gnu.org>
parents:
diff changeset
1178 first non-white character on the line. @var{ch} must be a lower-case letter.
Dave Love <fx@gnu.org>
parents:
diff changeset
1179 @item %
Dave Love <fx@gnu.org>
parents:
diff changeset
1180 @kindex 045 @kbd{%} (@code{vip-paren-match})
Dave Love <fx@gnu.org>
parents:
diff changeset
1181 Move point to the matching parenthesis if point is looking at @kbd{(},
Dave Love <fx@gnu.org>
parents:
diff changeset
1182 @kbd{)}, @kbd{@{}, @kbd{@}}, @kbd{[} or @kbd{]}
Dave Love <fx@gnu.org>
parents:
diff changeset
1183 @*(@code{vip-paren-match}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1184 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1185 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1186 The command @kbd{G} mark point before move, so that you can return to the
Dave Love <fx@gnu.org>
parents:
diff changeset
1187 original point by @kbd{` `}. The original point will also be stored in
Dave Love <fx@gnu.org>
parents:
diff changeset
1188 the mark ring.
Dave Love <fx@gnu.org>
parents:
diff changeset
1189
Dave Love <fx@gnu.org>
parents:
diff changeset
1190 The following commands are useful for moving points on the line. A count
Dave Love <fx@gnu.org>
parents:
diff changeset
1191 will repeat the effect.
Dave Love <fx@gnu.org>
parents:
diff changeset
1192
Dave Love <fx@gnu.org>
parents:
diff changeset
1193 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1194 @item f @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1195 @kindex 146 @kbd{f} (@code{vip-find-char-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1196 Move point forward to the character @var{ch} on the line. Signal error if
Dave Love <fx@gnu.org>
parents:
diff changeset
1197 @var{ch} could not be found (@code{vip-find-char-forward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1198 @item F @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1199 @kindex 106 @kbd{F} (@code{vip-find-char-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1200 Move point backward to the character @var{ch} on the line. Signal error if
Dave Love <fx@gnu.org>
parents:
diff changeset
1201 @var{ch} could not be found (@code{vip-find-char-backward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1202 @item t @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1203 @kindex 164 @kbd{t} (@code{vip-goto-char-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1204 Move point forward upto the character @var{ch} on the line. Signal error if
Dave Love <fx@gnu.org>
parents:
diff changeset
1205 @var{ch} could not be found (@code{vip-goto-char-forward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1206 @item T @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1207 @kindex 124 @kbd{T} (@code{vip-goto-char-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1208 Move point backward upto the character @var{ch} on the line. Signal error if
Dave Love <fx@gnu.org>
parents:
diff changeset
1209 @var{ch} could not be found (@code{vip-goto-char-backward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1210 @item ;
Dave Love <fx@gnu.org>
parents:
diff changeset
1211 @kindex 073 @kbd{;} (@code{vip-repeat-find})
Dave Love <fx@gnu.org>
parents:
diff changeset
1212 Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command
Dave Love <fx@gnu.org>
parents:
diff changeset
1213 (@code{vip-repeat-find}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1214 @item ,
Dave Love <fx@gnu.org>
parents:
diff changeset
1215 @kindex 054 @kbd{,} (@code{vip-repeat-find-opposite})
Dave Love <fx@gnu.org>
parents:
diff changeset
1216 Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command, in the
Dave Love <fx@gnu.org>
parents:
diff changeset
1217 opposite direction (@code{vip-repeat-find-opposite}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1218 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1219
Dave Love <fx@gnu.org>
parents:
diff changeset
1220 @node Searching and Replacing, Modifying Commands, Motion Commands, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1221 @section Searching and Replacing
Dave Love <fx@gnu.org>
parents:
diff changeset
1222
Dave Love <fx@gnu.org>
parents:
diff changeset
1223 Following commands are available for searching and replacing.
Dave Love <fx@gnu.org>
parents:
diff changeset
1224
Dave Love <fx@gnu.org>
parents:
diff changeset
1225 @cindex regular expression (search)
Dave Love <fx@gnu.org>
parents:
diff changeset
1226
Dave Love <fx@gnu.org>
parents:
diff changeset
1227 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1228 @item / @var{string} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
1229 @kindex 057 @kbd{/} (@code{vip-search-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1230 Search the first occurrence of the string @var{string} forward starting
Dave Love <fx@gnu.org>
parents:
diff changeset
1231 from point. Given a count @var{n}, the @var{n}-th occurrence of
Dave Love <fx@gnu.org>
parents:
diff changeset
1232 @var{string} will be searched. If the variable @code{vip-re-search} has value
Dave Love <fx@gnu.org>
parents:
diff changeset
1233 @code{t} then @dfn{regular expression} search is done and the string
Dave Love <fx@gnu.org>
parents:
diff changeset
1234 matching the regular expression @var{string} is found. If you give an
Dave Love <fx@gnu.org>
parents:
diff changeset
1235 empty string as @var{string} then the search mode will change from vanilla
Dave Love <fx@gnu.org>
parents:
diff changeset
1236 search to regular expression search and vice versa
Dave Love <fx@gnu.org>
parents:
diff changeset
1237 (@code{vip-search-forward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1238 @item ? @var{string} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
1239 @kindex 077 @kbd{?} (@code{vip-search-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1240 Same as @kbd{/}, except that search is done backward
Dave Love <fx@gnu.org>
parents:
diff changeset
1241 (@code{vip-search-backward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1242 @item n
Dave Love <fx@gnu.org>
parents:
diff changeset
1243 @kindex 156 @kbd{n} (@code{vip-search-next})
Dave Love <fx@gnu.org>
parents:
diff changeset
1244 Search the previous search pattern in the same direction as before
Dave Love <fx@gnu.org>
parents:
diff changeset
1245 (@code{vip-search-next}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1246 @item N
Dave Love <fx@gnu.org>
parents:
diff changeset
1247 @kindex 116 @kbd{N} (@code{vip-search-Next})
Dave Love <fx@gnu.org>
parents:
diff changeset
1248 Search the previous search pattern in the opposite direction
Dave Love <fx@gnu.org>
parents:
diff changeset
1249 (@code{vip-search-Next}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1250 @item C-s
Dave Love <fx@gnu.org>
parents:
diff changeset
1251 @kindex 023 @kbd{C-s} (@code{isearch-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1252 Search forward incrementally. See GNU Emacs Manual for details
Dave Love <fx@gnu.org>
parents:
diff changeset
1253 (@code{isearch-forward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1254 @item C-r
Dave Love <fx@gnu.org>
parents:
diff changeset
1255 @kindex 022 @kbd{C-r} (@code{isearch-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1256 Search backward incrementally (@code{isearch-backward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1257 @cindex vanilla (replacement)
Dave Love <fx@gnu.org>
parents:
diff changeset
1258 @cindex regular expression (replacement)
Dave Love <fx@gnu.org>
parents:
diff changeset
1259 @item R @var{string} RET @var{newstring}
Dave Love <fx@gnu.org>
parents:
diff changeset
1260 @kindex 122 @kbd{R} (@code{vip-replace-string})
Dave Love <fx@gnu.org>
parents:
diff changeset
1261 There are two modes of replacement, @dfn{vanilla} and @dfn{regular expression}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1262 If the mode is @i{vanilla} you will get a prompt @samp{Replace string:},
Dave Love <fx@gnu.org>
parents:
diff changeset
1263 and if the mode is @i{regular expression} you will ge a prompt
Dave Love <fx@gnu.org>
parents:
diff changeset
1264 @samp{Replace regexp:}. The mode is initially @i{vanilla}, but you can
Dave Love <fx@gnu.org>
parents:
diff changeset
1265 toggle these modes by giving a null string as @var{string}. If the mode is
Dave Love <fx@gnu.org>
parents:
diff changeset
1266 vanilla, this command replaces every occurrence of @var{string} with
Dave Love <fx@gnu.org>
parents:
diff changeset
1267 @var{newstring}. If the mode is regular expression, @var{string} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1268 treated as a regular expression and every string matching the regular
Dave Love <fx@gnu.org>
parents:
diff changeset
1269 expression is replaced with @var{newstring} (@code{vip-replace-string}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1270 @item Q @var{string} RET @var{newstring}
Dave Love <fx@gnu.org>
parents:
diff changeset
1271 @kindex 121 @kbd{Q} (@code{vip-query-replace})
Dave Love <fx@gnu.org>
parents:
diff changeset
1272 Same as @kbd{R} except that you will be asked form confirmation before each
Dave Love <fx@gnu.org>
parents:
diff changeset
1273 replacement
Dave Love <fx@gnu.org>
parents:
diff changeset
1274 @*(@code{vip-query-replace}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1275 @item r @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1276 @kindex 162 @kbd{r} (@code{vip-replace-char})
Dave Love <fx@gnu.org>
parents:
diff changeset
1277 Replace the character point is looking at by the character @var{ch}. Give
Dave Love <fx@gnu.org>
parents:
diff changeset
1278 count, replace that many characters by @var{ch} (@code{vip-replace-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1279 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1280 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1281 The commands @kbd{/} and @kbd{?} mark point before move, so that you can
Dave Love <fx@gnu.org>
parents:
diff changeset
1282 return to the original point by @w{@kbd{` `}}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1283
Dave Love <fx@gnu.org>
parents:
diff changeset
1284 @node Modifying Commands, Delete Commands, Searching and Replacing, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1285 @section Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1286
Dave Love <fx@gnu.org>
parents:
diff changeset
1287 In this section, commands for modifying the content of a buffer are
Dave Love <fx@gnu.org>
parents:
diff changeset
1288 described. These commands affect the region determined by a motion command
Dave Love <fx@gnu.org>
parents:
diff changeset
1289 which is given to the commands as their argument.
Dave Love <fx@gnu.org>
parents:
diff changeset
1290
Dave Love <fx@gnu.org>
parents:
diff changeset
1291 @cindex point commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1292 @cindex line commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1293
Dave Love <fx@gnu.org>
parents:
diff changeset
1294 We classify motion commands into @dfn{point commands} and
Dave Love <fx@gnu.org>
parents:
diff changeset
1295 @dfn{line commands}. The point commands are as follows:
Dave Love <fx@gnu.org>
parents:
diff changeset
1296 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1297 @kbd{h}, @kbd{l}, @kbd{0}, @kbd{^}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B}, @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f}, @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,}
Dave Love <fx@gnu.org>
parents:
diff changeset
1298 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1299 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1300 The line commands are as follows:
Dave Love <fx@gnu.org>
parents:
diff changeset
1301 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1302 @kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{}, @kbd{@}}, @kbd{G}, @kbd{'}
Dave Love <fx@gnu.org>
parents:
diff changeset
1303 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1304 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1305 @cindex expanding (region)
Dave Love <fx@gnu.org>
parents:
diff changeset
1306 If a point command is given as an argument to a modifying command, the
Dave Love <fx@gnu.org>
parents:
diff changeset
1307 region determined by the point command will be affected by the modifying
Dave Love <fx@gnu.org>
parents:
diff changeset
1308 command. On the other hand, if a line command is given as an argument to a
Dave Love <fx@gnu.org>
parents:
diff changeset
1309 modifying command, the region determined by the line command will be
Dave Love <fx@gnu.org>
parents:
diff changeset
1310 enlarged so that it will become the smallest region properly containing the
Dave Love <fx@gnu.org>
parents:
diff changeset
1311 region and consisting of whole lines (we call this process @dfn{expanding
Dave Love <fx@gnu.org>
parents:
diff changeset
1312 the region}), and then the enlarged region will be affected by the modifying
Dave Love <fx@gnu.org>
parents:
diff changeset
1313 command.
Dave Love <fx@gnu.org>
parents:
diff changeset
1314
Dave Love <fx@gnu.org>
parents:
diff changeset
1315 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1316 * Delete Commands:: Commands for deleting text.
Dave Love <fx@gnu.org>
parents:
diff changeset
1317 * Yank Commands:: Commands for yanking text in Vi's sense.
Dave Love <fx@gnu.org>
parents:
diff changeset
1318 * Put Back Commands:: Commands for putting back deleted/yanked text.
Dave Love <fx@gnu.org>
parents:
diff changeset
1319 * Change Commands:: Commands for changing text.
Dave Love <fx@gnu.org>
parents:
diff changeset
1320 * Repeating and Undoing Modifications::
Dave Love <fx@gnu.org>
parents:
diff changeset
1321 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1322 @node Delete Commands, Yank Commands, Modifying Commands, Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1323 @subsection Delete Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1324
Dave Love <fx@gnu.org>
parents:
diff changeset
1325 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1326 @item d @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1327 @kindex 1440 @kbd{d} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1328 Delete the region determined by the motion command @var{motion-command}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1329 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1330 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1331 For example, @kbd{d $} will delete the region between point and end of
Dave Love <fx@gnu.org>
parents:
diff changeset
1332 current line since @kbd{$} is a point command that moves point to end of line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1333 @kbd{d G} will delete the region between the beginning of current line and
Dave Love <fx@gnu.org>
parents:
diff changeset
1334 end of the buffer, since @kbd{G} is a line command. A count given to the
Dave Love <fx@gnu.org>
parents:
diff changeset
1335 command above will become the count for the associated motion command.
Dave Love <fx@gnu.org>
parents:
diff changeset
1336 Thus, @kbd{3 d w} will delete three words.
Dave Love <fx@gnu.org>
parents:
diff changeset
1337
Dave Love <fx@gnu.org>
parents:
diff changeset
1338 @kindex 042 @kbd{"} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1339 It is also possible to save the deleted text into a register you specify.
Dave Love <fx@gnu.org>
parents:
diff changeset
1340 For example, you can say @kbd{" t 3 d w} to delete three words and save it
Dave Love <fx@gnu.org>
parents:
diff changeset
1341 to register @kbd{t}. The name of a register is a lower-case letter between
Dave Love <fx@gnu.org>
parents:
diff changeset
1342 @kbd{a} and @kbd{z}. If you give an upper-case letter as an argument to
Dave Love <fx@gnu.org>
parents:
diff changeset
1343 a delete command, then the deleted text will be appended to the content of
Dave Love <fx@gnu.org>
parents:
diff changeset
1344 the register having the corresponding lower-case letter as its name. So,
Dave Love <fx@gnu.org>
parents:
diff changeset
1345 @kbd{" T d w} will delete a word and append it to register @kbd{t}. Other
Dave Love <fx@gnu.org>
parents:
diff changeset
1346 modifying commands also accept a register name as their argument, and we
Dave Love <fx@gnu.org>
parents:
diff changeset
1347 will not repeat similar explanations.
Dave Love <fx@gnu.org>
parents:
diff changeset
1348
Dave Love <fx@gnu.org>
parents:
diff changeset
1349 We have more delete commands as below.
Dave Love <fx@gnu.org>
parents:
diff changeset
1350
Dave Love <fx@gnu.org>
parents:
diff changeset
1351 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1352 @item d d
Dave Love <fx@gnu.org>
parents:
diff changeset
1353 @kindex 1442 @kbd{d d}
Dave Love <fx@gnu.org>
parents:
diff changeset
1354 Delete a line. Given a count @var{n}, delete @var{n} lines.
Dave Love <fx@gnu.org>
parents:
diff changeset
1355 @item d r
Dave Love <fx@gnu.org>
parents:
diff changeset
1356 @kindex 1442 @kbd{d r}
Dave Love <fx@gnu.org>
parents:
diff changeset
1357 Delete current region.
Dave Love <fx@gnu.org>
parents:
diff changeset
1358 @item d R
Dave Love <fx@gnu.org>
parents:
diff changeset
1359 @kindex 1441 @kbd{d R}
Dave Love <fx@gnu.org>
parents:
diff changeset
1360 Expand current region and delete it.
Dave Love <fx@gnu.org>
parents:
diff changeset
1361 @item D
Dave Love <fx@gnu.org>
parents:
diff changeset
1362 @kindex 104 @kbd{D} (@code{vip-kill-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1363 Delete to the end of a line (@code{vip-kill-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1364 @item x
Dave Love <fx@gnu.org>
parents:
diff changeset
1365 @kindex 170 @kbd{x} (@code{vip-delete-char})
Dave Love <fx@gnu.org>
parents:
diff changeset
1366 Delete a character after point. Given @var{n}, delete @var{n} characters
Dave Love <fx@gnu.org>
parents:
diff changeset
1367 (@code{vip-delete-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1368 @item @key{DEL}
Dave Love <fx@gnu.org>
parents:
diff changeset
1369 @kindex 177 @kbd{DEL} (@code{vip-delete-backward-char})
Dave Love <fx@gnu.org>
parents:
diff changeset
1370 Delete a character before point. Given @var{n}, delete @var{n} characters
Dave Love <fx@gnu.org>
parents:
diff changeset
1371 (@code{vip-delete-backward-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1372 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1373
Dave Love <fx@gnu.org>
parents:
diff changeset
1374 @node Yank Commands, Put Back Commands, Delete Commands, Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1375 @subsection Yank Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1376
Dave Love <fx@gnu.org>
parents:
diff changeset
1377 @cindex yank
Dave Love <fx@gnu.org>
parents:
diff changeset
1378
Dave Love <fx@gnu.org>
parents:
diff changeset
1379 Yank commands @dfn{yank} a text of buffer into a (usually anonymous) register.
Dave Love <fx@gnu.org>
parents:
diff changeset
1380 Here the word `yank' is used in Vi's sense. Thus yank commands do not
Dave Love <fx@gnu.org>
parents:
diff changeset
1381 alter the content of the buffer, and useful only in combination with
Dave Love <fx@gnu.org>
parents:
diff changeset
1382 commands that put back the yanked text into the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1383
Dave Love <fx@gnu.org>
parents:
diff changeset
1384 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1385 @item y @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1386 @kindex 1710 @kbd{y} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1387 Yank the region determined by the motion command @var{motion-command}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1388 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1389 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1390 For example, @kbd{y $} will yank the text between point and the end of line
Dave Love <fx@gnu.org>
parents:
diff changeset
1391 into an anonymous register, while @kbd{"c y $} will yank the same text into
Dave Love <fx@gnu.org>
parents:
diff changeset
1392 register @kbd{c}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1393
Dave Love <fx@gnu.org>
parents:
diff changeset
1394 Use the following command to yank consecutive lines of text.
Dave Love <fx@gnu.org>
parents:
diff changeset
1395
Dave Love <fx@gnu.org>
parents:
diff changeset
1396 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1397 @item y y
Dave Love <fx@gnu.org>
parents:
diff changeset
1398 @itemx Y
Dave Love <fx@gnu.org>
parents:
diff changeset
1399 @kindex 131 @kbd{Y} (@code{vip-yank-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1400 @kindex 1712 @kbd{y y} (@code{vip-yank-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1401 Yank a line. Given @var{n}, yank @var{n} lines (@code{vip-yank-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1402 @item y r
Dave Love <fx@gnu.org>
parents:
diff changeset
1403 @kindex 1712 @kbd{y r}
Dave Love <fx@gnu.org>
parents:
diff changeset
1404 Yank current region.
Dave Love <fx@gnu.org>
parents:
diff changeset
1405 @item y R
Dave Love <fx@gnu.org>
parents:
diff changeset
1406 @kindex 1711 @kbd{y R}
Dave Love <fx@gnu.org>
parents:
diff changeset
1407 Expand current region and yank it.
Dave Love <fx@gnu.org>
parents:
diff changeset
1408 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1409
Dave Love <fx@gnu.org>
parents:
diff changeset
1410 @node Put Back Commands, Change Commands, Yank Commands, Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1411 @subsection Put Back Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1412 Deleted or yanked texts can be put back into the buffer by the command
Dave Love <fx@gnu.org>
parents:
diff changeset
1413 below.
Dave Love <fx@gnu.org>
parents:
diff changeset
1414
Dave Love <fx@gnu.org>
parents:
diff changeset
1415 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1416 @item p
Dave Love <fx@gnu.org>
parents:
diff changeset
1417 @kindex 160 @kbd{p} (@code{vip-put-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
1418 Insert, after the character point is looking at, most recently
Dave Love <fx@gnu.org>
parents:
diff changeset
1419 deleted/yanked text from anonymous register. Given a register name
Dave Love <fx@gnu.org>
parents:
diff changeset
1420 argument, the content of the named register will be put back. Given a
Dave Love <fx@gnu.org>
parents:
diff changeset
1421 count, the command will be repeated that many times. This command also
Dave Love <fx@gnu.org>
parents:
diff changeset
1422 checks if the text to put back ends with a new line character, and if so
Dave Love <fx@gnu.org>
parents:
diff changeset
1423 the text will be put below the current line (@code{vip-put-back}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1424 @item P
Dave Love <fx@gnu.org>
parents:
diff changeset
1425 @kindex 120 @kbd{P} (@code{vip-Put-back})
Dave Love <fx@gnu.org>
parents:
diff changeset
1426 Insert at point most recently deleted/yanked text from anonymous register.
Dave Love <fx@gnu.org>
parents:
diff changeset
1427 Given a register name argument, the content of the named register will
Dave Love <fx@gnu.org>
parents:
diff changeset
1428 be put back. Given a count, the command will be repeated that many times.
Dave Love <fx@gnu.org>
parents:
diff changeset
1429 This command also checks if the text to put back ends with a new line
Dave Love <fx@gnu.org>
parents:
diff changeset
1430 character, and if so the text will be put above the current line rather
Dave Love <fx@gnu.org>
parents:
diff changeset
1431 than at point (@code{vip-Put-back}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1432 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1433 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1434 @cindex number register
Dave Love <fx@gnu.org>
parents:
diff changeset
1435 Thus, @kbd{" c p} will put back the content of the register @kbd{c} into the
Dave Love <fx@gnu.org>
parents:
diff changeset
1436 buffer. It is also possible to specify @dfn{number register} which is a
Dave Love <fx@gnu.org>
parents:
diff changeset
1437 numeral between @kbd{1} and @kbd{9}. If the number register @var{n} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1438 specified, @var{n}-th previously deleted/yanked text will be put back. It
Dave Love <fx@gnu.org>
parents:
diff changeset
1439 is an error to specify a number register for the delete/yank commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
1440
Dave Love <fx@gnu.org>
parents:
diff changeset
1441 @node Change Commands, Repeating and Undoing Modifications, Put Back Commands, Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1442 @subsection Change Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1443
Dave Love <fx@gnu.org>
parents:
diff changeset
1444 Most commonly used change command takes the following form.
Dave Love <fx@gnu.org>
parents:
diff changeset
1445
Dave Love <fx@gnu.org>
parents:
diff changeset
1446 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1447 @item c @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1448 @kindex 1430 @kbd{c} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1449 Replace the content of the region determined by the motion command
Dave Love <fx@gnu.org>
parents:
diff changeset
1450 @var{motion-command} by the text you type. If the motion command is a
Dave Love <fx@gnu.org>
parents:
diff changeset
1451 point command then you will type the text into minibuffer, and if the
Dave Love <fx@gnu.org>
parents:
diff changeset
1452 motion command is a line command then the region will be deleted first and
Dave Love <fx@gnu.org>
parents:
diff changeset
1453 you can insert the text in @var{insert mode}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1454 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1455 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1456 For example, if point is at the beginning of a word @samp{foo} and you
Dave Love <fx@gnu.org>
parents:
diff changeset
1457 wish to change it to @samp{bar}, you can type @kbd{c w}. Then, as @kbd{w}
Dave Love <fx@gnu.org>
parents:
diff changeset
1458 is a point command, you will get the prompt @samp{foo =>} in the
Dave Love <fx@gnu.org>
parents:
diff changeset
1459 minibuffer, for which you can type @kbd{b a r @key{RET}} to complete the change
Dave Love <fx@gnu.org>
parents:
diff changeset
1460 command.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
1461
Dave Love <fx@gnu.org>
parents:
diff changeset
1462 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1463 @item c c
Dave Love <fx@gnu.org>
parents:
diff changeset
1464 @kindex 1432 @kbd{c c}
Dave Love <fx@gnu.org>
parents:
diff changeset
1465 Change a line. Given a count, that many lines are changed.
Dave Love <fx@gnu.org>
parents:
diff changeset
1466 @item c r
Dave Love <fx@gnu.org>
parents:
diff changeset
1467 @kindex 1432 @kbd{c r}
Dave Love <fx@gnu.org>
parents:
diff changeset
1468 Change current region.
Dave Love <fx@gnu.org>
parents:
diff changeset
1469 @item c R
Dave Love <fx@gnu.org>
parents:
diff changeset
1470 @kindex 1431 @kbd{c R}
Dave Love <fx@gnu.org>
parents:
diff changeset
1471 Expand current region and change it.
Dave Love <fx@gnu.org>
parents:
diff changeset
1472 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1473
Dave Love <fx@gnu.org>
parents:
diff changeset
1474 @node Repeating and Undoing Modifications, Other Vi Commands, Change Commands, Modifying Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1475 @subsection Repeating and Undoing Modifications
Dave Love <fx@gnu.org>
parents:
diff changeset
1476
Dave Love <fx@gnu.org>
parents:
diff changeset
1477 VIP records the previous modifying command, so that it is easy to repeat
Dave Love <fx@gnu.org>
parents:
diff changeset
1478 it. It is also very easy to undo changes made by modifying commands.
Dave Love <fx@gnu.org>
parents:
diff changeset
1479
Dave Love <fx@gnu.org>
parents:
diff changeset
1480 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1481 @item u
Dave Love <fx@gnu.org>
parents:
diff changeset
1482 @kindex 165 @kbd{u} (@code{vip-undo})
Dave Love <fx@gnu.org>
parents:
diff changeset
1483 Undo the last change. You can undo more by repeating undo by the repeat
Dave Love <fx@gnu.org>
parents:
diff changeset
1484 command @samp{.}. For example, you can undo 5 previous changes by typing
Dave Love <fx@gnu.org>
parents:
diff changeset
1485 @samp{u....}. If you type @samp{uu}, then the second @samp{u} undoes the
Dave Love <fx@gnu.org>
parents:
diff changeset
1486 first undo command (@code{vip-undo}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1487 @item .
Dave Love <fx@gnu.org>
parents:
diff changeset
1488 @kindex 056 @kbd{.} (@code{vip-repeat})
Dave Love <fx@gnu.org>
parents:
diff changeset
1489 Repeat the last modifying command. Given count @var{n} it becomes the new
Dave Love <fx@gnu.org>
parents:
diff changeset
1490 count for the repeated command. Otherwise, the count for the last
Dave Love <fx@gnu.org>
parents:
diff changeset
1491 modifying command is used again (@code{vip-repeat}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1492 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1493
Dave Love <fx@gnu.org>
parents:
diff changeset
1494 @node Other Vi Commands, Commands in Insert Mode, Repeating and Undoing Modifications, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1495 @section Other Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1496
Dave Love <fx@gnu.org>
parents:
diff changeset
1497 Miscellaneous Vi commands are collected here.
Dave Love <fx@gnu.org>
parents:
diff changeset
1498
Dave Love <fx@gnu.org>
parents:
diff changeset
1499 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1500 @item Z Z
Dave Love <fx@gnu.org>
parents:
diff changeset
1501 @kindex 132 @kbd{Z Z} (@code{save-buffers-kill-emacs})
Dave Love <fx@gnu.org>
parents:
diff changeset
1502 Exit Emacs. If modified buffers exist, you will be asked whether you wish
Dave Love <fx@gnu.org>
parents:
diff changeset
1503 to save them or not (@code{save-buffers-kill-emacs}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1504 @item !@: @var{motion-command} @var{format-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1505 @itemx @var{n} !@: !@: @var{format-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1506 @kindex 041 @kbd{!} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1507 The region determined by the motion command @var{motion-command} will be
Dave Love <fx@gnu.org>
parents:
diff changeset
1508 given to the shell command @var{format-command} and the region will be
Dave Love <fx@gnu.org>
parents:
diff changeset
1509 replaced by its output. If a count is given, it will be passed to
Dave Love <fx@gnu.org>
parents:
diff changeset
1510 @var{motion-command}. For example, @samp{3!Gsort} will sort the region
Dave Love <fx@gnu.org>
parents:
diff changeset
1511 between point and the 3rd line. If @kbd{!} is used instead of
Dave Love <fx@gnu.org>
parents:
diff changeset
1512 @var{motion-command} then @var{n} lines will be processed by
Dave Love <fx@gnu.org>
parents:
diff changeset
1513 @var{format-command} (@code{vip-command-argument}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1514 @item J
Dave Love <fx@gnu.org>
parents:
diff changeset
1515 @kindex 112 @kbd{J} (@code{vip-join-lines})
Dave Love <fx@gnu.org>
parents:
diff changeset
1516 Join two lines. Given count, join that many lines. A space will be
Dave Love <fx@gnu.org>
parents:
diff changeset
1517 inserted at each junction (@code{vip-join-lines}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1518 @item < @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1519 @itemx @var{n} < <
Dave Love <fx@gnu.org>
parents:
diff changeset
1520 @kindex 074 @kbd{<} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1521 Shift region determined by the motion command @var{motion-command} to
Dave Love <fx@gnu.org>
parents:
diff changeset
1522 left by @var{shift-width} (default is 8). If @kbd{<} is used instead of
Dave Love <fx@gnu.org>
parents:
diff changeset
1523 @var{motion-command} then shift @var{n} lines
Dave Love <fx@gnu.org>
parents:
diff changeset
1524 @*(@code{vip-command-argument}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1525 @item > @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1526 @itemx @var{n} > >
Dave Love <fx@gnu.org>
parents:
diff changeset
1527 @kindex 076 @kbd{>} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1528 Shift region determined by the motion command @var{motion-command} to
Dave Love <fx@gnu.org>
parents:
diff changeset
1529 right by @var{shift-width} (default is 8). If @kbd{<} is used instead of
Dave Love <fx@gnu.org>
parents:
diff changeset
1530 @var{motion-command} then shift @var{n} lines
Dave Love <fx@gnu.org>
parents:
diff changeset
1531 @*(@code{vip-command-argument}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1532 @item = @var{motion-command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1533 @kindex 075 @kbd{=} (@code{vip-command-argument})
Dave Love <fx@gnu.org>
parents:
diff changeset
1534 Indent region determined by the motion command @var{motion-command}. If
Dave Love <fx@gnu.org>
parents:
diff changeset
1535 @kbd{=} is used instead of @var{motion-command} then indent @var{n} lines
Dave Love <fx@gnu.org>
parents:
diff changeset
1536 (@code{vip-command-argument}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1537 @item *
Dave Love <fx@gnu.org>
parents:
diff changeset
1538 @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro})
Dave Love <fx@gnu.org>
parents:
diff changeset
1539 Call last remembered keyboard macro.
Dave Love <fx@gnu.org>
parents:
diff changeset
1540 @item #
Dave Love <fx@gnu.org>
parents:
diff changeset
1541 A new vi operator. @xref{New Commands}, for more details.
Dave Love <fx@gnu.org>
parents:
diff changeset
1542 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1543
Dave Love <fx@gnu.org>
parents:
diff changeset
1544 The following keys are reserved for future extensions, and currently
Dave Love <fx@gnu.org>
parents:
diff changeset
1545 assigned to a function that just beeps (@code{vip-nil}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1546
Dave Love <fx@gnu.org>
parents:
diff changeset
1547 @kindex 046 @kbd{&} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1548 @kindex 100 @kbd{@@} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1549 @kindex 125 @kbd{U} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1550 @kindex 133 @kbd{[} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1551 @kindex 135 @kbd{]} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1552 @kindex 137 @kbd{_} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1553 @kindex 161 @kbd{q} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1554 @kindex 176 @kbd{~} (@code{vip-nil})
Dave Love <fx@gnu.org>
parents:
diff changeset
1555
Dave Love <fx@gnu.org>
parents:
diff changeset
1556 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1557 &, @@, U, [, ], _, q, ~
Dave Love <fx@gnu.org>
parents:
diff changeset
1558 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1559
Dave Love <fx@gnu.org>
parents:
diff changeset
1560 VIP uses a special local keymap to interpret key strokes you enter in vi
Dave Love <fx@gnu.org>
parents:
diff changeset
1561 mode. The following keys are bound to @var{nil} in the keymap. Therefore,
Dave Love <fx@gnu.org>
parents:
diff changeset
1562 these keys are interpreted by the global keymap of Emacs. We give below a
Dave Love <fx@gnu.org>
parents:
diff changeset
1563 short description of the functions bound to these keys in the global
Dave Love <fx@gnu.org>
parents:
diff changeset
1564 keymap. See GNU Emacs Manual for details.
Dave Love <fx@gnu.org>
parents:
diff changeset
1565
Dave Love <fx@gnu.org>
parents:
diff changeset
1566 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1567 @item C-@@
Dave Love <fx@gnu.org>
parents:
diff changeset
1568 @kindex 000 @kbd{C-@@} (@code{set-mark-command})
Dave Love <fx@gnu.org>
parents:
diff changeset
1569 Set mark and push previous mark on mark ring (@code{set-mark-command}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1570 @item TAB
68319
40fd5f72c481 Don't use @kbd for TAB in index.
Eli Zaretskii <eliz@gnu.org>
parents: 65555
diff changeset
1571 @kindex 011 TAB (@code{indent-for-tab-command})
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1572 Indent line for current major mode (@code{indent-for-tab-command}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1573 @item C-j
Dave Love <fx@gnu.org>
parents:
diff changeset
1574 @kindex 012 @kbd{C-j} (@code{newline-and-indent})
Dave Love <fx@gnu.org>
parents:
diff changeset
1575 Insert a newline, then indent according to mode (@code{newline-and-indent}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1576 @item C-k
Dave Love <fx@gnu.org>
parents:
diff changeset
1577 @kindex 013 @kbd{C-k} (@code{kill-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1578 Kill the rest of the current line; before a newline, kill the newline.
Dave Love <fx@gnu.org>
parents:
diff changeset
1579 With a numeric argument, kill that many lines from point. Negative arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
1580 kill lines backward (@code{kill-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1581 @item C-l
Dave Love <fx@gnu.org>
parents:
diff changeset
1582 @kindex 014 @kbd{C-l} (@code{recenter})
Dave Love <fx@gnu.org>
parents:
diff changeset
1583 Clear the screen and reprint everything (@code{recenter}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1584 @item @var{n} C-p
Dave Love <fx@gnu.org>
parents:
diff changeset
1585 @kindex 020 @kbd{C-p} (@code{previous-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1586 Move cursor vertically up @var{n} lines (@code{previous-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1587 @item C-q
Dave Love <fx@gnu.org>
parents:
diff changeset
1588 @kindex 021 @kbd{C-q} (@code{quoted-insert})
Dave Love <fx@gnu.org>
parents:
diff changeset
1589 Read next input character and insert it. Useful for inserting control
Dave Love <fx@gnu.org>
parents:
diff changeset
1590 characters
Dave Love <fx@gnu.org>
parents:
diff changeset
1591 @*(@code{quoted-insert}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1592 @item C-r
Dave Love <fx@gnu.org>
parents:
diff changeset
1593 @kindex 022 @kbd{C-r} (@code{isearch-backward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1594 Search backward incrementally (@code{isearch-backward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1595 @item C-s
Dave Love <fx@gnu.org>
parents:
diff changeset
1596 @kindex 023 @kbd{C-s} (@code{isearch-forward})
Dave Love <fx@gnu.org>
parents:
diff changeset
1597 Search forward incrementally (@code{isearch-forward}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1598 @item @var{n} C-t
Dave Love <fx@gnu.org>
parents:
diff changeset
1599 @kindex 024 @kbd{C-t} (@code{transpose-chars})
Dave Love <fx@gnu.org>
parents:
diff changeset
1600 Interchange characters around point, moving forward one character. With
Dave Love <fx@gnu.org>
parents:
diff changeset
1601 count @var{n}, take character before point and drag it forward past @var{n}
Dave Love <fx@gnu.org>
parents:
diff changeset
1602 other characters. If no argument and at end of line, the previous two
Dave Love <fx@gnu.org>
parents:
diff changeset
1603 characters are exchanged (@code{transpose-chars}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1604 @item @var{n} C-v
Dave Love <fx@gnu.org>
parents:
diff changeset
1605 @kindex 026 @kbd{C-v} (@code{scroll-up})
Dave Love <fx@gnu.org>
parents:
diff changeset
1606 Scroll text upward @var{n} lines. If @var{n} is not given, scroll near
Dave Love <fx@gnu.org>
parents:
diff changeset
1607 full screen (@code{scroll-up}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1608 @item C-w
Dave Love <fx@gnu.org>
parents:
diff changeset
1609 @kindex 027 @kbd{C-w} (@code{kill-region})
Dave Love <fx@gnu.org>
parents:
diff changeset
1610 Kill between point and mark. The text is save in the kill ring. The
Dave Love <fx@gnu.org>
parents:
diff changeset
1611 command @kbd{P} or @kbd{p} can retrieve it from kill ring
Dave Love <fx@gnu.org>
parents:
diff changeset
1612 (@code{kill-region}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1613 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1614
Dave Love <fx@gnu.org>
parents:
diff changeset
1615 @node Commands in Insert Mode, Ex Commands, Other Vi Commands, Vi Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1616 @section Insert Mode
Dave Love <fx@gnu.org>
parents:
diff changeset
1617
Dave Love <fx@gnu.org>
parents:
diff changeset
1618 You can enter insert mode by one of the following commands. In addition to
Dave Love <fx@gnu.org>
parents:
diff changeset
1619 these, you will enter insert mode if you give a change command with a line
Dave Love <fx@gnu.org>
parents:
diff changeset
1620 command as the motion command. Insert commands are also modifying commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1621 and you can repeat them by the repeat command @kbd{.} (@code{vip-repeat}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1622
Dave Love <fx@gnu.org>
parents:
diff changeset
1623 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1624 @item i
Dave Love <fx@gnu.org>
parents:
diff changeset
1625 @kindex 151 @kbd{i} (@code{vip-insert})
Dave Love <fx@gnu.org>
parents:
diff changeset
1626 Enter insert mode at point (@code{vip-insert}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1627 @item I
Dave Love <fx@gnu.org>
parents:
diff changeset
1628 @kindex 111 @kbd{I} (@code{vip-Insert})
Dave Love <fx@gnu.org>
parents:
diff changeset
1629 Enter insert mode at the first non white character on the line
Dave Love <fx@gnu.org>
parents:
diff changeset
1630 (@code{vip-Insert}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1631 @item a
Dave Love <fx@gnu.org>
parents:
diff changeset
1632 @kindex 141 @kbd{a} (@code{vip-append})
Dave Love <fx@gnu.org>
parents:
diff changeset
1633 Move point forward by one character and then enter insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
1634 (@code{vip-append}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1635 @item A
Dave Love <fx@gnu.org>
parents:
diff changeset
1636 @kindex 101 @kbd{A} (@code{vip-Append})
Dave Love <fx@gnu.org>
parents:
diff changeset
1637 Enter insert mode at end of line (@code{vip-Append}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1638 @item o
Dave Love <fx@gnu.org>
parents:
diff changeset
1639 @kindex 157 @kbd{o} (@code{vip-open-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1640 Open a new line below the current line and enter insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
1641 (@code{vip-open-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1642 @item O
Dave Love <fx@gnu.org>
parents:
diff changeset
1643 @kindex 117 @kbd{O} (@code{vip-Open-line})
Dave Love <fx@gnu.org>
parents:
diff changeset
1644 Open a new line above the current line and enter insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
1645 (@code{vip-Open-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1646 @item C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
1647 @kindex 017 @kbd{C-o} (@code{vip-open-line-at-point})
Dave Love <fx@gnu.org>
parents:
diff changeset
1648 Insert a newline and leave point before it, and then enter insert mode
Dave Love <fx@gnu.org>
parents:
diff changeset
1649 @*(@code{vip-open-line-at-point}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1650 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1651
Dave Love <fx@gnu.org>
parents:
diff changeset
1652 Insert mode is almost like emacs mode. Only the following 4 keys behave
Dave Love <fx@gnu.org>
parents:
diff changeset
1653 differently from emacs mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
1654
Dave Love <fx@gnu.org>
parents:
diff changeset
1655 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1656 @item @key{ESC}
Dave Love <fx@gnu.org>
parents:
diff changeset
1657 @kindex 033 @kbd{ESC} (@code{vip-change-mode-to-vi}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
1658 This key will take you back to vi mode (@code{vip-change-mode-to-vi}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1659 @item C-h
Dave Love <fx@gnu.org>
parents:
diff changeset
1660 @kindex 010 @kbd{C-h} (@code{delete-backward-char}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
1661 Delete previous character (@code{delete-backward-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1662 @item C-w
Dave Love <fx@gnu.org>
parents:
diff changeset
1663 @kindex 027 @kbd{C-w} (@code{vip-delete-backward-word}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
1664 Delete previous word (@code{vip-delete-backward-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1665 @item C-z
Dave Love <fx@gnu.org>
parents:
diff changeset
1666 @kindex 032 @kbd{C-z} (@code{vip-ESC}) (insert mode)
Dave Love <fx@gnu.org>
parents:
diff changeset
1667 This key simulates @key{ESC} key in emacs mode. For instance, typing
71224
b7261e09f8e4 * cc-mode.texi (Getting Started, Indentation Commands, Config Basics)
Romain Francoise <romain@orebokech.com>
parents: 69681
diff changeset
1668 @kbd{C-z x} in insert mode is the same as typing @kbd{ESC x} in emacs mode
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1669 (@code{vip-ESC}).
Dave Love <fx@gnu.org>
parents:
diff changeset
1670 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1671 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1672 You can also bind @kbd{C-h} to @code{help-command} if you like.
Dave Love <fx@gnu.org>
parents:
diff changeset
1673 (@xref{Customizing Key Bindings}, for details.) Binding @kbd{C-h} to
Dave Love <fx@gnu.org>
parents:
diff changeset
1674 @code{help-command} has the effect of making the meaning of @kbd{C-h}
Dave Love <fx@gnu.org>
parents:
diff changeset
1675 uniform among emacs, vi and insert modes.
Dave Love <fx@gnu.org>
parents:
diff changeset
1676
Dave Love <fx@gnu.org>
parents:
diff changeset
1677 When you enter insert mode, VIP records point as the start point of
Dave Love <fx@gnu.org>
parents:
diff changeset
1678 insertion, and when you leave insert mode the region between point and
Dave Love <fx@gnu.org>
parents:
diff changeset
1679 start point is saved for later use by repeat command etc. Therefore, repeat
Dave Love <fx@gnu.org>
parents:
diff changeset
1680 command will not really repeat insertion if you move point by emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
1681 commands while in insert mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
1682
Dave Love <fx@gnu.org>
parents:
diff changeset
1683 @node Ex Commands, Ex Command Reference, Commands in Insert Mode, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
1684 @chapter Ex Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1685
Dave Love <fx@gnu.org>
parents:
diff changeset
1686 @kindex 072 @kbd{:} (@code{vip-ex})
Dave Love <fx@gnu.org>
parents:
diff changeset
1687
Dave Love <fx@gnu.org>
parents:
diff changeset
1688 In vi mode, you can execute an Ex command @var{ex-command} by typing:
Dave Love <fx@gnu.org>
parents:
diff changeset
1689 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1690 @kbd{:@: @var{ex-command} @key{RET}}
Dave Love <fx@gnu.org>
parents:
diff changeset
1691 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1692 Every Ex command follows the following pattern:
Dave Love <fx@gnu.org>
parents:
diff changeset
1693 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1694 @var{address command} @kbd{!}@: @var{parameters count flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1695 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1696 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1697 @cindex address
Dave Love <fx@gnu.org>
parents:
diff changeset
1698 where all parts are optional. For the syntax of @dfn{address}, the reader
Dave Love <fx@gnu.org>
parents:
diff changeset
1699 is referred to the reference manual of Ex.
Dave Love <fx@gnu.org>
parents:
diff changeset
1700
Dave Love <fx@gnu.org>
parents:
diff changeset
1701 @cindex magic
Dave Love <fx@gnu.org>
parents:
diff changeset
1702 @cindex regular expression
Dave Love <fx@gnu.org>
parents:
diff changeset
1703
Dave Love <fx@gnu.org>
parents:
diff changeset
1704 In the current version of VIP, searching by Ex commands is always
Dave Love <fx@gnu.org>
parents:
diff changeset
1705 @dfn{magic}. That is, search patterns are always treated as @dfn{regular
Dave Love <fx@gnu.org>
parents:
diff changeset
1706 expressions}. For example, a typical forward search would be invoked by
Dave Love <fx@gnu.org>
parents:
diff changeset
1707 @kbd{:/@var{pat}/}. If you wish to include @samp{/} as part of
Dave Love <fx@gnu.org>
parents:
diff changeset
1708 @var{pat} you must preceded it by @samp{\}. VIP strips off these @kbd{\}'s
Dave Love <fx@gnu.org>
parents:
diff changeset
1709 before @kbd{/} and the resulting @var{pat} becomes the actual search
Dave Love <fx@gnu.org>
parents:
diff changeset
1710 pattern. Emacs provides a different and richer class or regular
Dave Love <fx@gnu.org>
parents:
diff changeset
1711 expressions than Vi/Ex, and VIP uses Emacs' regular expressions. See GNU
Dave Love <fx@gnu.org>
parents:
diff changeset
1712 Emacs Manual for details of regular expressions.
Dave Love <fx@gnu.org>
parents:
diff changeset
1713
Dave Love <fx@gnu.org>
parents:
diff changeset
1714 Several Ex commands can be entered in a line by separating them by a pipe
Dave Love <fx@gnu.org>
parents:
diff changeset
1715 character @samp{|}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1716
Dave Love <fx@gnu.org>
parents:
diff changeset
1717 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1718 * Ex Command Reference:: Explain all the Ex commands available in VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
1719 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1720 @node Ex Command Reference, Customization, Ex Commands, Ex Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1721 @section Ex Command Reference
Dave Love <fx@gnu.org>
parents:
diff changeset
1722 In this section we briefly explain all the Ex commands supported by VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
1723 Most Ex commands expect @var{address} as their argument, and they use
Dave Love <fx@gnu.org>
parents:
diff changeset
1724 default addresses if they are not explicitly given. In the following, such
Dave Love <fx@gnu.org>
parents:
diff changeset
1725 default addresses will be shown in parentheses.
Dave Love <fx@gnu.org>
parents:
diff changeset
1726
Dave Love <fx@gnu.org>
parents:
diff changeset
1727 Most command names can and preferably be given in abbreviated forms. In
Dave Love <fx@gnu.org>
parents:
diff changeset
1728 the following, optional parts of command names will be enclosed in
Dave Love <fx@gnu.org>
parents:
diff changeset
1729 brackets. For example, @samp{co[py]} will mean that copy command can be
Dave Love <fx@gnu.org>
parents:
diff changeset
1730 give as @samp{co} or @samp{cop} or @samp{copy}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1731
Dave Love <fx@gnu.org>
parents:
diff changeset
1732 If @var{command} is empty, point will move to the beginning of the line
Dave Love <fx@gnu.org>
parents:
diff changeset
1733 specified by the @var{address}. If @var{address} is also empty, point will
Dave Love <fx@gnu.org>
parents:
diff changeset
1734 move to the beginning of the current line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1735
Dave Love <fx@gnu.org>
parents:
diff changeset
1736 @cindex flag
Dave Love <fx@gnu.org>
parents:
diff changeset
1737
Dave Love <fx@gnu.org>
parents:
diff changeset
1738 Some commands accept @dfn{flags} which are one of @kbd{p}, @kbd{l} and
Dave Love <fx@gnu.org>
parents:
diff changeset
1739 @kbd{#}. If @var{flags} are given, the text affected by the commands will
Dave Love <fx@gnu.org>
parents:
diff changeset
1740 be displayed on a temporary window, and you will be asked to hit return to
Dave Love <fx@gnu.org>
parents:
diff changeset
1741 continue. In this way, you can see the text affected by the commands
Dave Love <fx@gnu.org>
parents:
diff changeset
1742 before the commands will be executed. If you hit @kbd{C-g} instead of
Dave Love <fx@gnu.org>
parents:
diff changeset
1743 @key{RET} then the commands will be aborted. Note that the meaning of
Dave Love <fx@gnu.org>
parents:
diff changeset
1744 @var{flags} is different in VIP from that in Vi/Ex.
Dave Love <fx@gnu.org>
parents:
diff changeset
1745
Dave Love <fx@gnu.org>
parents:
diff changeset
1746 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
1747 @item (.,.@:) co[py] @var{addr} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1748 @itemx (.,.@:) t @var{addr} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1749 Place a copy of specified lines after @var{addr}. If @var{addr} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1750 @kbd{0}, it will be placed before the first line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1751 @item (.,.@:) d[elete] @var{register} @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1752 Delete specified lines. Text will be saved in a named @var{register} if a
Dave Love <fx@gnu.org>
parents:
diff changeset
1753 lower-case letter is given, and appended to a register if a capital letter is
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47737
diff changeset
1754 given.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1755 @item e[dit] !@: +@var{addr} @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1756 @itemx e[x] !@: +@var{addr} @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1757 @itemx vi[sual] !@: +@var{addr} @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1758 Edit a new file @var{file} in the current window. The command will abort
Dave Love <fx@gnu.org>
parents:
diff changeset
1759 if current buffer is modified, which you can override by giving @kbd{!}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1760 If @kbd{+}@var{addr} is given, @var{addr} becomes the current line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1761 @item file
Dave Love <fx@gnu.org>
parents:
diff changeset
1762 Give information about the current file.
Dave Love <fx@gnu.org>
parents:
diff changeset
1763 @item (1,$) g[lobal] !@: /@var{pat}/ @var{cmds}
Dave Love <fx@gnu.org>
parents:
diff changeset
1764 @itemx (1,$) v /@var{pat}/ @var{cmds}
Dave Love <fx@gnu.org>
parents:
diff changeset
1765 Among specified lines first mark each line which matches the regular
Dave Love <fx@gnu.org>
parents:
diff changeset
1766 expression @var{pat}, and then execute @var{cmds} on each marked line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1767 If @kbd{!}@: is given, @var{cmds} will be executed on each line not matching
Dave Love <fx@gnu.org>
parents:
diff changeset
1768 @var{pat}. @kbd{v} is same as @kbd{g!}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1769 @item (.,.+1) j[oin] !@: @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1770 Join specified lines into a line. Without @kbd{!}, a space character will
Dave Love <fx@gnu.org>
parents:
diff changeset
1771 be inserted at each junction.
Dave Love <fx@gnu.org>
parents:
diff changeset
1772 @item (.@:) k @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1773 @itemx (.@:) mar[k] @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1774 Mark specified line by a lower-case character @var{ch}. Then the
Dave Love <fx@gnu.org>
parents:
diff changeset
1775 addressing form @kbd{'}@var{ch} will refer to this line. No white space is
Dave Love <fx@gnu.org>
parents:
diff changeset
1776 required between @kbd{k} and @var{ch}. A white space is necessary between
Dave Love <fx@gnu.org>
parents:
diff changeset
1777 @kbd{mark} and @var{ch}, however.
Dave Love <fx@gnu.org>
parents:
diff changeset
1778 @item map @var{ch} @var{rhs}
Dave Love <fx@gnu.org>
parents:
diff changeset
1779 Define a macro for vi mode. After this command, the character @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1780 will be expanded to @var{rhs} in vi mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
1781 @item (.,.@:) m[ove] @var{addr}
Dave Love <fx@gnu.org>
parents:
diff changeset
1782 Move specified lines after @var{addr}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1783 @item (.@:) pu[t] @var{register}
Dave Love <fx@gnu.org>
parents:
diff changeset
1784 Put back previously deleted or yanked text. If @var{register} is given,
Dave Love <fx@gnu.org>
parents:
diff changeset
1785 the text saved in the register will be put back; otherwise, last deleted or
Dave Love <fx@gnu.org>
parents:
diff changeset
1786 yanked text will be put back.
Dave Love <fx@gnu.org>
parents:
diff changeset
1787 @item q[uit] !
Dave Love <fx@gnu.org>
parents:
diff changeset
1788 Quit from Emacs. If modified buffers with associated files exist, you will
Dave Love <fx@gnu.org>
parents:
diff changeset
1789 be asked whether you wish to save each of them. At this point, you may
Dave Love <fx@gnu.org>
parents:
diff changeset
1790 choose not to quit, by hitting @kbd{C-g}. If @kbd{!}@: is given, exit from
Dave Love <fx@gnu.org>
parents:
diff changeset
1791 Emacs without saving modified buffers.
Dave Love <fx@gnu.org>
parents:
diff changeset
1792 @item (.@:) r[ead] @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1793 Read in the content of the file @var{file} after the specified line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1794 @item (.@:) r[ead] !@: @var{command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1795 Read in the output of the shell command @var{command} after the specified
Dave Love <fx@gnu.org>
parents:
diff changeset
1796 line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1797 @item se[t]
Dave Love <fx@gnu.org>
parents:
diff changeset
1798 Set a variable's value. @xref{Customizing Constants}, for the list of variables
Dave Love <fx@gnu.org>
parents:
diff changeset
1799 you can set.
Dave Love <fx@gnu.org>
parents:
diff changeset
1800 @item sh[ell]
Dave Love <fx@gnu.org>
parents:
diff changeset
1801 Run a subshell in a window.
Dave Love <fx@gnu.org>
parents:
diff changeset
1802 @item (.,.@:) s[ubstitute] /@var{pat}/@var{repl}/ @var{options} @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1803 @itemx (.,.@:) & @var{options} @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1804 On each specified line, the first occurrence of string matching regular
Dave Love <fx@gnu.org>
parents:
diff changeset
1805 expression @var{pat} is replaced by replacement pattern @var{repl}. Option
Dave Love <fx@gnu.org>
parents:
diff changeset
1806 characters are @kbd{g} and @kbd{c}. If global option character @kbd{g}
Dave Love <fx@gnu.org>
parents:
diff changeset
1807 appears as part of @var{options}, all occurrences are substituted. If
Dave Love <fx@gnu.org>
parents:
diff changeset
1808 confirm option character @kbd{c} appears, you will be asked to give
Dave Love <fx@gnu.org>
parents:
diff changeset
1809 confirmation before each substitution. If @kbd{/@var{pat}/@var{repl}/} is
Dave Love <fx@gnu.org>
parents:
diff changeset
1810 missing, the last substitution is repeated.
Dave Love <fx@gnu.org>
parents:
diff changeset
1811 @item st[op]
Dave Love <fx@gnu.org>
parents:
diff changeset
1812 Suspend Emacs.
Dave Love <fx@gnu.org>
parents:
diff changeset
1813 @item ta[g] @var{tag}
Dave Love <fx@gnu.org>
parents:
diff changeset
1814 @cindex tag
Dave Love <fx@gnu.org>
parents:
diff changeset
1815 @cindex selected tags table
Dave Love <fx@gnu.org>
parents:
diff changeset
1816 Find first definition of @var{tag}. If no @var{tag} is given, previously
Dave Love <fx@gnu.org>
parents:
diff changeset
1817 given @var{tag} is used and next alternate definition is find. By default,
Dave Love <fx@gnu.org>
parents:
diff changeset
1818 the file @file{TAGS} in the current directory becomes the @dfn{selected tags
Dave Love <fx@gnu.org>
parents:
diff changeset
1819 table}. You can select another tags table by @kbd{set} command.
Dave Love <fx@gnu.org>
parents:
diff changeset
1820 @xref{Customizing Constants}, for details.
Dave Love <fx@gnu.org>
parents:
diff changeset
1821 @item und[o]
Dave Love <fx@gnu.org>
parents:
diff changeset
1822 Undo the last change.
Dave Love <fx@gnu.org>
parents:
diff changeset
1823 @item unm[ap] @var{ch}
Dave Love <fx@gnu.org>
parents:
diff changeset
1824 The macro expansion associated with @var{ch} is removed.
Dave Love <fx@gnu.org>
parents:
diff changeset
1825 @item ve[rsion]
Dave Love <fx@gnu.org>
parents:
diff changeset
1826 Tell the version number of VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
1827 @item (1,$) w[rite] !@: @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1828 Write out specified lines into file @var{file}. If no @var{file} is given,
Dave Love <fx@gnu.org>
parents:
diff changeset
1829 text will be written to the file associated to the current buffer. Unless
Dave Love <fx@gnu.org>
parents:
diff changeset
1830 @kbd{!}@: is given, if @var{file} is different from the file associated to
Dave Love <fx@gnu.org>
parents:
diff changeset
1831 the current buffer and if the file @var{file} exists, the command will not
Dave Love <fx@gnu.org>
parents:
diff changeset
1832 be executed. Unlike Ex, @var{file} becomes the file associated to the
Dave Love <fx@gnu.org>
parents:
diff changeset
1833 current buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1834 @item (1,$) w[rite]>> @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1835 Write out specified lines at the end of file @var{file}. @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1836 becomes the file associated to the current buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1837 @item (1,$) wq !@: @var{file}
Dave Love <fx@gnu.org>
parents:
diff changeset
1838 Same as @kbd{write} and then @kbd{quit}. If @kbd{!}@: is given, same as
Dave Love <fx@gnu.org>
parents:
diff changeset
1839 @kbd{write !}@: then @kbd{quit}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1840 @item (.,.) y[ank] @var{register} @var{count}
Dave Love <fx@gnu.org>
parents:
diff changeset
1841 Save specified lines into register @var{register}. If no register is
Dave Love <fx@gnu.org>
parents:
diff changeset
1842 specified, text will be saved in an anonymous register.
Dave Love <fx@gnu.org>
parents:
diff changeset
1843 @item @var{addr} !@: @var{command}
Dave Love <fx@gnu.org>
parents:
diff changeset
1844 Execute shell command @var{command}. The output will be shown in a new
Dave Love <fx@gnu.org>
parents:
diff changeset
1845 window. If @var{addr} is given, specified lines will be used as standard
Dave Love <fx@gnu.org>
parents:
diff changeset
1846 input to @var{command}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1847 @item ($) =
Dave Love <fx@gnu.org>
parents:
diff changeset
1848 Print the line number of the addressed line.
Dave Love <fx@gnu.org>
parents:
diff changeset
1849 @item (.,.) > @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1850 Shift specified lines to the right. The variable @code{vip-shift-width}
Dave Love <fx@gnu.org>
parents:
diff changeset
1851 (default value is 8) determines the amount of shift.
Dave Love <fx@gnu.org>
parents:
diff changeset
1852 @item (.,.) < @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1853 Shift specified lines to the left. The variable @code{vip-shift-width}
Dave Love <fx@gnu.org>
parents:
diff changeset
1854 (default value is 8) determines the amount of shift.
Dave Love <fx@gnu.org>
parents:
diff changeset
1855 @item (.,.@:) ~ @var{options} @var{count} @var{flags}
Dave Love <fx@gnu.org>
parents:
diff changeset
1856 Repeat the previous @kbd{substitute} command using previous search pattern
Dave Love <fx@gnu.org>
parents:
diff changeset
1857 as @var{pat} for matching.
Dave Love <fx@gnu.org>
parents:
diff changeset
1858 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1859
Dave Love <fx@gnu.org>
parents:
diff changeset
1860 The following Ex commands are available in Vi, but not implemented in VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
1861 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1862 @kbd{abbreviate}, @kbd{list}, @kbd{next}, @kbd{print}, @kbd{preserve}, @kbd{recover}, @kbd{rewind}, @kbd{source},
Dave Love <fx@gnu.org>
parents:
diff changeset
1863 @kbd{unabbreviate}, @kbd{xit}, @kbd{z}
Dave Love <fx@gnu.org>
parents:
diff changeset
1864 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1865
Dave Love <fx@gnu.org>
parents:
diff changeset
1866 @node Customization, Customizing Constants, Ex Command Reference, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
1867 @chapter Customization
Dave Love <fx@gnu.org>
parents:
diff changeset
1868
Dave Love <fx@gnu.org>
parents:
diff changeset
1869 If you have a file called @file{.vip} in your home directory, then it
Dave Love <fx@gnu.org>
parents:
diff changeset
1870 will also be loaded when VIP is loaded. This file is thus useful for
Dave Love <fx@gnu.org>
parents:
diff changeset
1871 customizing VIP.
Dave Love <fx@gnu.org>
parents:
diff changeset
1872
Dave Love <fx@gnu.org>
parents:
diff changeset
1873 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1874 * Customizing Constants:: How to change values of constants.
Dave Love <fx@gnu.org>
parents:
diff changeset
1875 * Customizing Key Bindings:: How to change key bindings.
Dave Love <fx@gnu.org>
parents:
diff changeset
1876 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
1877
Dave Love <fx@gnu.org>
parents:
diff changeset
1878 @node Customizing Constants, Customizing Key Bindings, Customization, Customization
Dave Love <fx@gnu.org>
parents:
diff changeset
1879 @section Customizing Constants
Dave Love <fx@gnu.org>
parents:
diff changeset
1880 An easy way to customize VIP is to change the values of constants used
Dave Love <fx@gnu.org>
parents:
diff changeset
1881 in VIP. Here is the list of the constants used in VIP and their default
Dave Love <fx@gnu.org>
parents:
diff changeset
1882 values.
Dave Love <fx@gnu.org>
parents:
diff changeset
1883
Dave Love <fx@gnu.org>
parents:
diff changeset
1884 @table @code
Dave Love <fx@gnu.org>
parents:
diff changeset
1885 @item vip-shift-width 8
Dave Love <fx@gnu.org>
parents:
diff changeset
1886 The number of columns shifted by @kbd{>} and @kbd{<} command.
Dave Love <fx@gnu.org>
parents:
diff changeset
1887 @item vip-re-replace nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1888 If @code{t} then do regexp replace, if @code{nil} then do string replace.
Dave Love <fx@gnu.org>
parents:
diff changeset
1889 @item vip-search-wrap-around t
Dave Love <fx@gnu.org>
parents:
diff changeset
1890 If @code{t}, search wraps around the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
1891 @item vip-re-search nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1892 If @code{t} then search is reg-exp search, if @code{nil} then vanilla
Dave Love <fx@gnu.org>
parents:
diff changeset
1893 search.
Dave Love <fx@gnu.org>
parents:
diff changeset
1894 @item vip-case-fold-search nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1895 If @code{t} search ignores cases.
Dave Love <fx@gnu.org>
parents:
diff changeset
1896 @item vip-re-query-replace nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1897 If @code{t} then do reg-exp replace in query replace.
Dave Love <fx@gnu.org>
parents:
diff changeset
1898 @item vip-open-with-indent nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1899 If @code{t} then indent to the previous current line when open a new line
Dave Love <fx@gnu.org>
parents:
diff changeset
1900 by @kbd{o} or @kbd{O} command.
Dave Love <fx@gnu.org>
parents:
diff changeset
1901 @item vip-tags-file-name "TAGS"
Dave Love <fx@gnu.org>
parents:
diff changeset
1902 The name of the file used as the tags table.
Dave Love <fx@gnu.org>
parents:
diff changeset
1903 @item vip-help-in-insert-mode nil
Dave Love <fx@gnu.org>
parents:
diff changeset
1904 If @code{t} then @key{C-h} is bound to @code{help-command} in insert mode,
Dave Love <fx@gnu.org>
parents:
diff changeset
1905 if @code{nil} then it sis bound to @code{delete-backward-char}.
Dave Love <fx@gnu.org>
parents:
diff changeset
1906 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
1907 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
1908 You can reset these constants in VIP by the Ex command @kbd{set}. Or you
Dave Love <fx@gnu.org>
parents:
diff changeset
1909 can include a line like this in your @file{.vip} file:
Dave Love <fx@gnu.org>
parents:
diff changeset
1910 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1911 (setq vip-case-fold-search t)
Dave Love <fx@gnu.org>
parents:
diff changeset
1912 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1913
Dave Love <fx@gnu.org>
parents:
diff changeset
1914 @node Customizing Key Bindings,, Customizing Constants, Customization
Dave Love <fx@gnu.org>
parents:
diff changeset
1915 @section Customizing Key Bindings
Dave Love <fx@gnu.org>
parents:
diff changeset
1916
Dave Love <fx@gnu.org>
parents:
diff changeset
1917 @cindex local keymap
Dave Love <fx@gnu.org>
parents:
diff changeset
1918
Dave Love <fx@gnu.org>
parents:
diff changeset
1919 VIP uses @code{vip-command-mode-map} as the @dfn{local keymap} for vi mode.
Dave Love <fx@gnu.org>
parents:
diff changeset
1920 For example, in vi mode, @key{SPC} is bound to the function
Dave Love <fx@gnu.org>
parents:
diff changeset
1921 @code{vip-scroll}. But, if you wish to make @key{SPC} and some other keys
Dave Love <fx@gnu.org>
parents:
diff changeset
1922 behave like Vi, you can include the following lines in your @file{.vip}
Dave Love <fx@gnu.org>
parents:
diff changeset
1923 file.
Dave Love <fx@gnu.org>
parents:
diff changeset
1924
Dave Love <fx@gnu.org>
parents:
diff changeset
1925 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
1926 (define-key vip-command-mode-map "\C-g" 'vip-info-on-file)
Dave Love <fx@gnu.org>
parents:
diff changeset
1927 (define-key vip-command-mode-map "\C-h" 'vip-backward-char)
Dave Love <fx@gnu.org>
parents:
diff changeset
1928 (define-key vip-command-mode-map "\C-m" 'vip-next-line-at-bol)
Dave Love <fx@gnu.org>
parents:
diff changeset
1929 (define-key vip-command-mode-map " " 'vip-forward-char)
Dave Love <fx@gnu.org>
parents:
diff changeset
1930 (define-key vip-command-mode-map "g" 'vip-keyboard-quit)
Dave Love <fx@gnu.org>
parents:
diff changeset
1931 (define-key vip-command-mode-map "s" 'vip-substitute)
Dave Love <fx@gnu.org>
parents:
diff changeset
1932 (define-key vip-command-mode-map "C" 'vip-change-to-eol)
Dave Love <fx@gnu.org>
parents:
diff changeset
1933 (define-key vip-command-mode-map "R" 'vip-change-to-eol)
Dave Love <fx@gnu.org>
parents:
diff changeset
1934 (define-key vip-command-mode-map "S" 'vip-substitute-line)
Dave Love <fx@gnu.org>
parents:
diff changeset
1935 (define-key vip-command-mode-map "X" 'vip-delete-backward-char)
Dave Love <fx@gnu.org>
parents:
diff changeset
1936 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
1937
Dave Love <fx@gnu.org>
parents:
diff changeset
1938 @unnumbered Key Index
Dave Love <fx@gnu.org>
parents:
diff changeset
1939
Dave Love <fx@gnu.org>
parents:
diff changeset
1940 @printindex ky
Dave Love <fx@gnu.org>
parents:
diff changeset
1941
Dave Love <fx@gnu.org>
parents:
diff changeset
1942 @unnumbered Concept Index
Dave Love <fx@gnu.org>
parents:
diff changeset
1943 @printindex cp
Dave Love <fx@gnu.org>
parents:
diff changeset
1944
29713
983e65f12610 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents: 25829
diff changeset
1945 @setchapternewpage odd
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1946 @contents
Dave Love <fx@gnu.org>
parents:
diff changeset
1947 @bye
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1948
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1949 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1950 arch-tag: 7c5d17b9-1d21-4261-a88a-b9fdbbf1020b
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1951 @end ignore