Loading ...
Sorry, an error occurred while loading the content.

86164Re: Simple hiding all comments by folding

Expand Messages
  • Martin Lange
    Jan 1, 2008
    • 0 Attachment
      At Tuesday 01 January 2008 05:00:05, Ben Schmidt wrote:

      > You could conceivably write or modify syntax files to do it and use
      > 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. (...)

      bashism ahead! Protect the innocent!

      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.


      Martin "vi"
    • Show all 17 messages in this topic