daeyun / vim-matlab

Neovim plugin for MATLAB
Mozilla Public License 2.0
104 stars 19 forks source link

Skip do-nothing lines #4

Closed tdy closed 8 years ago

tdy commented 8 years ago

Skip do-nothing lines instead of appending blank lines. Mainly this permits within-matrix comments as in native MATLAB.

e.g.:

%%
a = [
  1 2 3;
%  4 5 6;
  7 8 9
]

before:

>> ,a = [,1 2 3;,,7 8 9,],
 EYHUNVJKCQRT=tic;,a = [,1 2 3;,,7 8 9,],,try,toc(EYHUNVJKCQRT),catch,end,clear('EYHUNVJKCQRT');
                                |
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

after:

>> ,a = [,1 2 3;,7 8 9,],

a =

     1     2     3
     7     8     9
tdy commented 8 years ago

This could technically be extended to include , and ; in the do-nothing tuple, but that would require more contextual parsing (e.g., to make sure we're not inside a function parameter list).

daeyun commented 8 years ago

Great, thanks for the patch! 👍✨