haml.vim 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. " Vim filetype plugin
  2. " Language: Haml
  3. " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
  4. " Last Change: 2019 Dec 05
  5. " 2024 Jan 14 by Vim Project (browsefilter)
  6. " Only do this when not done yet for this buffer
  7. if exists("b:did_ftplugin")
  8. finish
  9. endif
  10. let s:save_cpo = &cpo
  11. set cpo-=C
  12. " Define some defaults in case the included ftplugins don't set them.
  13. let s:undo_ftplugin = ""
  14. if has("win32")
  15. let s:browsefilter = "All Files (*.*)\t*\n"
  16. else
  17. let s:browsefilter = "All Files (*)\t*\n"
  18. endif
  19. let s:match_words = ""
  20. runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
  21. unlet! b:did_ftplugin
  22. set matchpairs-=<:>
  23. " Override our defaults if these were set by an included ftplugin.
  24. if exists("b:undo_ftplugin")
  25. let s:undo_ftplugin = b:undo_ftplugin
  26. unlet b:undo_ftplugin
  27. endif
  28. if exists("b:browsefilter")
  29. let s:browsefilter = b:browsefilter
  30. unlet b:browsefilter
  31. endif
  32. if exists("b:match_words")
  33. let s:match_words = b:match_words
  34. unlet b:match_words
  35. endif
  36. runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
  37. let b:did_ftplugin = 1
  38. let &l:define .= empty(&l:define ? '' : '\|') . '^\s*\%(%\w*\)\=\%(\.[[:alnum:]_-]\+\)*#'
  39. " Combine the new set of values with those previously included.
  40. if exists("b:undo_ftplugin")
  41. let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
  42. endif
  43. if exists ("b:browsefilter")
  44. let s:browsefilter = substitute(b:browsefilter,'\cAll Files (.*)\t\*\n','','') . s:browsefilter
  45. endif
  46. if exists("b:match_words")
  47. let s:match_words = b:match_words . ',' . s:match_words
  48. endif
  49. " Change the browse dialog on Win32 and GTK to show mainly Haml-related files
  50. if has("gui_win32") || has("gui_gtk")
  51. let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter
  52. endif
  53. " Load the combined list of match_words for matchit.vim
  54. if exists("loaded_matchit")
  55. let b:match_words = s:match_words
  56. endif
  57. setlocal comments= commentstring=-#\ %s
  58. let b:undo_ftplugin = "setl def< cms< com< " .
  59. \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
  60. let &cpo = s:save_cpo
  61. unlet s:save_cpo
  62. " vim:set sw=2: