Mercurial > vim
annotate runtime/indent/treetop.vim @ 25222:fbb530e081ca v8.2.3147
patch 8.2.3147: Vim9: profiling does not work with a nested function
Commit: https://github.com/vim/vim/commit/648594eaf703fe9a862cb12a35702a10aff6e5a9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 11 17:55:01 2021 +0200
patch 8.2.3147: Vim9: profiling does not work with a nested function
Problem: Vim9: profiling does not work with a nested function.
Solution: Also compile a nested function without profiling. (closes https://github.com/vim/vim/issues/8543)
Handle that compiling may cause the table of compiled functions to
change.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Jul 2021 18:00:04 +0200 |
parents | d0a20101ecb2 |
children | 11b656e74444 |
rev | line source |
---|---|
2725 | 1 " Vim indent file |
11062 | 2 " Language: Treetop |
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | |
4 " Latest Revision: 2011-03-14 | |
2725 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal indentexpr=GetTreetopIndent() | |
12 setlocal indentkeys=0{,0},!^F,o,O,=end | |
13 setlocal nosmartindent | |
14 | |
15 if exists("*GetTreetopIndent") | |
16 finish | |
17 endif | |
18 | |
19 function GetTreetopIndent() | |
20 let pnum = prevnonblank(v:lnum - 1) | |
21 if pnum == 0 | |
22 return 0 | |
23 endif | |
24 | |
25 let ind = indent(pnum) | |
26 let line = getline(pnum) | |
27 | |
28 if line =~ '^\s*\%(grammar\|module\|rule\)\>' | |
11160 | 29 let ind += shiftwidth() |
2725 | 30 endif |
31 | |
32 let line = getline(v:lnum) | |
33 if line =~ '^\s*end\>' | |
11160 | 34 let ind -= shiftwidth() |
2725 | 35 end |
36 | |
37 retur ind | |
38 endfunction |