diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-28 22:58:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-28 22:58:02 +0200 |
commit | fc65cabb15d0236bce001ad78e12a40511caf941 (patch) | |
tree | 071cd16ce17e02121ac1c7db7c7518cc70f10a79 /runtime/indent/r.vim | |
parent | 627cb6a6b37d17433fe2d7df1f287eefb5b370e3 (diff) | |
download | vim-git-fc65cabb15d0236bce001ad78e12a40511caf941.tar.gz |
Update runtime files.
Diffstat (limited to 'runtime/indent/r.vim')
-rw-r--r-- | runtime/indent/r.vim | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 373b0e65d..ca85a2e62 100644 --- 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 |