Ⅰ. 插件描述
Readline bindings for Insert ModeⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jonhiggs/vim-readline'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jonhiggs/vim-readline'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jonhiggs/vim-readline'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jonhiggs/vim-readline
Ⅳ. 文档说明
# Vim & Readline
Why am I always exiting from insert mode? Because I don't know the insert modes special keys.
Why are those special keys so different from Readline? I don't know.
Some might say that I should be using Emacs, or Spacemacs or something. But, nah. I like Vim.
Installation
Install with your favourite plugin manager (I use Vundle).
Usage
On start-up, the default key bindings will be loaded. I will endeavour to keep these defaults sane and avoid clashing with Vim's native key bindings.
You may of course extend or modify the defaults within your own personal configuration. Perhaps you'll append it to ~/.vimrc or ~/.vim/plugins/vim-readline.vim. How you go about it is up to you.
A complete list of functionality can be seen within ./plugin/default_maps.vim.
Development
The functions are spread across the files in ./plugins with each file corresponding to a chapter of the Readline manual.
Not all of the functions have been written yet, but the intention is to make Vim functions with 100% identical behaviour as each of the Readline functions. The user may then use the default bindings offered, or customise the bindings to their own liking.
The Vim functions are namespaced as Readline<Readline function to CamelCase> and each of the functions is available as user defined commands.
For example for the Readline function of end-of-line, it can be ran with :ReadlineEndOfLine and bound with imap <C-e> <C-O>:ReadlineEndOfLine<CR>.
Described is a universal pattern for all functionality, regardless of how trivial the problem. The example of end-of-line could have been simply solved with imap <C-e> <C-O>$ but being consistent is beneficial to the user. If they understand one function, they understand them all. There are no exceptions and the burden of complexity is shifted from the user to the developer where it belongs.