aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent/r.vim
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-02-28 09:34:27 +0100
committerGitHub <noreply@github.com>2023-02-28 09:34:27 +0100
commit66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c (patch)
tree0744198130c837d09161138c1a60f6a4a5c47335 /runtime/indent/r.vim
parent8acb3d742ce68adadf1def9e1d1bb5bfd671988c (diff)
downloadrneovim-66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c.tar.gz
rneovim-66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c.tar.bz2
rneovim-66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c.zip
vim-patch:partial:dd60c365cd26 (#22437)
vim-patch:partial:dd60c365cd26 Update runtime files https://github.com/vim/vim/commit/dd60c365cd2630794be84d63c4fe287124a30b97 Co-authored-by: Bram Moolenaar <Bram@vim.org> Skip: eval.txt, repeat.txt (needs `getscriptinfo()`)
Diffstat (limited to 'runtime/indent/r.vim')
-rw-r--r--runtime/indent/r.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim
index ca85a2e62d..293dd98175 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: Sun Aug 19, 2018 09:13PM
+" Last Change: Wed Oct 26, 2022 12:04PM
" Only load this indent file when no other was loaded.
@@ -14,6 +14,8 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetRIndent()
+let b:undo_indent = "setl inde< indk<"
+
" Only define the function once.
if exists("*GetRIndent")
finish
@@ -28,7 +30,7 @@ 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*$')
+ \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\||>\)\s*$')
function s:RDelete_quotes(line)
let i = 0
@@ -359,17 +361,19 @@ function GetRIndent()
let olnum = s:Get_prev_line(lnum)
let oline = getline(olnum)
if olnum > 0
- if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
- if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ if substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum)
else
return indent(lnum) + shiftwidth()
endif
else
- if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - shiftwidth()
endif
endif
+ elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ return indent(lnum) + shiftwidth()
endif
let post_fun = 0