Ⅰ. 插件描述
Generate template Scala commentsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'megaannum/scalacommenter-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'megaannum/scalacommenter-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'megaannum/scalacommenter-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/megaannum/scala_commenter
Ⅳ. 文档说明
# scala_commenter
Generate template Scala comments
Introduction
Manage ScalaDoc comments for classes, traits, objects, methods,
vals and vars:
Generate comment templates and
Format existing comment '@' tag lines
The comment generation code here inspired by Kalle Bjorklid's
JCommenter
Some of the basic utility functions, some recognition patterns
and many of the configuration parameters can be found in JCommenter.
While JCommenter is written in a imperative style, ScalaCommenter
has components that are Object Prototype based building on
the Self.vim script which can be found at
Location
The parameter algorithm has been re-worked, a template parameter
algorithm has been added for Scala; as well as recognizing class
constructors, values and variables.
The formatting part of this script is also new.
Functions for automatically generating ScalaDoc compatible comments.
The scala#commenter#Writer() can produce a number of kinds of comments
depending on the current line/range.
Supported tags in the order they should appear in a comment are:
* @author (top-level classes, traits and objects only, required)
listed in chronological order
* @version (top-level classes, traits and objects only, required)
* @param (methods, classes and inner classes only)
listed in argument-declaration order
* @tparam (methods, all classes and all traits only)
listed in template argument-declaration order
* @return (methods only)
* @throws (methods and all classes)
listed in aplhabetical order
* @see
* @since
* @serial
* @serialField
* @serialData
* @deprecated
For more information (which may or may not apply to Scala) see
Sun Writing Doc Comments
Installation
The Commenter autoload 'commenter.vim' code file should be in
the 'autoload/scala' directory, the 'commenter.txt' in the 'doc/scala'
directory and the plugin 'commenter.vim' code in the 'plugin/scala' directory.
Dependency
The Scala Commenter depends upon the Vim Self library:
Vim
GitHub
Usage
Place cursor on line with object, class, var, val or def is declared and
invoke: scala#commenter#Writer().
To re-format an existing scala comment, place cursor within the bounds
of the comment and invoke: scala#commenter#Formatter()
These commands are defined as key mappings in the
plugin/scala/commenter.vim file:
autocmd FileType scala map cm :call scala#commenter#Writer()<CR>
autocmd FileType scala map cf :call scala#commenter#Formatter()<CR>
Vim
Acknowledgements and thanks
- Andy Wokula: provided feedback on help file syntax.