Ⅰ. 插件描述
Easily add line-endings for a given filetype.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'oinksoft/endline'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'oinksoft/endline'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'oinksoft/endline'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/oinksoft/endline.vim
Ⅳ. 文档说明
This plugin maps (by default) <S-CR> to add a filetype's provided "line ending"
to the end of the current line if it is not already present. For instance, a ';'
would be added to the end of a line of JavaScript source.
This is similar to a feature provided by TextMate, mapped to
Command-Option-Return in that application.
Usage:
Somewhere in your .vimrc (or equivalent), provide a global dict mapping filetype
names to line endings, like so:
let g:Endlines = {
'erlang': '.',
'java': ';',
'javascript': ';',
'ocaml': ';;',
'perl': ';',
'php': ';',
'python': ':',
'sml': ';'
}
Mappings can also be a list of patterns that will be tried in order. In the
following example, a " ->" is appended if the line starts with no whitespace
and ends with a ")", and a "," is appended if the line ends with
non-whitespace.
let g:Endlines = {
'erlang': [
['^S.*)$', ' ->'],
['S$', ',']]
}
By default, <S-CR> is mapped in both insert and normal mode. In insert mode, a
new line is added as well.
Global Options:
g:EndlineMapping ('<S-CR>'): The default endline mapping.
g:EndlineInsertMapping (g:EndlineMapping): The insert mode mapping.
g:EndlineNormalMapping (g:EndlineMapping): The normal mode mapping.
g:EndlineInsert (1): 0 to disable the insert mode mapping.
g:EndlineNormal (1): 0 to disable the normal mode mapping.
g:Endlines ({}): See "Usage"