annotate runtime/ftplugin/erlang.vim @ 29576:04bc48a4ca6f v9.0.0129

patch 9.0.0129: compiler warning for int/size_t usage Commit: https://github.com/vim/vim/commit/ab146dac6b4148e770eb2bf61c72ef62d3ecfc65 Author: Mike Williams <mikew@globalgraphics.com> Date: Mon Aug 1 14:00:31 2022 +0100 patch 9.0.0129: compiler warning for int/size_t usage Problem: Compiler warning for int/size_t usage. Solution: Add a type cast. (Mike Williams, closes https://github.com/vim/vim/issues/10830)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Aug 2022 15:15:03 +0200
parents e2e2cc5d0856
children f68f43043842
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim ftplugin file
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
2 " Language: Erlang (http://www.erlang.org)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
3 " Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
4 " Author: Oscar Hellström <oscar@oscarh.net>
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
5 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Eduardo Lopez (http://github.com/tapichu)
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
7 " Arvid Bjurklint (http://github.com/slarwise)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
8 " Last Update: 2021-Jan-08
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 " License: Vim license
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
10 " URL: https://github.com/vim-erlang/vim-erlang-runtime
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 if exists('b:did_ftplugin')
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
13 finish
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
15 let b:did_ftplugin = 1
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
17 let s:cpo_save = &cpo
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
18 set cpo&vim
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
19
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
20 let &l:keywordprg = get(g:, 'erlang_keywordprg', 'erl -man')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
21
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
22 if get(g:, 'erlang_folding', 0)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
23 setlocal foldmethod=expr
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
24 setlocal foldexpr=GetErlangFold(v:lnum)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
25 setlocal foldtext=ErlangFoldText()
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 endif
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
28 setlocal comments=:%%%,:%%,:%
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
29 setlocal commentstring=%%s
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
30
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
31 setlocal formatoptions+=ro
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
32
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
33 setlocal suffixesadd=.erl,.hrl
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
34
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
35 let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
36 let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37
3356
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
38 let s:erlang_fun_begin = '^\a\w*(.*$'
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
39 let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
40
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
41 if !exists('*GetErlangFold')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
42 function GetErlangFold(lnum)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
43 let lnum = a:lnum
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
44 let line = getline(lnum)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
46 if line =~ s:erlang_fun_end
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
47 return '<1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
48 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
50 if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
51 return '1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
52 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
54 if line =~ s:erlang_fun_begin
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
55 return '>1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
56 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
58 return '='
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
59 endfunction
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
60 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
62 if !exists('*ErlangFoldText')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
63 function ErlangFoldText()
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
64 let line = getline(v:foldstart)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
65 let foldlen = v:foldend - v:foldstart + 1
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
66 let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
67 if foldlen < 10
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
68 let lines = ' ' . lines
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
69 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
70 let retval = '+' . v:folddashes . lines
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
72 return retval
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
73 endfunction
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
74 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
76 let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
77 \ . " comments< commentstring< formatoptions< suffixesadd< include<"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
78 \ . " define<"
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
79
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
80 let &cpo = s:cpo_save
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
81 unlet s:cpo_save
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
82
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
83 " vim: sw=2 et