sponsor Vim development Vim logo Vim Book Ad

emacscommandline : makes command-line mode behave more like the Unix command line

 script karma  Rating 21/8, Downloaded by 645    Comments, bugs, improvements  Vim wiki

created by
Houtsnip -
script type
This plugin makes the command-line mode behave more like the Unix command
line, by adding Emacs-style mappings (like in the Bash shell).  Some of the
mappings just map existing vim commands, but the rest implement functionality
that is not available natively.

Repository: https://github.com/houtsnip/vim-emacscommandline


CTRL-A         move cursor to beginning of line
CTRL-E         move cursor to end of line (i.e the native vim behaviour:
                 see c_CTRL-E).  Not actually a re-mapping, but noted here
                 anyway for completeness.
CTRL-B         move cursor one character backwards
CTRL-F         move cursor one character forwards (overwrites c_CTRL-F)
META-B         move cursor one word backwards
META-F         move cursor one word forwards


CTRL-D         delete character under cursor
CTRL-K         kill line (delete from character under cursor to end of line)
                 (overwrites insert digraph: see c_CTRL-K.  This is a shame,
                 but personally I don't use this much in command-line mode.)
CTRL-U         backwards kill line (delete backwards to beginning of line)
                 (i.e. the same behaviour as in Bash: unix-line-discard)
META-D         delete word under cursor
META-Backspace delete word backwards
CTRL-W         delete backwards to previous white-space character
                 (i.e. the same behaviour as in Bash: unix-word-rubout)


CTRL-P         previous line in history (same as <Up>)
CTRL-N         next line in history (same as <Down>)
META-R         search history backwards
                 (It would be nice to use the mapping CTRL-R, but this is
                 already used for insert register: see c_CTRL-R.)


CTRL-Y         paste (yank) last deleted text (overwrites c_CTRL-Y).
                 Note that in Emacs, 'yank' means 'paste', whereas in vim it
                 means 'copy'.  The same text is also available in the
                 registry 'c'.
CTRL-_         undo last change (overwrites c_CTRL-_)
CTRL-X_CTRL-U   "    "    "
CTRL-Z         toggle command-line as external command (overwrites suspend
                 vim in the terminal)


The old functions are all mapped to the same combination prefixed by CTRL-O.
So for example, to open the command-line window (see c_CTRL-F), press
instead CTRL-O_CTRL-F.


This plugin buggers up the expression register (i.e. c_CTRL-R_=).  This is
a limitation of vim.  I don't know how to switch these mappings off in the
expression register and I don't think it's possible. However I never use the
expression register except in mappings, so it doesn't affect me.

install details

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
emacscommandline.zip 1.3 2017-11-16 7.0 Houtsnip - Added mappings for following
go to first / last line in history (Meta-< and Meta->)
transpose character under cursor with previous character (Ctrl-T)
emacscommandline.zip 1.2 2017-11-08 7.0 Houtsnip - New features:
added many options to allow customization of plug-in
made Ctrl-E, Ctrl-F, Ctrl-K, and Meta-D mappings use native vim functionality when cursor is at end of line
changed search command line mapping (Meta-R) now use Ctrl-R, and made it use the native functionality except when the command line is empty
added Ctrl-G mapping (abort command line)
emacscommandline.tar.gz 1.1 2011-06-06 7.0 Houtsnip - Fixed <Backspace> and <Del> for multi-byte characters
emacscommandline.tar.gz 1.0 2011-04-18 7.0 Houtsnip - Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo