mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
@@ -814,6 +814,16 @@ Detail:
|
|||||||
<!-- --> : -1
|
<!-- --> : -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*
|
PHP *ft-php-indent* *php-indent* *php-indenting*
|
||||||
|
|
||||||
NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
|
NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
|
||||||
|
@@ -29,7 +29,7 @@ if exists("*GetMatlabIndent") | finish | endif
|
|||||||
let s:keepcpo = &cpo
|
let s:keepcpo = &cpo
|
||||||
set cpo&vim
|
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: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:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>'
|
||||||
let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
|
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.
|
" Returns whether a comment or string envelops the specified column.
|
||||||
function! s:IsCommentOrString(lnum, col)
|
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
|
endfunction
|
||||||
|
|
||||||
" Returns whether the specified line continues on the next line.
|
" Returns whether the specified line continues on the next line.
|
||||||
@@ -105,7 +105,7 @@ function! GetMatlabIndent()
|
|||||||
else
|
else
|
||||||
" Count how many blocks the previous line opens/closes
|
" Count how many blocks the previous line opens/closes
|
||||||
" Line continuations/brackets indent once per statement
|
" 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)
|
\ + (b:MATLAB_bracketlevel ? -!curbracketlevel : !!curbracketlevel)
|
||||||
\ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc))
|
\ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc))
|
||||||
endif
|
endif
|
||||||
|
@@ -37,6 +37,7 @@ end
|
|||||||
% START_INDENT
|
% START_INDENT
|
||||||
if true
|
if true
|
||||||
A(1:end - 1)
|
A(1:end - 1)
|
||||||
|
C{1:end - 1}
|
||||||
disp foo
|
disp foo
|
||||||
end
|
end
|
||||||
% END_INDENT
|
% END_INDENT
|
||||||
@@ -49,6 +50,14 @@ disp foo
|
|||||||
disp bar
|
disp bar
|
||||||
% END_INDENT
|
% END_INDENT
|
||||||
|
|
||||||
|
% START_INDENT
|
||||||
|
if true
|
||||||
|
% end
|
||||||
|
%% end
|
||||||
|
disp foo
|
||||||
|
end
|
||||||
|
% END_INDENT
|
||||||
|
|
||||||
% START_INDENT
|
% START_INDENT
|
||||||
% INDENT_EXE let b:MATLAB_function_indent = 0
|
% INDENT_EXE let b:MATLAB_function_indent = 0
|
||||||
function foo
|
function foo
|
||||||
|
@@ -37,6 +37,7 @@ end
|
|||||||
% START_INDENT
|
% START_INDENT
|
||||||
if true
|
if true
|
||||||
A(1:end - 1)
|
A(1:end - 1)
|
||||||
|
C{1:end - 1}
|
||||||
disp foo
|
disp foo
|
||||||
end
|
end
|
||||||
% END_INDENT
|
% END_INDENT
|
||||||
@@ -49,6 +50,14 @@ A = [{
|
|||||||
disp bar
|
disp bar
|
||||||
% END_INDENT
|
% END_INDENT
|
||||||
|
|
||||||
|
% START_INDENT
|
||||||
|
if true
|
||||||
|
% end
|
||||||
|
%% end
|
||||||
|
disp foo
|
||||||
|
end
|
||||||
|
% END_INDENT
|
||||||
|
|
||||||
% START_INDENT
|
% START_INDENT
|
||||||
% INDENT_EXE let b:MATLAB_function_indent = 0
|
% INDENT_EXE let b:MATLAB_function_indent = 0
|
||||||
function foo
|
function foo
|
||||||
|
@@ -117,6 +117,7 @@ for fname in glob('testdir/*.in', 1, 1)
|
|||||||
echoerr 'Test ' . fname . ' FAILED!'
|
echoerr 'Test ' . fname . ' FAILED!'
|
||||||
else
|
else
|
||||||
exe 'write ' . root . '.out'
|
exe 'write ' . root . '.out'
|
||||||
|
echo "Test " . fname . " OK\n"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
quit! " close the indented file
|
quit! " close the indented file
|
||||||
|
Reference in New Issue
Block a user