robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #35647 from zeertzjq/vim-510ca80ba5fedde65

master
2.1 KiB67 linesraw
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
10if exists("b:did_ftplugin")
11  finish
12endif
13
14" Don't load another plugin for this buffer
15let b:did_ftplugin = 1
16
17let s:cpo_save = &cpo
18set cpo&vim
19
20let 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".
25setlocal fo-=t fo+=croql
26
27" Use the # sign for comments
28setlocal comments=:#
29
30" Format comments to be up to 78 characters long
31if &tw == 0
32  setlocal tw=78
33endif
34
35" Comments start with a double quote
36setlocal commentstring=#\ %s
37
38" Move around functions.
39noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR>
40noremap <silent><buffer> ]] :call search('^\s*sub\>', "W")<CR>
41noremap <silent><buffer> [] :call search('^\s*endsub\>', "bW")<CR>
42noremap <silent><buffer> ][ :call search('^\s*endsub\>', "W")<CR>
43
44" Move around comments
45noremap <silent><buffer> ]# :call search('^\s*#\@!', "W")<CR>
46noremap <silent><buffer> [# :call search('^\s*#\@!', "bW")<CR>
47
48" Let the matchit plugin know what items can be matched.
49if 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"'
59endif
60
61" setlocal ignorecase
62
63let &cpo = s:cpo_save
64unlet s:cpo_save
65
66" Disabled, 'cpo' is a global option.
67" setlocal cpo+=M		" makes \%( match \)