@setfilename ../../info/vip
@settitle VIP
+@documentencoding UTF-8
+
@copying
-Copyright @copyright{} 1987, 2001-2011 Free Software Foundation, Inc.
+Copyright @copyright{} 1987, 2001--2014 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
is included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual. Buying copies from the FSF supports it in
-developing GNU and promoting software freedom.''
+modify this GNU manual.''
@end quotation
@end copying
@end direntry
@ifnottex
-@node Top, Survey,, (DIR)
+@node Top
@top VIP
VIP is a Vi emulating package written in Emacs Lisp. VIP implements most
VIP.
It is recommended that you read nodes on survey and on customization before
-you start using VIP. Other nodes may be visited as needed.
+you start using VIP@. Other nodes may be visited as needed.
Comments and bug reports are welcome. Please send messages to
@code{ms@@Sail.Stanford.Edu} if you are outside of Japan and to
-@code{masahiko@@sato.riec.tohoku.junet} if you are in Japan.@refill
+@code{masahiko@@sato.riec.tohoku.junet} if you are in Japan.
-@insertcopying
+@insertcopying
@end ifnottex
VIP.
It is recommended that you read chapters on survey and on customization
-before you start using VIP. Other chapters may be used as future
+before you start using VIP@. Other chapters may be used as future
references.
Comments and bug reports are welcome. Please send messages to
@code{masahiko@@unsun.riec.tohoku.junet} if you are in Japan.
@end iftex
-@node Survey, Basic Concepts, Top, Top
+@node Survey
@chapter A Survey of VIP
In this chapter we describe basics of VIP with emphasis on the features not
* Differences from Vi:: Differences of VIP from Vi is explained.
@end menu
-@node Basic Concepts, Loading VIP, Survey, Survey
+@node Basic Concepts
@section Basic Concepts
We begin by explaining some basic concepts of Emacs. These concepts are
@key{PNT} and @key{MRK} are used
to indicate positions in a buffer and they are not part of the text of the
buffer. If a buffer contains a @key{MRK} then the text between @key{MRK}
-and @key{PNT} is called the @dfn{region} of the buffer.@refill
+and @key{PNT} is called the @dfn{region} of the buffer.
@cindex window
Emacs provides (multiple) @dfn{windows} on the screen, and you can see the
content of a buffer through the window associated with the buffer. The
cursor of the screen is always positioned on the character after @key{PNT}.
-@refill
@cindex mode
@cindex keymap
a function is bound to some key in the local keymap then that function will
be executed when you type the key. If no function is bound to a key in the
local map, however, the function bound to the key in the global map becomes
-in effect.@refill
+in effect.
-@node Loading VIP, Modes in VIP, Basic Concepts, Survey
+@node Loading VIP
@section Loading VIP
The recommended way to load VIP automatically is to include the line:
to be in vi mode whenever Emacs starts up, you can include the following
line in your @file{.emacs} file instead of the above line:
@example
-(setq term-setup-hook 'vip-mode)
+(add-hook 'emacs-startup-hook 'vip-mode)
@end example
@noindent
(@xref{Vi Mode}, for the explanation of vi mode.)
@end example
@noindent
-@node Modes in VIP, Emacs Mode, Loading VIP, Survey
+@node Modes in VIP
@section Modes in VIP
@kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi})
to the function @code{vip-change-mode-to-vi}. The default binding of @kbd{C-z}
in GNU Emacs is @code{suspend-emacs}, but, you can also call
@code{suspend-emacs} by typing @kbd{C-x C-z}. Other than this, all the
-key bindings of Emacs remain the same after loading VIP.@refill
+key bindings of Emacs remain the same after loading VIP.
@cindex vi mode
invoked by @kbd{M-x}. Here @kbd{M-x} means @kbd{Meta-x}, and if your
terminal does not have a @key{META} key you can enter it by typing
@kbd{@key{ESC} x}. The same effect can also be achieve by typing
-@kbd{M-x vip-mode}.)@refill
+@kbd{M-x vip-mode}.)
@cindex mode line
You can observe the change of mode by looking at the @dfn{mode line}. For
-instance, if the mode line is:@refill
+instance, if the mode line is:
@example
-----Emacs: *scratch* (Lisp Interaction)----All------------
@end example
@cindex emacs mode
You can go back to the original @dfn{emacs mode} by typing @kbd{C-z} in
-vi mode. Thus @kbd{C-z} toggles between these two modes.@refill
+vi mode. Thus @kbd{C-z} toggles between these two modes.
Note that modes in VIP exist orthogonally to modes in Emacs. This means
that you can be in vi mode and at the same time, say, shell mode.
know enough Emacs commands.
@end menu
-@node Emacs Mode, Vi Mode, Modes in VIP, Modes in VIP
+@node Emacs Mode
@subsection Emacs Mode
@kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi})
-You will be in this mode just after you loaded VIP. You can do all
+You will be in this mode just after you loaded VIP@. You can do all
normal Emacs editing in this mode. Note that the key @kbd{C-z} is globally
bound to @code{vip-change-mode-to-vi}. So, if you type @kbd{C-z} in this mode
-then you will be in vi mode.@refill
+then you will be in vi mode.
-@node Vi Mode, Insert Mode, Emacs Mode, Modes in VIP
+@node Vi Mode
@subsection Vi Mode
This mode corresponds to Vi's command mode. Most Vi commands work as they
do in Vi. You can go back to emacs mode by typing @kbd{C-z}. You can
enter insert mode, just as in Vi, by typing @kbd{i}, @kbd{a} etc.
-@node Insert Mode, Differences from Vi, Vi Mode, Modes in VIP
+@node Insert Mode
@subsection Insert Mode
The key bindings in this mode is the same as in the emacs mode except for
@kbd{ESC x} in emacs mode.
@end table
-@node Differences from Vi, Undoing, Insert Mode, Survey
+@node Differences from Vi
@section Differences from Vi
The major differences from Vi are explained below.
* Misc Commands:: Other useful commands.
@end menu
-@node Undoing, Changing, Differences from Vi, Differences from Vi
+@node Undoing
@subsection Undoing
@kindex 165 @kbd{u} (@code{vip-undo})
You can repeat undoing by the @kbd{.} key. So, @kbd{u} will undo
a single change, while @kbd{u .@: .@: .@:}, for instance, will undo 4 previous
changes. Undo is undoable as in Vi. So the content of the buffer will
-be the same before and after @kbd{u u}.@refill
+be the same before and after @kbd{u u}.
-@node Changing, Searching, Undoing, Differences from Vi
+@node Changing
@subsection Changing
Some commands which change a small number of characters are executed
@key{ESC} to complete the command. Before you enter @key{RET} or
@key{ESC} you can abort the command by typing @kbd{C-g}. In general,
@kindex 007 @kbd{C-g} (@code{vip-keyboard-quit})
-you can abort a partially formed command by typing @kbd{C-g}.@refill
+you can abort a partially formed command by typing @kbd{C-g}.
-@node Searching, z Command, Changing, Differences from Vi
+@node Searching
@subsection Searching
@kindex 057 @kbd{/} (@code{vip-search-forward})
As in Vi, searching is done by @kbd{/} and @kbd{?}. The string will be
searched literally by default. To invoke a regular expression search,
first execute the search command @kbd{/} (or @kbd{?}) with empty search
-string. (I.e, type @kbd{/} followed by @key{RET}.)
+string. (I.e., type @kbd{/} followed by @key{RET}.)
A search for empty string will toggle the search mode between vanilla
search and regular expression search. You cannot give an offset to the
search string. (It is a limitation.) By default, search will wrap around
the buffer as in Vi. You can change this by rebinding the variable
-@code{vip-search-wrap-around}. @xref{Customization}, for how to do this.@refill
+@code{vip-search-wrap-around}. @xref{Customization}, for how to do this.
-@node z Command, Counts, Searching, Differences from Vi
+@node z Command
@subsection z Command
@kindex 1723 @kbd{z H} (@code{vip-line-to-top})
For those of you who cannot remember which of @kbd{z} followed by @key{RET},
@kbd{.}@: and @kbd{-} do what. You can also use @kbd{z} followed by @kbd{H},
@kbd{M} and @kbd{L} to place the current line in the Home (Middle, and
-Last) line of the window.@refill
+Last) line of the window.
-@node Counts, Marking, z Command, Differences from Vi
+@node Counts
@subsection Counts
Some Vi commands which do not accept a count now accept one
Given a count @var{n}, @var{n}-th occurrence will be searched.
@end table
-@node Marking, Region Commands, Counts, Differences from Vi
+@node Marking
@subsection Marking
Typing an @kbd{m} followed by a lower-case character @var{ch} marks the
Jump to mark (and pop mark off the mark ring).
@end table
-@node Region Commands, New Commands, Marking, Differences from Vi
+@node Region Commands
@subsection Region Commands
@cindex region
Thus @kbd{d r} will delete the current region. If @kbd{R} is used instead
of @kbd{r} the region will first be enlarged so that it will become the
smallest region containing the original region and consisting of whole
-lines. Thus @kbd{m .@: d R} will have the same effect as @kbd{d d}.@refill
+lines. Thus @kbd{m .@: d R} will have the same effect as @kbd{d d}.
-@node New Commands, New Bindings, Region Commands, Differences from Vi
+@node New Commands
@subsection Some New Commands
Note that the keys below (except for @kbd{R}) are not used in Vi.
will be in vi mode again. You can give a count before typing @kbd{\}.
Thus @kbd{5 \ *}, as well as @kbd{\ C-u 5 *}, will insert @samp{*****}
before point. Similarly @kbd{1 0 \ C-p} will move the point 10 lines above
-the current line.@refill
+the current line.
@item K
@kindex 113 @kbd{K} (@code{vip-kill-buffer})
Kill current buffer if it is not modified. Useful when you selected a
If followed by a certain character @var{ch}, it becomes an operator whose
argument is the region determined by the motion command that follows.
Currently, @var{ch} can be one of @kbd{c}, @kbd{C}, @kbd{g}, @kbd{q} and
-@kbd{s}.@refill
+@kbd{s}.
@item # c
@kindex 0432 @kbd{# c} (@code{downcase-region})
Change upper-case characters in the region to lower case
@item # g
@kindex 0432 @kbd{# g} (@code{vip-global-execute})
Execute last keyboard macro for each line in the region
-(@code{vip-global-execute}).@refill
+(@code{vip-global-execute}).
@item # q
@kindex 0432 @kbd{# q} (@code{vip-quote-region})
Insert specified string at the beginning of each line in the region
Call last keyboard macro.
@end table
-@node New Bindings, Window Commands, New Commands, Differences from Vi
+@node New Bindings
@subsection New Key Bindings
In VIP the meanings of some keys are entirely different from Vi. These key
@kindex 1300 @kbd{X} (@code{vip-ctl-x-equivalent})
These keys will exit from vi mode and return to emacs mode temporarily.
If you type @kbd{C} (@kbd{X}), Emacs will be in emacs mode and will believe
-that you have typed @kbd{C-c} (@kbd{C-x}, resp.) in emacs mode. Moreover,
+that you have typed @kbd{C-c} (@kbd{C-x}) in emacs mode. Moreover,
if the following character you type is an upper-case letter, then Emacs
will believe that you have typed the corresponding control character.
You will be in vi mode again after the command is executed. For example,
the idea here is that you can execute useful Emacs commands without typing
control characters. For example, if you hit @kbd{X} (or @kbd{C-x}) followed
by @kbd{2}, then the current window will be split into 2 and you will be in
-vi mode again.@refill
+vi mode again.
@end table
In addition to these, @code{ctl-x-map} is slightly modified:
This is equivalent to @kbd{C-x 1 C-x 2} (1 + 2 = 3).
@end table
-@node Window Commands, Buffer Commands, New Bindings, Differences from Vi
+@node Window Commands
@subsection Window Commands
In this and following subsections, we give a summary of key bindings for
Show current buffer in two windows.
@end table
-@node Buffer Commands, File Commands, Window Commands, Differences from Vi
+@node Buffer Commands
@subsection Buffer Commands
@table @kbd
Save the current buffer in the file associated to the buffer.
@end table
-@node File Commands, Misc Commands, Buffer Commands, Differences from Vi
+@node File Commands
@subsection File Commands
@table @kbd
Insert specified file at point.
@end table
-@node Misc Commands, Vi Commands, File Commands, Differences from Vi
+@node Misc Commands
@subsection Miscellaneous Commands
@table @kbd
Suspend Emacs.
@item Z Z
Exit Emacs.
-@itemx Q
+@item Q
Query replace.
-@itemx R
+@item R
Replace.
@end table
-@node Vi Commands, Numeric Arguments, Misc Commands, Top
+@node Vi Commands
@chapter Vi Commands
This chapter describes Vi commands other than Ex commands implemented in
-VIP. Except for the last section which discusses insert mode, all the
+VIP@. Except for the last section which discusses insert mode, all the
commands described in this chapter are to be used in vi mode.
@menu
* Commands in Insert Mode:: Commands for entering insert mode.
@end menu
-@node Numeric Arguments, Important Keys, Vi Commands, Vi Commands
+@node Numeric Arguments
@section Numeric Arguments
@cindex numeric arguments
a prefix to the commands. A numeric argument is also called a @dfn{count}.
In many cases, if a count is given, the command is executed that many times.
For instance, @kbd{5 d d} deletes 5 lines while simple @kbd{d d} deletes a
-line. In this manual the metavariable @var{n} will denote a count.@refill
+line. In this manual the metavariable @var{n} will denote a count.
-@node Important Keys, Buffers and Windows, Numeric Arguments, Vi Commands
+@node Important Keys
@section Important Keys
The keys @kbd{C-g} and @kbd{C-l} are unique in that their associated
In Emacs many commands are bound to the key strokes that start with
@kbd{C-x}, @kbd{C-c} and @key{ESC}. These commands can be
-accessed from vi mode as easily as from emacs mode.@refill
+accessed from vi mode as easily as from emacs mode.
@table @kbd
@item C-x
and you can execute a single Emacs command. After executing the
Emacs command you will be in vi mode again. You can give a count before
typing @kbd{\}. Thus @kbd{5 \ +}, as well as @kbd{\ C-u 5 +}, will insert
-@samp{+++++} before point.@refill
+@samp{+++++} before point.
@end table
-@node Buffers and Windows, Files, Important Keys, Vi Commands
+@node Buffers and Windows
@section Buffers and Windows
@cindex buffer
In Emacs the text you edit is stored in a @dfn{buffer}.
See GNU Emacs Manual, for details. There is always one @dfn{current}
-buffer, also called the @dfn{selected buffer}.@refill
+buffer, also called the @dfn{selected buffer}.
@cindex window
@cindex modified (buffer)
and you can select it by giving a simple @key{RET}. See GNU Emacs Manual
for details of completion.
-@node Files, Viewing the Buffer, Buffers and Windows, Vi Commands
+@node Files
@section Files
We have the following commands related to files. They are used to visit,
@dfn{default directory} which is specific to each buffer. Suppose, for
instance, that the default directory of the current buffer is
@file{/usr/masahiko/lisp/}. Then you will get the following prompt in the
-minibuffer.@refill
+minibuffer.
@example
visit file: /usr/masahiko/lisp/
@end example
You can verify which file you are editing by typing @kbd{g}. (You can also
type @kbd{X B} to get information on other buffers too.) If you type
-@kbd{g} you will get an information like below in the echo area:@refill
+@kbd{g} you will get an information like below in the echo area:
@example
"/usr/masahiko/man/vip.texinfo" line 921 of 1949
@end example
associated with the buffer (@file{/usr/masahiko/man/vip.texinfo}, in this
case), you can just say @kbd{X S}. If you wish to save it in another file,
you can type @kbd{X W}. You will then get a similar prompt as you get for
-@kbd{v}, to which you can enter the file name.@refill
+@kbd{v}, to which you can enter the file name.
-@node Viewing the Buffer, Mark Commands, Files, Vi Commands
+@node Viewing the Buffer
@section Viewing the Buffer
In this and next section we discuss commands for moving around in the
@kindex 002 @kbd{C-b} (@code{vip-scroll-back})
Scroll text of current window downward almost full screen. You can go
@i{backward} in the buffer by this command (@code{vip-scroll-back}).
-@itemx C-d
+@item C-d
@kindex 004 @kbd{C-d} (@code{vip-scroll-up})
Scroll text of current window upward half screen. You can go
@i{down} in the buffer by this command (@code{vip-scroll-down}).
-@itemx C-u
+@item C-u
@kindex 025 @kbd{C-u} (@code{vip-scroll-down})
Scroll text of current window downward half screen. You can go
@i{up} in the buffer by this command (@code{vip-scroll-up}).
Center point in window and redisplay screen (@code{recenter}).
@end table
-@node Mark Commands, Motion Commands, Viewing the Buffer, Vi Commands
+@node Mark Commands
@section Mark Commands
The following commands are used to mark positions in the buffer.
the command `@kbd{m ,}' you can visit older and older marked positions. You
will eventually be in a loop as the mark ring is a ring.
-@node Motion Commands, Searching and Replacing, Mark Commands, Vi Commands
+@node Motion Commands
@section Motion Commands
Commands for moving around in the current buffer are collected here. These
opposite direction (@code{vip-repeat-find-opposite}).
@end table
-@node Searching and Replacing, Modifying Commands, Motion Commands, Vi Commands
+@node Searching and Replacing
@section Searching and Replacing
Following commands are available for searching and replacing.
The commands @kbd{/} and @kbd{?} mark point before move, so that you can
return to the original point by @w{@kbd{` `}}.
-@node Modifying Commands, Delete Commands, Searching and Replacing, Vi Commands
+@node Modifying Commands
@section Modifying Commands
In this section, commands for modifying the content of a buffer are
* Change Commands:: Commands for changing text.
* Repeating and Undoing Modifications::
@end menu
-@node Delete Commands, Yank Commands, Modifying Commands, Modifying Commands
+@node Delete Commands
@subsection Delete Commands
@table @kbd
(@code{vip-delete-backward-char}).
@end table
-@node Yank Commands, Put Back Commands, Delete Commands, Modifying Commands
+@node Yank Commands
@subsection Yank Commands
@cindex yank
Expand current region and yank it.
@end table
-@node Put Back Commands, Change Commands, Yank Commands, Modifying Commands
+@node Put Back Commands
@subsection Put Back Commands
Deleted or yanked texts can be put back into the buffer by the command
below.
specified, @var{n}-th previously deleted/yanked text will be put back. It
is an error to specify a number register for the delete/yank commands.
-@node Change Commands, Repeating and Undoing Modifications, Put Back Commands, Modifying Commands
+@node Change Commands
@subsection Change Commands
Most commonly used change command takes the following form.
wish to change it to @samp{bar}, you can type @kbd{c w}. Then, as @kbd{w}
is a point command, you will get the prompt @samp{foo =>} in the
minibuffer, for which you can type @kbd{b a r @key{RET}} to complete the change
-command.@refill
+command.
@table @kbd
@item c c
Expand current region and change it.
@end table
-@node Repeating and Undoing Modifications, Other Vi Commands, Change Commands, Modifying Commands
+@node Repeating and Undoing Modifications
@subsection Repeating and Undoing Modifications
VIP records the previous modifying command, so that it is easy to repeat
modifying command is used again (@code{vip-repeat}).
@end table
-@node Other Vi Commands, Commands in Insert Mode, Repeating and Undoing Modifications, Vi Commands
+@node Other Vi Commands
@section Other Vi Commands
Miscellaneous Vi commands are collected here.
@kindex 011 TAB (@code{indent-for-tab-command})
Indent line for current major mode (@code{indent-for-tab-command}).
@item C-j
-@kindex 012 @kbd{C-j} (@code{newline-and-indent})
-Insert a newline, then indent according to mode (@code{newline-and-indent}).
+@kindex 012 @kbd{C-j} (@code{electric-newline-and-maybe-indent})
+Insert a newline, and maybe indent according to mode.
@item C-k
@kindex 013 @kbd{C-k} (@code{kill-line})
Kill the rest of the current line; before a newline, kill the newline.
(@code{kill-region}).
@end table
-@node Commands in Insert Mode, Ex Commands, Other Vi Commands, Vi Commands
+@node Commands in Insert Mode
@section Insert Mode
You can enter insert mode by one of the following commands. In addition to
command will not really repeat insertion if you move point by emacs
commands while in insert mode.
-@node Ex Commands, Ex Command Reference, Commands in Insert Mode, Top
+@node Ex Commands
@chapter Ex Commands
@kindex 072 @kbd{:} (@code{vip-ex})
@var{pat} you must preceded it by @samp{\}. VIP strips off these @kbd{\}'s
before @kbd{/} and the resulting @var{pat} becomes the actual search
pattern. Emacs provides a different and richer class or regular
-expressions than Vi/Ex, and VIP uses Emacs' regular expressions. See GNU
+expressions than Vi/Ex, and VIP uses Emacs's regular expressions. See GNU
Emacs Manual for details of regular expressions.
Several Ex commands can be entered in a line by separating them by a pipe
@menu
* Ex Command Reference:: Explain all the Ex commands available in VIP.
@end menu
-@node Ex Command Reference, Customization, Ex Commands, Ex Commands
+@node Ex Command Reference
@section Ex Command Reference
-In this section we briefly explain all the Ex commands supported by VIP.
+In this section we briefly explain all the Ex commands supported by VIP@.
Most Ex commands expect @var{address} as their argument, and they use
default addresses if they are not explicitly given. In the following, such
default addresses will be shown in parentheses.
@kbd{unabbreviate}, @kbd{xit}, @kbd{z}
@end example
-@node Customization, Customizing Constants, Ex Command Reference, Top
+@node Customization
@chapter Customization
-If you have a file called @file{.vip} in your home directory, then it
+If you have a file called @file{~/.emacs.d/vip} (or @file{~/.vip}), then it
will also be loaded when VIP is loaded. This file is thus useful for
customizing VIP.
* Customizing Key Bindings:: How to change key bindings.
@end menu
-@node Customizing Constants, Customizing Key Bindings, Customization, Customization
+@node Customizing Constants
@section Customizing Constants
An easy way to customize VIP is to change the values of constants used
-in VIP. Here is the list of the constants used in VIP and their default
+in VIP@. Here is the list of the constants used in VIP and their default
values.
@table @code
@end table
@noindent
You can reset these constants in VIP by the Ex command @kbd{set}. Or you
-can include a line like this in your @file{.vip} file:
+can include a line like this in your @file{~/.emacs.d/vip} file:
@example
(setq vip-case-fold-search t)
@end example
-@node Customizing Key Bindings,, Customizing Constants, Customization
+@node Customizing Key Bindings
@section Customizing Key Bindings
@cindex local keymap
VIP uses @code{vip-command-mode-map} as the @dfn{local keymap} for vi mode.
For example, in vi mode, @key{SPC} is bound to the function
@code{vip-scroll}. But, if you wish to make @key{SPC} and some other keys
- behave like Vi, you can include the following lines in your @file{.vip}
-file.
+ behave like Vi, you can include the following lines in your
+@file{~/.emacs.d/vip} file.
@example
(define-key vip-command-mode-map "\C-g" 'vip-info-on-file)
(define-key vip-command-mode-map "X" 'vip-delete-backward-char)
@end example
-@node GNU Free Documentation License,,, Top
+@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include doclicense.texi