Ⅰ. 插件描述
Emacs-style mappings for command-line mode in vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'houtsnip/emacscommandline'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'houtsnip/emacscommandline'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'houtsnip/emacscommandline'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/houtsnip/vim-emacscommandline
Ⅳ. 文档说明
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
MOVEMENT
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
DELETION
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)
HISTORY
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.)
OTHER
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)
OLD KEYS
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.
WARNING
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.