Hi Bram, I attach a small patch which adds count for zr and zm normal commands. It also adds a check to not go beyond the maximal fold level with zr.
Best regards, Marcin -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 6ae2ff8..20017d3 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -365,7 +365,7 @@ zX Undo manually opened and closed folds: re-apply 'foldlevel'. Also forces recomputing folds, like |zx|. *zm* -zm Fold more: Subtract one from 'foldlevel'. If 'foldlevel' was +zm Fold more: Subtract |v:count1| from 'foldlevel'. If 'foldlevel' was already zero nothing happens. 'foldenable' will be set. @@ -374,7 +374,7 @@ zM Close all folds: set 'foldlevel' to 0. 'foldenable' will be set. *zr* -zr Reduce folding: Add one to 'foldlevel'. +zr Reduce folding: Add |v:count1| to 'foldlevel'. *zR* zR Open all folds. This sets 'foldlevel' to highest fold level. diff --git a/src/normal.c b/src/normal.c index 74a001e..311f1cf 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4750,6 +4750,7 @@ nv_zet(cap) long n; colnr_T col; int nchar = cap->nchar; + int d; #ifdef FEAT_FOLDING long old_fdl = curwin->w_p_fdl; int old_fen = curwin->w_p_fen; @@ -5098,7 +5099,11 @@ dozet: /* "zm": fold more */ case 'm': if (curwin->w_p_fdl > 0) - --curwin->w_p_fdl; + { + curwin->w_p_fdl -= cap->count1; + if (curwin->w_p_fdl < 0) + curwin->w_p_fdl = 0; + } old_fdl = -1; /* force an update */ curwin->w_p_fen = TRUE; break; @@ -5110,7 +5115,10 @@ dozet: break; /* "zr": reduce folding */ - case 'r': ++curwin->w_p_fdl; + case 'r': curwin->w_p_fdl += cap->count1; + d = getDeepestNesting(); + if (curwin->w_p_fdl >= d) + curwin->w_p_fdl = d; break; /* "zR": open all folds */
signature.asc
Description: Digital signature