hamster.vim (2124B)
1 " Vim filetype plugin 2 " Language: Hamster Script 3 " Version: 2.0.6.0 4 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> 5 " Last Change: 2021 Jan 19 6 " 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') 7 " 2025 Sep 05 by Vim Project, disable setting global ignorecase 8 9 " Only do this when not done yet for this buffer 10 if exists("b:did_ftplugin") 11 finish 12 endif 13 14 " Don't load another plugin for this buffer 15 let b:did_ftplugin = 1 16 17 let s:cpo_save = &cpo 18 set cpo&vim 19 20 let b:undo_ftplugin = "setl fo< com< tw< commentstring<" 21 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" 22 23 " Set 'formatoptions' to break comment lines but not other lines, 24 " and insert the comment leader when hitting <CR> or using "o". 25 setlocal fo-=t fo+=croql 26 27 " Use the # sign for comments 28 setlocal comments=:# 29 30 " Format comments to be up to 78 characters long 31 if &tw == 0 32 setlocal tw=78 33 endif 34 35 " Comments start with a double quote 36 setlocal commentstring=#\ %s 37 38 " Move around functions. 39 noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR> 40 noremap <silent><buffer> ]] :call search('^\s*sub\>', "W")<CR> 41 noremap <silent><buffer> [] :call search('^\s*endsub\>', "bW")<CR> 42 noremap <silent><buffer> ][ :call search('^\s*endsub\>', "W")<CR> 43 44 " Move around comments 45 noremap <silent><buffer> ]# :call search('^\s*#\@!', "W")<CR> 46 noremap <silent><buffer> [# :call search('^\s*#\@!', "bW")<CR> 47 48 " Let the matchit plugin know what items can be matched. 49 if exists("loaded_matchit") 50 let b:match_ignorecase = 0 51 let b:match_words = 52 \ '\<sub\>:\<return\>:\<endsub\>,' . 53 \ '\<do\|while\|repeat\|for\>:\<break\>:\<continue\>:\<loop\|endwhile\|until\|endfor\>,' . 54 \ '\<if\>:\<else\%[if]\>:\<endif\>' 55 56 " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif 57 " let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" || 58 " \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' 59 endif 60 61 " setlocal ignorecase 62 63 let &cpo = s:cpo_save 64 unlet s:cpo_save 65 66 " Disabled, 'cpo' is a global option. 67 " setlocal cpo+=M " makes \%( match \)