blob: 29711fb0936196bd967c752289d048d8f91ccf65 [file] [log] [blame]
Bram Moolenaar9964e462007-05-05 17:54:07 +00001" Vim filetype plugin
2" Language: Hamster Script
3" Version: 2.0.6.0
Bram Moolenaar036986f2017-03-16 17:41:02 +01004" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
5" Last Change: 2017 Mar 07
Bram Moolenaar9964e462007-05-05 17:54:07 +00006
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 Moolenaar036986f2017-03-16 17:41:02 +010016set cpo&vim
Bram Moolenaar9964e462007-05-05 17:54:07 +000017set cpo-=C
18
19let b:undo_ftplugin = "setl fo< com< tw< commentstring<"
20 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
21
22" Set 'formatoptions' to break comment lines but not other lines,
23" and insert the comment leader when hitting <CR> or using "o".
24setlocal fo-=t fo+=croql
25
26" Use the # sign for comments
27setlocal comments=:#
28
29" Format comments to be up to 78 characters long
30if &tw == 0
31 setlocal tw=78
32endif
33
34" Comments start with a double quote
35setlocal commentstring=#%s
36
37" Move around functions.
38noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR>
39noremap <silent><buffer> ]] :call search('^\s*sub\>', "W")<CR>
40noremap <silent><buffer> [] :call search('^\s*endsub\>', "bW")<CR>
41noremap <silent><buffer> ][ :call search('^\s*endsub\>', "W")<CR>
42
43" Move around comments
44noremap <silent><buffer> ]# :call search('^\s*#\@!', "W")<CR>
45noremap <silent><buffer> [# :call search('^\s*#\@!', "bW")<CR>
46
47" Let the matchit plugin know what items can be matched.
48if exists("loaded_matchit")
49 let b:match_ignorecase = 0
50 let b:match_words =
51 \ '\<sub\>:\<return\>:\<endsub\>,' .
52 \ '\<do\|while\|repeat\|for\>:\<break\>:\<continue\>:\<loop\|endwhile\|until\|endfor\>,' .
53 \ '\<if\>:\<else\%[if]\>:\<endif\>'
54
55 " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif
56 " let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" ||
57 " \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"'
58endif
59
60setlocal ignorecase
Bram Moolenaar84f72352012-03-11 15:57:40 +010061let &cpo = s:cpo_save
62unlet s:cpo_save
Bram Moolenaar9964e462007-05-05 17:54:07 +000063setlocal cpo+=M " makes \%( match \)