java_fold


Ⅰ. 插件描述

Folding expression for Java

Ⅱ. 基本信息

创建日期:  2005-06-21
使用用户:  2
Github星:  1
插件作者:  Jorrit Wiersma

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/java-fold'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/java-fold'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/java-fold'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/java_fold

Ⅳ. 文档说明

This script uses the expr fold-method to create folds for java source code.  Folds are created for methods, variables and nested classes with a javadoc comment (that is, at any line inside a class that starts with /**).  The fold will show a count of the number of lines contained in it and the first line of the variable or method declaration.

The fold level for each fold is equal to the indentation divided by the value of the 'shiftwidth' option, so make sure that 'shiftwidth' is set to the right value for your code.

Caveats:

  • this doesn't work if you don't indent your code (properly) or if you don't use javadoc comments
  • the folds are "greedy": they start at a javadoc comment and run upto the next javadoc comment (they don't pay attention to syntax)
  • you can't see the javadoc comments in the folds

添加新评论