home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim60.zip / vim60rt2.zip / vim / vim60 / indent / make.vim < prev    next >
Text File  |  2001-09-26  |  892b  |  42 lines

  1. "  vim: set sw=4 sts=4:
  2. "  Maintainer    : Nikolai 'pcp' Weibull <da.box@home.se>
  3. "  URL        : http://www.pcppopper.org/
  4. "  Revised on    : Sun, 26 Aug 2001 15:14:43 +0200
  5. "  Language    : Makefile
  6.  
  7. " Only load this indent file when no other was loaded.
  8. if exists("b:did_indent")
  9.     finish
  10. endif
  11.  
  12. let b:did_indent = 1
  13.  
  14. setlocal indentexpr=GetMakeIndent()
  15. setlocal indentkeys=!^F,o,O
  16.  
  17. " Only define the function once.
  18. if exists("*GetMakeIndent")
  19.     finish
  20. endif
  21.  
  22. function GetMakeIndent()
  23.     if v:lnum == 1
  24.     return 0
  25.     endif
  26.  
  27.     let ind = indent(v:lnum - 1)
  28.     let line = getline(v:lnum - 1)
  29.  
  30.     if line == ''
  31.     let ind = 0
  32.     elseif line =~ '^[^ \t#:][^#:]*:\{1,2}\([^=:]\|$\)'
  33.     let ind = ind + &ts
  34.     elseif line =~ '^\s*\h\w*\s*=\s*.\+\\$'
  35.     let ind = ind + matchend(line, '=\s*')
  36.     else
  37.     let ind = indent(v:lnum)
  38.     endif
  39.  
  40.     return ind
  41. endfunction
  42.