Add syntax based folding for block comments
This also enables folding of multiple consecutive line comments as a single block.
@dkearns I've attempted to merge this to https://github.com/benknoble/vim-racket (see results in https://github.com/benknoble/vim-racket/tree/merge-69). Can you let me know if that merge looks correct to you? I'll test drive it a bit, too.
In particular, look at 32d4343 (Merge syntax based folding for block comments, 2025-09-10).
From a quick drive, it looks like it works to me for folding. I didn't try the "no_fold" override.
I did have to push one fix to the merge-69 temporary branch for multiline comments:
range-diff: re-include form comments in racketTop
1: b2a0b11 = 1: b2a0b11 Add syntax based folding for block comments
2: 32d4343 ! 2: f251a43 Merge syntax based folding for block comments
@@ Commit message
- 9f9a3ae (Use unabbreviated 'syntax' command name, 2022-08-11)
PR: https://github.com/wlangstroth/vim-racket/pull/69
+ Best-viewed-with: --diff-merges=1
## syntax/racket.vim ##
@@ syntax/racket.vim: syntax match racketUnquote ",@"
@@ syntax/racket.vim: syntax match racketUnquote ",@"
syntax match racketComment /;.*$/ contains=racketTodo,racketNote,@Spell
-syntax region racketMultilineComment start=/#|/ end=/|#/ contains=racketMultilineComment,racketTodo,racketNote,@Spell
syntax match racketFormComment "#;" nextgroup=@racketTop
-
++syntax cluster racketTop add=racketFormComment
++
+if exists("racket_no_comment_fold")
+ syntax region racketBlockComment start=/#|/ end=/|#/ contains=racketBlockComment,racketTodo,racketNote,@Spell
+else
+ syntax region racketBlockComment start=/#|/ end=/|#/ contains=racketBlockComment,racketTodo,racketNote,@Spell fold
+ syntax region racketMultilineComment start="^\s*;" end="^\%(\s*;\)\@!" contains=racketComment transparent keepend fold
+endif
-+
+
syntax match racketTodo /\C\<\(FIXME\|TODO\|XXX\)\ze:\?\>/ contained
syntax match racketNote /\CNOTE\ze:\?/ contained
I've gone ahead and pushed my merge of this to benknoble/vim-racket's master branch.