patch 9.1.1544: :retab cannot be limited to indentation only

Problem:  :retab cannot be limited to indentation only
Solution: add the optional -indentonly parameter
          (Hirohito Higashi)

closes: #17730

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-07-14 22:11:34 +02:00
committed by Christian Brabandt
parent e85a66a4d4
commit 836e54f5de
14 changed files with 259 additions and 133 deletions

View File

@ -2622,6 +2622,11 @@ set_context_by_cmdname(
xp->xp_pattern = arg;
break;
case CMD_retab:
xp->xp_context = EXPAND_RETAB;
xp->xp_pattern = arg;
break;
case CMD_messages:
xp->xp_context = EXPAND_MESSAGES;
xp->xp_pattern = arg;
@ -3204,6 +3209,18 @@ get_scriptnames_arg(expand_T *xp UNUSED, int idx)
}
#endif
/*
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":retab {-indentonly}" option.
*/
static char_u *
get_retab_arg(expand_T *xp UNUSED, int idx)
{
if (idx == 0)
return (char_u *)"-indentonly";
return NULL;
}
/*
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":messages {clear}" command.
@ -3294,6 +3311,7 @@ ExpandOther(
{EXPAND_BREAKPOINT, get_breakadd_arg, TRUE, TRUE},
{EXPAND_SCRIPTNAMES, get_scriptnames_arg, TRUE, FALSE},
#endif
{EXPAND_RETAB, get_retab_arg, TRUE, TRUE},
};
int i;
int ret = FAIL;