意外とさらっとできて便利なので貼っておく。
--- a/enter.c Mon Oct 20 11:50:38 2008 -0700 +++ b/enter.c Fri Nov 07 22:30:46 2008 +0900 @@ -549,9 +549,13 @@ } else if (flags & M_COMMAND) { + char *last_str; my_wcstombs (buf, buflen, state->wbuf, state->curpos); i = strlen (buf); - if (i && buf[i - 1] == '=' && + last_str = buf + i - 1; + while (last_str > buf && !isspace ((unsigned char) *last_str)) + last_str--; + if (i && strchr (last_str, '=') && mutt_var_value_complete (buf, buflen, i)) state->tabs = 0; else if (!mutt_command_complete (buf, buflen, i, state->tabs)) --- a/init.c Mon Oct 20 11:50:38 2008 -0700 +++ b/init.c Fri Nov 07 22:30:46 2008 +0900 @@ -2620,20 +2620,30 @@ int idx; char val[LONG_STRING]; const char *myvarval; + char *typed; strfcpy (var, pt, sizeof (var)); /* ignore the trailing '=' when comparing */ - var[mutt_strlen (var) - 1] = 0; + *(typed = strchr (var, '=')) = '\0'; + typed++; if ((idx = mutt_option_index (var)) == -1) { - if ((myvarval = myvar_get(var)) != NULL) + if ((!*typed) && (myvarval = myvar_get(var)) != NULL) { pretty_var (pt, len - (pt - buffer), var, myvarval); return 1; } - return 0; /* no such variable. */ + return 0; /* val is not empty or there's no such variable. */ } - else if (var_to_string (idx, val, sizeof (val))) + else if ((*typed) && (DTYPE(MuttVars[idx].type) == DT_PATH)) + { + if (!mutt_complete (typed, sizeof (val) - (typed - val))) + { + snprintf (pt, len - (pt - buffer), "%s=%s", var, typed); + return 1; + } + } + else if ((!*typed) && var_to_string (idx, val, sizeof (val))) { snprintf (pt, len - (pt - buffer), "%s=\"%s\"", var, val); return 1;