csh.vim 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. " Vim filetype plugin file
  2. " Language: csh
  3. " Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
  4. " Last Changed: 20 Jan 2009
  5. " URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
  6. if exists("b:did_ftplugin") | finish | endif
  7. let b:did_ftplugin = 1
  8. " Make sure the continuation lines below do not cause problems in
  9. " compatibility mode.
  10. let s:save_cpo = &cpo
  11. set cpo-=C
  12. setlocal commentstring=#%s
  13. setlocal formatoptions-=t
  14. setlocal formatoptions+=crql
  15. " Csh: thanks to Johannes Zellner
  16. " - Both foreach and end must appear alone on separate lines.
  17. " - The words else and endif must appear at the beginning of input lines;
  18. " the if must appear alone on its input line or after an else.
  19. " - Each case label and the default label must appear at the start of a
  20. " line.
  21. " - while and end must appear alone on their input lines.
  22. if exists("loaded_matchit")
  23. let b:match_words =
  24. \ '^\s*\<if\>.*(.*).*\<then\>:'.
  25. \ '^\s*\<else\>\s\+\<if\>.*(.*).*\<then\>:^\s*\<else\>:'.
  26. \ '^\s*\<endif\>,'.
  27. \ '\%(^\s*\<foreach\>\s\+\S\+\|^s*\<while\>\).*(.*):'.
  28. \ '\<break\>:\<continue\>:^\s*\<end\>,'.
  29. \ '^\s*\<switch\>.*(.*):^\s*\<case\>\s\+:^\s*\<default\>:^\s*\<endsw\>'
  30. endif
  31. " Change the :browse e filter to primarily show csh-related files.
  32. if has("gui_win32")
  33. let b:browsefilter="csh Scripts (*.csh)\t*.csh\n" .
  34. \ "All Files (*.*)\t*.*\n"
  35. endif
  36. " Undo the stuff we changed.
  37. let b:undo_ftplugin = "setlocal commentstring< formatoptions<" .
  38. \ " | unlet! b:match_words b:browsefilter"
  39. " Restore the saved compatibility options.
  40. let &cpo = s:save_cpo
  41. unlet s:save_cpo