Emacs can edit several files at once. A file in Emacs is placed in a buffer that usually has the same name as the file. Buffers are also used for other purposes, such as shell interfaces, directory editing, etc. See Directory Editor in The GNU Emacs Manual, for an example.
A buffer has a distinguished position called the point. A point is always between 2 characters, and is looking at the right hand character. The cursor is positioned on the right hand character. Thus, when the point is looking at the end-of-line, the cursor is on the end-of-line character, i.e., beyond the last character on the line. This is the default Emacs behavior.
The default settings of Viper try to mimic the behavior of Vi, preventing the cursor from going beyond the last character on the line. By using Emacs commands directly (such as those bound to arrow keys), it is possible to get the cursor beyond the end-of-line. However, this won’t (or shouldn’t) happen if you restrict yourself to standard Vi keys, unless you modify the default editing style. See Customization.
In addition to the point, there is another distinguished buffer position called the mark. See Mark in The GNU Emacs manual, for more info on the mark. The text between the point and the mark is called the region of the buffer. For the Viper user, this simply means that in addition to the Vi textmarkers a–z, there is another marker called mark. This is similar to the unnamed Vi marker used by the jump commands `` and '', which move the cursor to the position of the last absolute jump. Viper provides access to the region in most text manipulation commands as r and R suffix to commands that operate on text regions, e.g., dr to delete region, etc.
Furthermore, Viper lets Ex-style commands to work on the current region. This is done by typing a digit argument before :. For instance, typing 1: will prompt you with something like :123,135, assuming that the current region starts at line 123 and ends at line 135. There is no need to type the line numbers, since Viper inserts them automatically in front of the Ex command.
See Basics, for more info.
Emacs divides the screen into tiled windows. You can see the contents of a buffer through the window associated with the buffer. The cursor of the screen is positioned on the character after point. Every window has a mode line that displays information about the buffer. You can change the format of the mode line, but normally if you see ‘**’ at the beginning of a mode line it means that the buffer is modified. If you write out the contents of a buffer to a file, then the buffer will become not modified. Also if you see ‘%%’ at the beginning of the mode line, it means that the file associated with the buffer is write protected. The mode line will also show the buffer name and current major and minor modes (see below). A special buffer called Minibuffer is displayed as the last line in a minibuffer window. The minibuffer window is used for command input output. Viper uses minibuffer window for / and : commands.
An Emacs buffer can have a major mode that customizes Emacs for editing text of a particular sort by changing the functionality of the keys. Keys are defined using a keymap that records the bindings between keystrokes and functions. The global keymap is common to all the buffers. Additionally, each buffer has its local keymap that determines the mode of the buffer. If 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 will be executed. See Major Modes in The GNU Emacs Manual, for more information.
A buffer can also have a minor mode. Minor modes are options that
you can use or not. A buffer in
text-mode can have
auto-fill-mode as minor mode, which can be turned off or on at
any time. In Emacs, a minor mode may have it own keymap,
which overrides the local keymap when the minor mode is turned on. For
more information, see Minor Modes in The
GNU Emacs Manual.
Viper is implemented as a collection of minor modes. Different minor modes are involved when Viper emulates Vi command mode, Vi insert mode, etc. You can also turn Viper on and off at any time while in Vi command mode. See States in Viper, for more information.
Emacs uses Control and Meta modifiers. These are denoted as C and M, e.g., ^Z as C-z and Meta-x as M-x. The Meta key is usually located on each side of the Space bar; it is used in a manner similar to the Control key, e.g., M-x means typing x while holding the Meta key down. For keyboards that do not have a Meta key, ESC is used as Meta. Thus M-x is typed as ESC x. Viper uses ESC to switch from Insert state to Vi state. Therefore Viper defines C-\ as its Meta key in Vi state. See Vi State, for more info.
Emacs is structured as a Lisp interpreter around a C core. Emacs keys cause Lisp functions to be called. It is possible to call these functions directly, by typing M-x function-name.