diff 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
line wrap: on
line diff
--- a/runtime/indent/r.vim
+++ b/runtime/indent/r.vim
@@ -2,7 +2,7 @@
 " Language:	R
 " Author:	Jakson Alves de Aquino <jalvesaq@gmail.com>
 " Homepage:     https://github.com/jalvesaq/R-Vim-runtime
-" Last Change:	Thu Feb 18, 2016  06:32AM
+" Last Change:	Sun Aug 19, 2018  09:13PM
 
 
 " Only load this indent file when no other was loaded.
@@ -19,22 +19,16 @@ if exists("*GetRIndent")
   finish
 endif
 
+let s:cpo_save = &cpo
+set cpo&vim
+
 " Options to make the indentation more similar to Emacs/ESS:
-if !exists("g:r_indent_align_args")
-  let g:r_indent_align_args = 1
-endif
-if !exists("g:r_indent_ess_comments")
-  let g:r_indent_ess_comments = 0
-endif
-if !exists("g:r_indent_comment_column")
-  let g:r_indent_comment_column = 40
-endif
-if ! exists("g:r_indent_ess_compatible")
-  let g:r_indent_ess_compatible = 0
-endif
-if ! exists("g:r_indent_op_pattern")
-  let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
-endif
+let g:r_indent_align_args     = get(g:, 'r_indent_align_args',      1)
+let g:r_indent_ess_comments   = get(g:, 'r_indent_ess_comments',    0)
+let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40)
+let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible',  0)
+let g:r_indent_op_pattern     = get(g:, 'r_indent_op_pattern',
+      \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$')
 
 function s:RDelete_quotes(line)
   let i = 0
@@ -231,7 +225,7 @@ function GetRIndent()
 
   let cline = SanitizeRLine(cline)
 
-  if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
+  if cline =~ '^\s*}'
     let indline = s:Get_matching_brace(clnum, '{', '}', 1)
     if indline > 0 && indline != clnum
       let iline = SanitizeRLine(getline(indline))
@@ -244,6 +238,11 @@ function GetRIndent()
     endif
   endif
 
+  if cline =~ '^\s*)$'
+    let indline = s:Get_matching_brace(clnum, '(', ')', 1)
+    return indent(indline)
+  endif
+
   " Find the first non blank line above the current line
   let lnum = s:Get_prev_line(clnum)
   " Hit the start of the file, use zero indent.
@@ -515,7 +514,9 @@ function GetRIndent()
   endwhile
 
   return ind
-
 endfunction
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
 " vim: sw=2