Skip to content

Instantly share code, notes, and snippets.

View cyansprite's full-sized avatar

Brand cyansprite

View GitHub Profile
@cyansprite
cyansprite / SexyFold.vim
Last active December 13, 2017 08:29
Nice fold text for vim.
"Result:
"........................................ Text Here ( x lines ) .........................................
function! SuperSexyFoldText() "{{{
let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' '
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = printf("%s", lines_count)
let foldchar = " "
let foldtextstart = strpart('' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
let foldtextend = ' ( ' . repeat(" ", 5 - len(lines_count_text)) . lines_count_text . repeat(" ", 2) . "lines" . ' ) '
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
@cyansprite
cyansprite / init-piece.vim
Last active September 8, 2017 17:17
Vim synmaxcol + textwidth = nice faster syntax and textwidth concerns
" Warning this will alter the highlighting of the columns
" beforehand sometimes as well.
set textwidth=80 " text width
exe 'set synmaxcol=' . &tw | " If it goes past tw, don't highlight it