Hi VIMmers,

The default sh indent script in VIM7 indent the following sample file this way:

-------------------- 8< --------------------
#!/bin/sh

SYSTEM=`uname -s`

case $SYSTEM in
   Linux)
   echo "My system is Linux"
   echo "Do Linux stuff here..."
   ;;
   FreeBSD)
   echo "My system is FreeBSD"
   echo "Do FreeBSD stuff here..."
   ;;
   *)
   echo "Unknown system : $SYSTEM"
   echo "I don't what to do..."
   ;;
esac
-------------------- 8< --------------------

But I preferred the indent of each case label be decreased to the same
level of the "case" statement, like this:

-------------------- 8< --------------------
#!/bin/sh

SYSTEM=`uname -s`

case $SYSTEM in
Linux)
   echo "My system is Linux"
   echo "Do Linux stuff here..."
   ;;
FreeBSD)
   echo "My system is FreeBSD"
   echo "Do FreeBSD stuff here..."
   ;;
*)
   echo "Unknown system : $SYSTEM"
   echo "I don't what to do..."
   ;;
esac
-------------------- 8< --------------------

So I hacked the indent script. Any suggestion and feedback are welcome. :-)

Can anyone hack the script and support this indent flavor, too?

-------------------- 8< --------------------
#!/bin/sh

SYSTEM=`uname -s`

case $SYSTEM in
   Linux)
       echo "My system is Linux"
       echo "Do Linux stuff here..."
       ;;
   FreeBSD)
       echo "My system is FreeBSD"
       echo "Do FreeBSD stuff here..."
       ;;
   *)
       echo "Unknown system : $SYSTEM"
       echo "I don't what to do..."
       ;;
esac
-------------------- 8< --------------------


Regards,


Edward L. Fox

Attachment: sh.vim
Description: Binary data

Reply via email to