title: A problem with folding bash functions in vim
body: <p>I have a bash script file which starts with a function definition, like this:</p>
  
  <pre><code>#!/bin/bash
  # .....
  # .....
  function test {
  ...
  ...
  }
  ...
  ...
  </code></pre>
  
  <p>I use vim 7.2, and I have set <code>g:sh_fold_enabled=1</code> such that folding is enabled with bash. The problem is that the folding of the function test is not ended correctly, i.e. it lasts until the end of file. It looks something like this:</p>
  
  <pre><code>#!/bin/bash
  # .....
  # .....
  +-- 550 lines: function test {----------------------------------------
  ~
  ~
  </code></pre>
  
  <p>The function itself is just about 40 lines, and I want something that lookes like this ("images" say more than a thousend words, they say...):</p>
  
  <pre><code>#!/bin/bash
  # .....
  # .....
  +-- 40 lines: function test {----------------------------------------
  ...
  ...
  ...
  ~
  ~
  </code></pre>
  
  <p>Does anyone know a good solution to this problem?</p>