EightHeader


Ⅰ. 插件描述

Easily create custom headlines, foldtext, toc, etc.

Ⅱ. 基本信息

创建日期:  2014-04-30
使用用户:  2
Github星:  1
插件作者:  Laszlo Bimba

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

https://github.com/BimbaLaszlo/vim-eightheader

To use EightHeader just move the cursor to the line which you want to modify (hereinafter line), then call it:

EightHeader( {length}, {align}, {oneline}, {decor}, {marker}, {str} )

{length}   Length of the header.
{align}    Alignment of text.
{oneline}  If false, then underline the {line} with {decor}.
{decor}    Decorator text to fill with.
{marker}   Extra content after decotRightEnd.
{str}      Replace the content of {line} with this.

An example with {oneline} set to true (1) (s:str means the original line, see EightHeaderVars for details):

call EightHeader( 78, 'center', 1, ['l ', 'decor', ' r'], ' m', '=" ".s:str." "' )

l decordecordecordecordeco TEXT IN THE LINE cordecordecordecordecord r m

If you don't like the default 'foldtext' you can customize it by setting to
EightHeaderFolds().

For example the closed folds looks like this by default:

+-- 45 lines: Fold level one
+--- 67 lines: Fold level two

If you would like to change it to this kind:

Fold level one................45 lines
  Fold level two..............67 lines

... then you can use this function:

let &foldtext = "EightHeaderFolds( '\=s:fullwidth-2', 'left', [ repeat( '  ', v:foldlevel - 1 ), '.', '' ], '\= s:foldlines . " lines"', '' )"

An alternative usage for example formating a vimhelp table of contents:

Options;options
Default mappings;maps
  Launch nuclear strike;apocalypse

... to this:

Options........................................................|options|
Default mappings..................................................|maps|
  Launch nuclear strike.....................................|apocalypse|

Visually select the lines, than:

call EightHeader( 78, "left", 1, ".", "\='|'.matchstr(s:str, ';\@<=.').'|'", "\=matchstr(s:str, '.;\@=')" )

添加新评论