blob: c23adc4232d895182592911c697b0b247481cfe2 [file] [log] [blame]
Bram Moolenaar9964e462007-05-05 17:54:07 +00001" Vim filetype plugin
2" Language: Hamster Script
3" Version: 2.0.6.0
4" Maintainer: David Fishburn <fishburn@ianywhere.com>
5" Last Change: Wed Nov 08 2006 12:03:09 PM
6
7" Only do this when not done yet for this buffer
8if exists("b:did_ftplugin")
9 finish
10endif
11
12" Don't load another plugin for this buffer
13let b:did_ftplugin = 1
14
Bram Moolenaar84f72352012-03-11 15:57:40 +010015let s:cpo_save = &cpo
Bram Moolenaar9964e462007-05-05 17:54:07 +000016set cpo-=C
17
18let b:undo_ftplugin = "setl fo< com< tw< commentstring<"
19 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
20
21" Set 'formatoptions' to break comment lines but not other lines,
22" and insert the comment leader when hitting <CR> or using "o".
23setlocal fo-=t fo+=croql
24
25" Use the # sign for comments
26setlocal comments=:#
27
28" Format comments to be up to 78 characters long
29if &tw == 0
30 setlocal tw=78
31endif
32
33" Comments start with a double quote
34setlocal commentstring=#%s
35
36" Move around functions.
37noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR>
38noremap <silent><buffer> ]] :call search('^\s*sub\>', "W")<CR>
39noremap <silent><buffer> [] :call search('^\s*endsub\>', "bW")<CR>
40noremap <silent><buffer> ][ :call search('^\s*endsub\>', "W")<CR>
41
42" Move around comments
43noremap <silent><buffer> ]# :call search('^\s*#\@!', "W")<CR>
44noremap <silent><buffer> [# :call search('^\s*#\@!', "bW")<CR>
45
46" Let the matchit plugin know what items can be matched.
47if exists("loaded_matchit")
48 let b:match_ignorecase = 0
49 let b:match_words =
50 \ '\<sub\>:\<return\>:\<endsub\>,' .
51 \ '\<do\|while\|repeat\|for\>:\<break\>:\<continue\>:\<loop\|endwhile\|until\|endfor\>,' .
52 \ '\<if\>:\<else\%[if]\>:\<endif\>'
53
54 " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif
55 " let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" ||
56 " \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"'
57endif
58
59setlocal ignorecase
Bram Moolenaar84f72352012-03-11 15:57:40 +010060let &cpo = s:cpo_save
61unlet s:cpo_save
Bram Moolenaar9964e462007-05-05 17:54:07 +000062setlocal cpo+=M " makes \%( match \)