Ⅰ. 插件描述
Pseudo-command-line (experimental)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'junegunn/vim-pseudocl'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'junegunn/vim-pseudocl'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'junegunn/vim-pseudocl'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/junegunn/vim-pseudocl
Ⅳ. 文档说明
vim-pseudocl: Pseudo-command-line interface
vim-pseudocl implements a command-line interface that mimics the native Vim
command-line. It enables writing advanced command-line features with its
callback functions.
Usage
pseudocl#start function will start the pseudo-command-line. It returns
user-typed string or throws 'exit' on escape key or on interrupt.
try
let got = pseudocl#start(options)
catch 'exit'
call pseudocl#render#clear()
echon 'No input'
endtryThe following table summarizes the dictionary parameter to pseudocl#start
function.
| Option name | Type | Default | Description |
|---|---|---|---|
| prompt | String | ':' | Command-line prompt in string |
| prompt | List | ['None', ':'] | Sequence of highlight group and string pairs |
| highlight | String | None | Highlight group for command-line |
| input | String | '' | Initial input string |
| on_change | Funcref | pseudocl#nop | Callback function invoked on change (new, old, cursor) |
| on_unknown_key | Funcref | pseudocl#nop | Callback function invoked on unknown key (key, str, cursor) |
| renderer | Funcref | pseudocl#render#echo | Command-line renderer (prompt, line, cursor) |
| remap | Dict | {} | Remap keys |
| map | Boolean | 1 | To use command-line maps or not |
| history | List | [] | Command-line history |
| words | List | [] | Words for tab completion |
API
Main
pseudocl#start()
Render
pseudocl#render#echo()pseudocl#render#echo_prompt()pseudocl#render#echo_line()
pseudocl#render#clear()
Complete
pseudocl#complete#extract_words()
License
MIT