comparison runtime/indent/r.vim @ 14637:0ecb909e3249

Update runtime files. commit https://github.com/vim/vim/commit/fc65cabb15d0236bce001ad78e12a40511caf941 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 28 22:58:02 2018 +0200 Update runtime files.
author Christian Brabandt <cb@256bit.org>
date Tue, 28 Aug 2018 23:00:08 +0200
parents 4aae8146c21f
children b2412874362f
comparison
equal deleted inserted replaced
14636:91eef21ff090 14637:0ecb909e3249
1 " Vim indent file 1 " Vim indent file
2 " Language: R 2 " Language: R
3 " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> 3 " Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime 4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime
5 " Last Change: Thu Feb 18, 2016 06:32AM 5 " Last Change: Sun Aug 19, 2018 09:13PM
6 6
7 7
8 " Only load this indent file when no other was loaded. 8 " Only load this indent file when no other was loaded.
9 if exists("b:did_indent") 9 if exists("b:did_indent")
10 finish 10 finish
17 " Only define the function once. 17 " Only define the function once.
18 if exists("*GetRIndent") 18 if exists("*GetRIndent")
19 finish 19 finish
20 endif 20 endif
21 21
22 let s:cpo_save = &cpo
23 set cpo&vim
24
22 " Options to make the indentation more similar to Emacs/ESS: 25 " Options to make the indentation more similar to Emacs/ESS:
23 if !exists("g:r_indent_align_args") 26 let g:r_indent_align_args = get(g:, 'r_indent_align_args', 1)
24 let g:r_indent_align_args = 1 27 let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0)
25 endif 28 let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40)
26 if !exists("g:r_indent_ess_comments") 29 let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0)
27 let g:r_indent_ess_comments = 0 30 let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern',
28 endif 31 \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$')
29 if !exists("g:r_indent_comment_column")
30 let g:r_indent_comment_column = 40
31 endif
32 if ! exists("g:r_indent_ess_compatible")
33 let g:r_indent_ess_compatible = 0
34 endif
35 if ! exists("g:r_indent_op_pattern")
36 let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
37 endif
38 32
39 function s:RDelete_quotes(line) 33 function s:RDelete_quotes(line)
40 let i = 0 34 let i = 0
41 let j = 0 35 let j = 0
42 let line1 = "" 36 let line1 = ""
229 endif 223 endif
230 endif 224 endif
231 225
232 let cline = SanitizeRLine(cline) 226 let cline = SanitizeRLine(cline)
233 227
234 if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$' 228 if cline =~ '^\s*}'
235 let indline = s:Get_matching_brace(clnum, '{', '}', 1) 229 let indline = s:Get_matching_brace(clnum, '{', '}', 1)
236 if indline > 0 && indline != clnum 230 if indline > 0 && indline != clnum
237 let iline = SanitizeRLine(getline(indline)) 231 let iline = SanitizeRLine(getline(indline))
238 if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$' 232 if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$'
239 return indent(indline) 233 return indent(indline)
240 else 234 else
241 let indline = s:Get_matching_brace(indline, '(', ')', 1) 235 let indline = s:Get_matching_brace(indline, '(', ')', 1)
242 return indent(indline) 236 return indent(indline)
243 endif 237 endif
244 endif 238 endif
239 endif
240
241 if cline =~ '^\s*)$'
242 let indline = s:Get_matching_brace(clnum, '(', ')', 1)
243 return indent(indline)
245 endif 244 endif
246 245
247 " Find the first non blank line above the current line 246 " Find the first non blank line above the current line
248 let lnum = s:Get_prev_line(clnum) 247 let lnum = s:Get_prev_line(clnum)
249 " Hit the start of the file, use zero indent. 248 " Hit the start of the file, use zero indent.
513 return ind 512 return ind
514 endif 513 endif
515 endwhile 514 endwhile
516 515
517 return ind 516 return ind
518 517 endfunction
519 endfunction 518
519 let &cpo = s:cpo_save
520 unlet s:cpo_save
520 521
521 " vim: sw=2 522 " vim: sw=2