From 6a9632cbb7dc3267fd1743da40d2b0ab1c52917c Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Wed, 7 Feb 2018 23:58:15 +0100 Subject: Improved foldtext, removed default textwidth=120 --- after/syntax/c.vim | 7 +++++-- vimrc-full | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/after/syntax/c.vim b/after/syntax/c.vim index ca694a2..0fa1fda 100644 --- a/after/syntax/c.vim +++ b/after/syntax/c.vim @@ -6,11 +6,14 @@ set foldmethod=syntax " syn clear cStructure " highlight! link defines Special syntax match Define "\<[A-Z][A-Z0-9_]*\>" -syntax match Todo "\/\/ @[A-Z]*\:.*$" +" syntax match Todo "\/\/ @[A-Z]*\:.*$" +syntax keyword Todo TODO contained +syntax match Comment "//.*" contains=Todo + " clear default group for a cBlock so we can redefine it without the fold option syn clear cBlock -syn region cBlock start=/{/ end=/}/ transparent +syn region cBlock start=/{/ end=/}/ transparent " multiple single line comments in a row syn match cComment /\v\/\/.*(\_.\/\/.*)+/ fold diff --git a/vimrc-full b/vimrc-full index 494495d..be99a64 100644 --- a/vimrc-full +++ b/vimrc-full @@ -4,7 +4,7 @@ " GENERAL: "======================================================================================================================= set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands -set textwidth=120 | " better done with modeline or local exrc +set textwidth=0 | " better done with modeline or local exrc and not here set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis @@ -223,9 +223,9 @@ set foldcolumn=0 | " I think I don't need this second indicator " set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow set foldnestmax=1 | " top level folding only set foldopen=block,hor,search | " when do we unfold? -let v:foldstart = "FOO" " set foldtext=Foldtext() | " -set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\v^/[/*]\','','g') +" set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\v^/[/*]\','','g') +set foldtext='⊞\ '.getline(v:foldstart).getline(v:foldstart+1).'↵'.getline(v:foldstart+2) " vim window behaviour set splitbelow | " open new windows below the current one (i find that more intuitive) -- cgit v1.2.3