File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1410,6 +1410,19 @@ export class EvaluationContext {
14101410 return str ( '' ) ; // TODO: Other modes
14111411 }
14121412 }
1413+ case 'nextnonblank' : {
1414+ const [ _line ] = getArgs ( 1 ) ;
1415+ const line = toInt ( _line ! ) ;
1416+ if ( line <= 0 ) {
1417+ return int ( 0 ) ;
1418+ }
1419+ for ( let i = line - 1 ; i < this . vimState ! . document . lineCount ; i ++ ) {
1420+ if ( this . vimState ! . document . lineAt ( i ) . text . length > 0 ) {
1421+ return int ( i + 1 ) ;
1422+ }
1423+ }
1424+ return int ( 0 ) ;
1425+ }
14131426 case 'or' : {
14141427 const [ x , y ] = getArgs ( 2 ) ;
14151428 // eslint-disable-next-line no-bitwise
@@ -1419,6 +1432,19 @@ export class EvaluationContext {
14191432 const [ x , y ] = getArgs ( 2 ) ;
14201433 return float ( Math . pow ( toFloat ( x ! ) , toFloat ( y ! ) ) ) ;
14211434 }
1435+ case 'prevnonblank' : {
1436+ const [ _line ] = getArgs ( 1 ) ;
1437+ const line = toInt ( _line ! ) ;
1438+ if ( line > this . vimState ! . document . lineCount ) {
1439+ return int ( 0 ) ;
1440+ }
1441+ for ( let i = line - 1 ; i >= 0 ; i -- ) {
1442+ if ( this . vimState ! . document . lineAt ( i ) . text . length > 0 ) {
1443+ return int ( i + 1 ) ;
1444+ }
1445+ }
1446+ return int ( 0 ) ;
1447+ }
14221448 // TODO: printf()
14231449 // TODO: rand()
14241450 case 'range' : {
You can’t perform that action at this time.
0 commit comments