This repository has been archived by the owner. It is now read-only.
Easily create custom headlines, foldtext, toc, etc
Switch branches/tags
Nothing to show
Clone or download
bimlas Moved to GitLab
**This repository is archived, the development moved to GitLab**: https://gitlab.com/bimlas/vim-eightheader
Latest commit 2b70236 Jun 6, 2018
Permalink
Failed to load latest commit information.
doc removed tags file May 26, 2015
plugin
.gitignore removed tags file May 26, 2015
readme.adoc Moved to GitLab Jun 6, 2018

readme.adoc

This repository is archived, the development moved to GitLab: https://gitlab.com/bimlas/vim-eightheader

EightHeader

Easily create custom headlines, foldtext, toc, etc.

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

... and false (0):

call EightHeader( 78, 'center', 0, ['l ', 'decor', ' r'], ' m', '' )

                            TEXT IN THE LINE                            m
l decordecordecordecordecordecordecordecordecordecordecordecordecordec r

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, '.*;\\@=')" )

Install

Manually:

Download and unzip the subdirectories into '~/.vim'.

Don’t forget to regenerate helptags:

:helptags ~/.vim/doc

... into '~/.vim/bundle' (or to your specific pathogen directory).

Don’t forget to regenerate helptags:

:Helptags

Add these lines to your '.vimrc' after call vundle#rc():

Plugin 'bimbalaszlo/vim-eightheader'

Open vim again, then call :PluginInstall