Ⅰ. 插件描述
Python Syntax Folding for class/def statements onlyⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/pyfold'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/pyfold'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/pyfold'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/pyfold
Ⅳ. 文档说明
This script acts as a syntax-file addon to the standard python.vim syntax file. When expression folding is used, all classes and functions will be folded automatically.
Each fold ends upon one of two conditions:
1) A line is detected with an indent less than or equal to the previous fold beginning line (that is not in a multi-line string).
2) A line with the same indent as a class or def statement is detected that contains the string "#s*ends+<(class|def)>". (i.e. " #end class MyClass").
Note that script vimscript #515 provides a similar functionality, but includes marker folding and limited block statement folding. This script was written to provide class and function folding only, allow "#end (class|def)" lines to end a fold and still be included in the fold, and to increase the speed creating folds in large files.