Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bimlas/vim-eightheader
Vim plugin: Easily create custom headlines, foldtext, toc, etc
https://github.com/bimlas/vim-eightheader
folding foldtext headline neovim table-of-contents title vim vim-plugin
Last synced: about 13 hours ago
JSON representation
Vim plugin: Easily create custom headlines, foldtext, toc, etc
- Host: GitHub
- URL: https://github.com/bimlas/vim-eightheader
- Owner: bimlas
- Created: 2014-05-15T18:20:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-04T18:32:38.000Z (10 months ago)
- Last Synced: 2024-02-04T21:18:34.932Z (10 months ago)
- Topics: folding, foldtext, headline, neovim, table-of-contents, title, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 20.5 KB
- Stars: 19
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= EightHeader
Easily create custom headlines, foldtext, toc, etc.
* https://github.com/bimlas/vim-eightheader (please star if you like it)
* http://www.vim.org/scripts/script.php?script_id=4930 (please rate if you using it)To use EightHeader just move the cursor to the line which you want to modify (hereinafter `line`), then call it:
[source]
----
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):[source]
----
call EightHeader( 78, 'center', 1, ['l ', 'decor', ' r'], ' m', '\=" ".s:str." "' )l decordecordecordecordeco TEXT IN THE LINE cordecordecordecordecord r m
----\... and false (0):
[source]
----
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:
[source]
----
+-- 45 lines: Fold level one
+--- 67 lines: Fold level two
----If you would like to change it to this kind:
[source]
----
Fold level one................45 lines
Fold level two..............67 lines
----\... then you can use this function:
[source]
----
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:
[source]
----
Options;options
Default mappings;maps
Launch nuclear strike;apocalypse
----\... to this:
[source]
----
Options........................................................|options|
Default mappings..................................................|maps|
Launch nuclear strike.....................................|apocalypse|
----Visually select the lines, than:
[source]
----
call EightHeader( 78, "left", 1, ".", "\\='|'.matchstr(s:str, ';\\@<=.*').'|'", "\\=matchstr(s:str, '.*;\\@=')" )
----== Install
*Manually:*
https://github.com/bimlas/vim-eightheader/archive/master.zip[Download]
and unzip the subdirectories into '~/.vim'.Don't forget to regenerate helptags:
[source]
----
:helptags ~/.vim/doc
----*https://github.com/tpope/vim-pathogen[Pathogen]:*
\... into '~/.vim/bundle' (or to your specific pathogen directory).
Don't forget to regenerate helptags:
[source]
----
:Helptags
----*https://github.com/gmarik/Vundle.vim[Vundle]:*
Add these lines to your '.vimrc' after `call vundle#rc()`:
[source]
----
Plugin 'bimlas/vim-eightheader'
----Open vim again, then call `:PluginInstall`