my configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.3 KiB

  1. " Language: apache
  2. " Maintainer: Satya P <vim@thesatya.com>
  3. " Last Change: Sat, 27 Jan 2007 11:24:59 EST
  4. " Notes: 0) Copied from Johannes Zellner <johannes@zellner.org>'s xml
  5. " indent script
  6. " Only load this indent file when no other was loaded.
  7. if exists('b:did_indent')
  8. finish
  9. endif
  10. let b:did_indent = 1
  11. " [-- local settings (must come before aborting the script) --]
  12. setlocal indentexpr=ApacheIndentGet(v:lnum,1)
  13. setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,}
  14. set cpotions-=C
  15. " [-- finish, if the function already exists --]
  16. if exists('*ApacheIndentGet') | finish | endif
  17. fun! ApacheIndentGet(lnum, use_syntax_check)
  18. " Find a non-empty line above the current line.
  19. let lnum = prevnonblank(a:lnum - 1)
  20. " Hit the start of the file, use zero indent.
  21. if lnum == 0
  22. return 0
  23. endif
  24. let prevline=getline(lnum)
  25. let line=getline(a:lnum)
  26. let ind=indent(lnum)
  27. let inddelta=0
  28. if match(line, '^\s*</') == 0
  29. "if this is a closing tag line, reduce its indentation
  30. let inddelta = 0 - &shiftwidth
  31. elseif match(prevline,'^\s*<\a') == 0
  32. "if previous line is a opening tag line, increase its indentation
  33. let inddelta = &shiftwidth
  34. endif
  35. let ind = ind + inddelta
  36. return ind
  37. endfun
  38. " vim:ts=8