aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-24 20:48:01 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-27 09:21:31 -0400
commitd227c22f00db4c3688fbc83266fa43f0adf992cc (patch)
tree17ba865d581069a51aea59b3284e027eeaa08d90
parent527d108223e50c3fab034b582c102475b16c016e (diff)
downloadrneovim-d227c22f00db4c3688fbc83266fa43f0adf992cc.tar.gz
rneovim-d227c22f00db4c3688fbc83266fa43f0adf992cc.tar.bz2
rneovim-d227c22f00db4c3688fbc83266fa43f0adf992cc.zip
vim-patch:32b364fcc097
Runtime file updates. https://github.com/vim/vim/commit/32b364fcc09749f35adb441b81291e1e5946dbc2
-rw-r--r--runtime/doc/indent.txt10
-rw-r--r--runtime/indent/matlab.vim6
-rw-r--r--runtime/indent/testdir/matlab.in9
-rw-r--r--runtime/indent/testdir/matlab.ok9
-rw-r--r--runtime/indent/testdir/runtest.vim1
5 files changed, 32 insertions, 3 deletions
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index 21f70d0947..4113564169 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -814,6 +814,16 @@ Detail:
<!-- --> : -1
+MATLAB *ft-matlab-indent* *matlab-indent* *matlab-indenting*
+
+The setting Function indenting format in MATLAB Editor/Debugger Language
+Preferences corresponds to: >
+ :let g:MATLAB_function_indent = {0, 1 or 2 (default)}
+
+Where 0 is for Classic, 1 for Indent nested functions and 2 for Indent all
+functions.
+
+
PHP *ft-php-indent* *php-indent* *php-indenting*
NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim
index d2818a18ea..6390445c60 100644
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -29,7 +29,7 @@ if exists("*GetMatlabIndent") | finish | endif
let s:keepcpo = &cpo
set cpo&vim
-let s:end = '\<end\>\%([^(]*)\)\@!' " Array indexing heuristic
+let s:end = '\<end\>\%([^({]*[)}]\)\@!' " Array indexing heuristic
let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration'
let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>'
let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
@@ -38,7 +38,7 @@ let s:zflag = has('patch-7.4.984') ? 'z' : ''
" Returns whether a comment or string envelops the specified column.
function! s:IsCommentOrString(lnum, col)
- return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString'
+ return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabCellComment\|matlabString'
endfunction
" Returns whether the specified line continues on the next line.
@@ -105,7 +105,7 @@ function! GetMatlabIndent()
else
" Count how many blocks the previous line opens/closes
" Line continuations/brackets indent once per statement
- let result = indent(prevlnum) + shiftwidth() * (open - close
+ let result = (prevlnum > 0) * indent(prevlnum) + shiftwidth() * (open - close
\ + (b:MATLAB_bracketlevel ? -!curbracketlevel : !!curbracketlevel)
\ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc))
endif
diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in
index 5bba1a56dd..b997ec8d57 100644
--- a/runtime/indent/testdir/matlab.in
+++ b/runtime/indent/testdir/matlab.in
@@ -37,6 +37,7 @@ end
% START_INDENT
if true
A(1:end - 1)
+C{1:end - 1}
disp foo
end
% END_INDENT
@@ -50,6 +51,14 @@ disp bar
% END_INDENT
% START_INDENT
+if true
+% end
+%% end
+disp foo
+end
+% END_INDENT
+
+% START_INDENT
% INDENT_EXE let b:MATLAB_function_indent = 0
function foo
disp foo
diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok
index b1112263b2..df4e7b2e33 100644
--- a/runtime/indent/testdir/matlab.ok
+++ b/runtime/indent/testdir/matlab.ok
@@ -37,6 +37,7 @@ end
% START_INDENT
if true
A(1:end - 1)
+ C{1:end - 1}
disp foo
end
% END_INDENT
@@ -50,6 +51,14 @@ disp bar
% END_INDENT
% START_INDENT
+if true
+ % end
+ %% end
+ disp foo
+end
+% END_INDENT
+
+% START_INDENT
% INDENT_EXE let b:MATLAB_function_indent = 0
function foo
disp foo
diff --git a/runtime/indent/testdir/runtest.vim b/runtime/indent/testdir/runtest.vim
index 945c2753e9..6bbd33cacd 100644
--- a/runtime/indent/testdir/runtest.vim
+++ b/runtime/indent/testdir/runtest.vim
@@ -117,6 +117,7 @@ for fname in glob('testdir/*.in', 1, 1)
echoerr 'Test ' . fname . ' FAILED!'
else
exe 'write ' . root . '.out'
+ echo "Test " . fname . " OK\n"
endif
quit! " close the indented file