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