For the vi user:
%” functionality, see ParenthesisMatching.
.” (redo) command, see DotMode and RepeatingCommandsLikeVi.
*” or “#”, see SearchAtPoint or vimpulse.el.
yyp”, see WholeLineOrRegion.
cfz” and “
dfz”, use the zap-to-char command (
ctz” and “
dtz”, use ZapUpToChar.
cw”, use the strategies to ChangeWord in Emacs.
ci” and “
co”, see https://github.com/rlister/mark-forward-sexp.
C-oworked more like “
o” and also want “
O” back in your life, look at OpenNextLine.
Ctrl-P(possibly repeatedly) in Vim to autocomplete the current word based on what else is in the file, see DynamicAbbreviations.
:g/pattern/command”, see KeyboardMacros or KeyboardMacrosTricks.
%s/pattern/replacement”, see ReplaceRegexp or SearchAndReplace.
z.” or “
z-”, see RecenterLikeVi.
‘M-x kill-emacs’. See also ViQuit
See also ViEmacsTable.
ViAndEmacs have different philosophies when it comes to keystrokes. Emacs has long keystrokes for editing involving special modifier keys, such as Meta and Control (see EscapeMetaAltControlShift :)). This is analogous to a Very Long Instruction Word (VLIW) architecture.
vi’s philosophy is modal editing, i.e., an editing mode and an insertion mode. Commands (typically between one and two characters) can be issued in editing mode, including the command to enter insert mode. Commands do things like “delete a word”, “change to the end of the line” or “insert text at the end of this line”. The Escape key exits insertion mode and returns to editing (command) mode.
Emacs does not have “modal editing”, but some non-editing modes do have command keys that don’t require modifiers that most vi users would appreciate – BufferMenu, DiredMode, Email modes, VersionControl, ViewMode, InfoMode, EdiffMode, IncrementalSearchAndReplace, DebuggerMode, SourceLevelDebugger, FinderMode, CalendarMode, InteractiveSpell, Calc.
Many people, like AaronL, find vi keybindings efficient.
Furthermore, vi’s keys are ergonomic (see RepeatedStrainInjury) as they largely adhere to the touch typing principle of staying as close to the home row as possible. (The key exception is Escape, which many vi users remap to Caps Lock just like Emacs users like MovingTheCtrlKey.)
If you are sufficiently open-minded to appreciate the eloquence and economy of at least some of the vi key bindings at least some of the time, there are a variety of Emacs packages that emulate vi keybindings.
The most notable emulation of vi is ViperMode. It does an excellent job of emulating vi and ex commands.
Vimpulse extends ViperMode with Vim features like text objects and visual selection.
If you want basic vi emulation, you might find that vip provides a nice togglable vi emulation without the complexity of Viper. Try
(load "vip") in your InitFile and toggle it with
‘C-z’. (Last time I checked, vip was not bundled with XEmacs.)
What is the complexity of Viper that you avoid when you use vip instead of Viper? In my
~/.emacs I have
(setq viper-mode t) (require 'viper)
(setq viper-inhibit-startup-message 't) (setq viper-expert-level '5)
That is all and with this you have the full power of Viper.
Vile is another alternative. Rather than being a package for Emacs, it is an editor which is “vi-like Emacs”. Use of it is cautioned, as it could cause you to stray from TheTruePath.
mlessvim.el (modeless Vim) tries to add many of the text editing functions of vi, but without using modal insertion and without overriding the default Emacs bindings. Instead a prefix key is used before Vim-like key sequences.
modal-mode is an effort to provide modal editing to Emacs, but remain light, and not step too far into the territory of vi emulation. Its default bindings are based on vi, but its design accommodates the creation of other modality styles. It has explicit support for vi-like text-objects through transient modes that turn movement keys into selection keys, in order to provide compound commands like those of vi’s
vim-mode is an early implementation of new Vim-like mode.
There is also the PoorMansViMode. :)
If you want to go the other way, ViMacs emulates Emacs inside Vim.