Ⅰ. 插件描述
yapf formatter in nvim, it's use the async feature of neovim!Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'drinksober/nvim-yapf-formater'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'drinksober/nvim-yapf-formater'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'drinksober/nvim-yapf-formater'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/drinksober/nvim-yapf-formater
Ⅳ. 文档说明
# nvim-yapf-formater
yapf formatter in nvim, it's use the async feature of neovim!
Feathers
- async, when excute the format command, you can move the cursor free!
- auto find the current tag, and then format it, it was so quickly!
- diff the saved text with the buffer, if didn't has diff, ignored!
- it use the python client with neovim.
Install
with the vim-plug
Plug 'drinksober/nvim-yapf-formater'
Normal mode
In normal mode, it will find the range of current tag(function or class) in current line, if fail, if will format the whole buffer
Visual mode
In visual mode, it will formater the whole buffer
Example config
noremap <leader>y :YapfFormat<CR>
vnoremap <leader>y :YapfFormat 'full'<CR>
use the autocmd with format the scope of the tag
autocmd InsertLeave * YapfFormater