This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
#include <string> | |
#include <unordered_set> | |
#include <vector> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! NeatFoldText() | |
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("%10s", lines_count . ' lines') . ' |' | |
let foldchar = matchstr(&fillchars, 'fold:\zs.') | |
let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) | |
let foldtextend = lines_count_text . repeat(foldchar, 8) | |
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn | |
return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend | |
endfunction |