annotate runtime/indent/raku.vim @ 34178:c5a10c03afb8 v9.1.0044

patch 9.1.0044: po Makefiles can be improved Commit: https://github.com/vim/vim/commit/76ba724e1d56b00e72834a9203855f0656dcbb58 Author: RestorerZ <restorer@mail2k.ru> Date: Mon Jan 22 20:28:12 2024 +0100 patch 9.1.0044: po Makefiles can be improved Problem: po Makefiles can be improved Solution: Improve the style of the Makefiles, update Makefile variables, update documentation (RestorerZ) closes: #13858 closes: #13857 Signed-off-by: RestorerZ <restorer@mail2k.ru> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 22 Jan 2024 20:45:03 +0100
parents 5c220cf30f1f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
1 " Vim indent file
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2 " Language: Perl 6
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3 " Maintainer: vim-perl <vim-perl@googlegroups.com>
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
4 " Homepage: https://github.com/vim-perl/vim-perl
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
5 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
6 " Last Change: 2020 Apr 15
33052
5c220cf30f1f runtime: Set b:undo_indent where missing (#12944)
Christian Brabandt <cb@256bit.org>
parents: 24520
diff changeset
7 " 2023 Aug 28 by Vim Project (undo_indent)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
8 " Contributors: Andy Lester <andy@petdance.com>
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
9 " Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
10 "
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
11 " Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
12
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
13 " Suggestions and improvements by :
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
14 " Aaron J. Sherman (use syntax for hints)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
15 " Artem Chuprina (play nice with folding)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
16 " TODO:
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
17 " This file still relies on stuff from the Perl 5 syntax file, which Perl 6
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
18 " does not use.
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
19 "
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
20 " Things that are not or not properly indented (yet) :
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
21 " - Continued statements
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
22 " print "foo",
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
23 " "bar";
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
24 " print "foo"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
25 " if bar();
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
26 " - Multiline regular expressions (m//x)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
27 " (The following probably needs modifying the perl syntax file)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
28 " - qw() lists
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
29 " - Heredocs with terminators that don't match \I\i*
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
30
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
31 " Only load this indent file when no other was loaded.
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
32 if exists("b:did_indent")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
33 finish
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
34 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
35 let b:did_indent = 1
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
36
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
37 " Is syntax highlighting active ?
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
38 let b:indent_use_syntax = has("syntax")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
39
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
40 setlocal indentexpr=GetRakuIndent()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
41
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
42 " we reset it first because the Perl 5 indent file might have been loaded due
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
43 " to a .pl/pm file extension, and indent files don't clean up afterwards
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
44 setlocal indentkeys&
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
45
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
46 setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
47 if !b:indent_use_syntax
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
48 setlocal indentkeys+=0=EO
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
49 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
50
33052
5c220cf30f1f runtime: Set b:undo_indent where missing (#12944)
Christian Brabandt <cb@256bit.org>
parents: 24520
diff changeset
51 let b:undo_indent = "setlocal indentexpr< indentkeys<"
5c220cf30f1f runtime: Set b:undo_indent where missing (#12944)
Christian Brabandt <cb@256bit.org>
parents: 24520
diff changeset
52
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
53 let s:cpo_save = &cpo
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
54 set cpo-=C
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
55
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
56 function! GetRakuIndent()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
57
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
58 " Get the line to be indented
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
59 let cline = getline(v:lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
60
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
61 " Indent POD markers to column 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
62 if cline =~ '^\s*=\L\@!'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
63 return 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
64 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
65
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
66 " Get current syntax item at the line's first char
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
67 let csynid = ''
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
68 if b:indent_use_syntax
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
69 let csynid = synIDattr(synID(v:lnum,1,0),"name")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
70 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
71
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
72 " Don't reindent POD and heredocs
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
73 if csynid =~ "^rakuPod"
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
74 return indent(v:lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
75 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
76
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
77
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
78 " Now get the indent of the previous perl line.
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
79
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
80 " Find a non-blank line above the current line.
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
81 let lnum = prevnonblank(v:lnum - 1)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
82 " Hit the start of the file, use zero indent.
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
83 if lnum == 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
84 return 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
85 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
86 let line = getline(lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
87 let ind = indent(lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
88 " Skip heredocs, POD, and comments on 1st column
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
89 if b:indent_use_syntax
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
90 let skippin = 2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
91 while skippin
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
92 let synid = synIDattr(synID(lnum,1,0),"name")
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
93 if (synid =~ "^rakuPod" || synid =~ "rakuComment")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
94 let lnum = prevnonblank(lnum - 1)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
95 if lnum == 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
96 return 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
97 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
98 let line = getline(lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
99 let ind = indent(lnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
100 let skippin = 1
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
101 else
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
102 let skippin = 0
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
103 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
104 endwhile
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
105 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
106
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
107 if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
108 let ind = ind + &sw
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
109 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
110 if cline =~ '^\s*[)}\]»>]'
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
111 let ind = ind - &sw
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
112 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
113
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
114 " Indent lines that begin with 'or' or 'and'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
115 if cline =~ '^\s*\(or\|and\)\>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
116 if line !~ '^\s*\(or\|and\)\>'
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
117 let ind = ind + &sw
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
118 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
119 elseif line =~ '^\s*\(or\|and\)\>'
24520
5bda4653aced Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
120 let ind = ind - &sw
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
121 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
122
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
123 return ind
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
124
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
125 endfunction
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
126
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
127 let &cpo = s:cpo_save
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
128 unlet s:cpo_save
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
129
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
130 " vim:ts=8:sts=4:sw=4:expandtab:ft=vim