Mercurial > vim
annotate runtime/indent/rrst.vim @ 34375:02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Commit: https://github.com/vim/vim/commit/f9ca139e3aa12dd03177ebba5eedcee4f0836f27
Author: Christian Brabandt <cb@256bit.org>
Date: Mon Feb 19 20:37:11 2024 +0100
runtime(misc): announce adoption of various runtime files
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 19 Feb 2024 21:00:10 +0100 |
parents | b2412874362f |
children |
rev | line source |
---|---|
6051 | 1 " Vim indent file |
2 " Language: Rrst | |
34375
02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Christian Brabandt <cb@256bit.org>
parents:
32061
diff
changeset
|
3 " Maintainer: This runtime file is looking for a new maintainer. |
02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Christian Brabandt <cb@256bit.org>
parents:
32061
diff
changeset
|
4 " Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> |
02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Christian Brabandt <cb@256bit.org>
parents:
32061
diff
changeset
|
5 " Former Repository: https://github.com/jalvesaq/R-Vim-runtime |
02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Christian Brabandt <cb@256bit.org>
parents:
32061
diff
changeset
|
6 " Last Change: 2023 Feb 25 |
02bd0fe77c68
runtime(misc): announce adoption of various runtime files
Christian Brabandt <cb@256bit.org>
parents:
32061
diff
changeset
|
7 " 2024 Feb 19 by Vim Project (announce adoption) |
6051 | 8 |
9 | |
10 " Only load this indent file when no other was loaded. | |
11 if exists("b:did_indent") | |
12 finish | |
13 endif | |
14 runtime indent/r.vim | |
15 let s:RIndent = function(substitute(&indentexpr, "()", "", "")) | |
16 let b:did_indent = 1 | |
17 | |
18 setlocal indentkeys=0{,0},:,!^F,o,O,e | |
19 setlocal indentexpr=GetRrstIndent() | |
20 | |
32061 | 21 let b:undo_indent = "setl inde< indk<" |
22 | |
6051 | 23 if exists("*GetRrstIndent") |
24 finish | |
25 endif | |
26 | |
27 function GetRstIndent() | |
28 let pline = getline(v:lnum - 1) | |
29 let cline = getline(v:lnum) | |
30 if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' | |
31 return indent(v:lnum) | |
32 elseif pline =~ '^\s*[-\+\*]\s' | |
33 return indent(v:lnum - 1) + 2 | |
34 elseif pline =~ '^\s*\d\+\.\s\+' | |
35 return indent(v:lnum - 1) + 3 | |
36 endif | |
37 return indent(prevnonblank(v:lnum - 1)) | |
38 endfunction | |
39 | |
40 function GetRrstIndent() | |
41 if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$' | |
42 return 0 | |
43 endif | |
44 if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW") | |
45 return s:RIndent() | |
46 else | |
47 return GetRstIndent() | |
48 endif | |
49 endfunction | |
50 | |
51 " vim: sw=2 |