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