86164Re: Simple hiding all comments by folding
- Jan 1, 2008At Tuesday 01 January 2008 05:00:05, Ben Schmidt wrote:
> You could conceivably write or modify syntax files to do it and usebashism ahead! Protect the innocent!
> foldmethod=syntax, but there'd be plenty of work involved,
> particularly since, for the most part, 'long' comments in shell
> scripts and such are actually not long comments, but lots of short
> comments one after the other. (...)
You can fake a multiline comment in bash-scripts. Use a "here script",
which is defined as
command << token
content to be used as command's standard input
For "command" use the colon:
$ help :
No effect; the command does nothing. A zero exit code is returned.
For "token" invent something nice, which didn't have sideeffects.
(Unfortunally, the "standard" 3 curly brackets have.) Add that "token"
to the syntax file and proceed with "foldmethod=syntax".
The idea is stolen from the 'Net, but I didn't remember the URL. So,
credits to whoever it was.
- << Previous post in topic Next post in topic >>