Mercurial > vim
comparison runtime/indent/pascal.vim @ 25880:9c221ad9634a
Update runtime files
Commit: https://github.com/vim/vim/commit/6e649224926bbc1df6a4fdfa7a96b4acb1f8bee0
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 4 21:32:54 2021 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 Oct 2021 22:45:05 +0200 |
parents | 84c7dc0fdcd2 |
children |
comparison
equal
deleted
inserted
replaced
25879:14ca7cc78a56 | 25880:9c221ad9634a |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: Pascal | 2 " Language: Pascal |
3 " Maintainer: Neil Carter <n.carter@swansea.ac.uk> | 3 " Maintainer: Neil Carter <n.carter@swansea.ac.uk> |
4 " Created: 2004 Jul 13 | 4 " Created: 2004 Jul 13 |
5 " Last Change: 2021 Jul 01 | 5 " Last Change: 2021 Sep 22 |
6 " | 6 " |
7 " This is version 2.0, a complete rewrite. | 7 " For further documentation, see https://psy.swansea.ac.uk/staff/carter/vim/ |
8 " | |
9 " For further documentation, see http://psy.swansea.ac.uk/staff/carter/vim/ | |
10 | 8 |
11 | 9 |
12 if exists("b:did_indent") | 10 if exists("b:did_indent") |
13 finish | 11 finish |
14 endif | 12 endif |
18 setlocal indentkeys& | 16 setlocal indentkeys& |
19 setlocal indentkeys+==end;,==const,==type,==var,==begin,==repeat,==until,==for | 17 setlocal indentkeys+==end;,==const,==type,==var,==begin,==repeat,==until,==for |
20 setlocal indentkeys+==program,==function,==procedure,==object,==private | 18 setlocal indentkeys+==program,==function,==procedure,==object,==private |
21 setlocal indentkeys+==record,==if,==else,==case | 19 setlocal indentkeys+==record,==if,==else,==case |
22 | 20 |
23 let b:undo_indent = "setl indentkeys< indentexpr<" | 21 let b:undo_indent = 'setlocal indentexpr< indentkeys<' |
24 | 22 |
25 if exists("*GetPascalIndent") | 23 if exists("*GetPascalIndent") |
26 finish | 24 finish |
27 endif | 25 endif |
28 | 26 |
29 | 27 |
28 " ________________________________________________________________ | |
30 function! s:GetPrevNonCommentLineNum( line_num ) | 29 function! s:GetPrevNonCommentLineNum( line_num ) |
31 | 30 |
32 " Skip lines starting with a comment | 31 " Skip lines starting with a comment |
33 let SKIP_LINES = '^\s*\(\((\*\)\|\(\*\ \)\|\(\*)\)\|{\|}\)' | 32 let SKIP_LINES = '^\s*\(\((\*\)\|\(\*\ \)\|\(\*)\)\|{\|}\)' |
34 | 33 |
42 | 41 |
43 return nline | 42 return nline |
44 endfunction | 43 endfunction |
45 | 44 |
46 | 45 |
46 " ________________________________________________________________ | |
47 function! s:PurifyCode( line_num ) | 47 function! s:PurifyCode( line_num ) |
48 " Strip any trailing comments and whitespace | 48 " Strip any trailing comments and whitespace |
49 let pureline = 'TODO' | 49 let pureline = 'TODO' |
50 return pureline | 50 return pureline |
51 endfunction | 51 endfunction |
52 | 52 |
53 | 53 |
54 " ________________________________________________________________ | |
54 function! GetPascalIndent( line_num ) | 55 function! GetPascalIndent( line_num ) |
55 | 56 |
56 " Line 0 always goes at column 0 | 57 " Line 0 always goes at column 0 |
57 if a:line_num == 0 | 58 if a:line_num == 0 |
58 return 0 | 59 return 0 |
182 if this_codeline =~ '^\s*begin$' | 183 if this_codeline =~ '^\s*begin$' |
183 return 0 | 184 return 0 |
184 endif | 185 endif |
185 | 186 |
186 | 187 |
187 " ____________________________________________________________________ | 188 " ________________________________________________________________ |
188 " Object/Borland Pascal/Delphi Extensions | 189 " Object/Borland Pascal/Delphi Extensions |
189 " | 190 " |
190 " Note that extended-pascal is handled here, unless it is simpler to | 191 " Note that extended-pascal is handled here, unless it is simpler to |
191 " handle them in the standard-pascal section above. | 192 " handle them in the standard-pascal section above. |
192 | 193 |
220 if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$' | 221 if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$' |
221 return indnt - shiftwidth() | 222 return indnt - shiftwidth() |
222 endif | 223 endif |
223 | 224 |
224 | 225 |
225 " ____________________________________________________________________ | |
226 | |
227 " If nothing changed, return same indent. | 226 " If nothing changed, return same indent. |
228 return indnt | 227 return indnt |
229 endfunction | 228 endfunction |
230 | 229 |