annotate runtime/indent/hamster.vim @ 25392:b427a26b0210 v8.2.3233

patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer Commit: https://github.com/vim/vim/commit/e2390c7f32879ab7942adf0d38b1db34933695fa Author: Martin Tournoij <martin@arp242.net> Date: Wed Jul 28 13:30:16 2021 +0200 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer Problem: prop_list() and prop_find() do not indicate the buffer for the used type. Solution: Add "type_bufnr" to the results. (closes #8647)
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Jul 2021 13:45:03 +0200
parents 63b0b7b79b25
children 3b34837f4538
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1125
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
1 " Vim indent file
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
2 " Language: Hamster Script
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
3 " Version: 2.0.6.0
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
4 " Last Change: Wed Nov 08 2006 12:02:42 PM
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
5 " Maintainer: David Fishburn <fishburn@ianywhere.com>
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
6
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
7 " Only load this indent file when no other was loaded.
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
8 if exists("b:did_indent")
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
9 finish
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
10 endif
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
11 let b:did_indent = 1
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
12
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
13 setlocal indentkeys+==~if,=~else,=~endif,=~endfor,=~endwhile
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
14 setlocal indentkeys+==~do,=~until,=~while,=~repeat,=~for,=~loop
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
15 setlocal indentkeys+==~sub,=~endsub
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
16
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
17 " Define the appropriate indent function but only once
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
18 setlocal indentexpr=HamGetFreeIndent()
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
19 if exists("*HamGetFreeIndent")
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
20 finish
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
21 endif
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
22
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
23 function HamGetIndent(lnum)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
24 let ind = indent(a:lnum)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
25 let prevline=getline(a:lnum)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
26
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
27 " Add a shiftwidth to statements following if, else, elseif,
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
28 " case, select, default, do, until, while, for, start
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
29 if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1125
diff changeset
30 let ind = ind + shiftwidth()
1125
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
31 endif
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
32
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
33 " Subtract a shiftwidth from else, elseif, end(if|while|for), until
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
34 let line = getline(v:lnum)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
35 if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1125
diff changeset
36 let ind = ind - shiftwidth()
1125
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
37 endif
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
38
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
39 return ind
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
40 endfunction
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
41
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
42 function HamGetFreeIndent()
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
43 " Find the previous non-blank line
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
44 let lnum = prevnonblank(v:lnum - 1)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
45
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
46 " Use zero indent at the top of the file
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
47 if lnum == 0
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
48 return 0
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
49 endif
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
50
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
51 let ind=HamGetIndent(lnum)
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
52 return ind
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
53 endfunction
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
54
96cd8222a819 updated for version 7.1a
vimboss
parents:
diff changeset
55 " vim:sw=2 tw=80