Problem: It's hard to avoid adding a used pattern to the search history.
Solution: Add the ":keeppatterns" modifier. (Christian Brabandt)
List the recent five entries from all histories: >
:history all -5,
+:keepp[atterns] {command} *:keepp* *:keeppatterns*
+ Execute {command}, without adding anything to the search
+ history
+
==============================================================================
2. Command-line completion *cmdline-completion*
NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM),
+EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier,
+ NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_keepalt, "keepalt", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_list, "list", ex_print,
cmdmod.keepalt = TRUE;
continue;
}
+ if (checkforcmd(&ea.cmd, "keeppatterns", 5))
+ {
+ cmdmod.keeppatterns = TRUE;
+ continue;
+ }
if (!checkforcmd(&ea.cmd, "keepjumps", 5))
break;
cmdmod.keepjumps = TRUE;
case CMD_keepalt:
case CMD_keepjumps:
case CMD_keepmarks:
+ case CMD_keeppatterns:
case CMD_leftabove:
case CMD_let:
case CMD_lockmarks:
{"keepalt", 5, FALSE},
{"keepjumps", 5, FALSE},
{"keepmarks", 3, FALSE},
+ {"keeppatterns", 5, FALSE},
{"leftabove", 5, FALSE},
{"lockmarks", 3, FALSE},
{"noautocmd", 3, FALSE},
case CMD_keepalt:
case CMD_keepjumps:
case CMD_keepmarks:
+ case CMD_keeppatterns:
case CMD_leftabove:
case CMD_lockmarks:
case CMD_rightbelow:
if (hislen == 0) /* no history */
return;
+ if (cmdmod.keeppatterns && histype == HIST_SEARCH)
+ return;
+
/*
* Searches inside the same mapping overwrite each other, so that only
* the last line is kept. Be careful not to remove a line that was moved
int keepmarks; /* TRUE when ":keepmarks" was used */
int keepjumps; /* TRUE when ":keepjumps" was used */
int lockmarks; /* TRUE when ":lockmarks" was used */
+ int keeppatterns; /* TRUE when ":keeppatterns" was used */
# ifdef FEAT_AUTOCMD
char_u *save_ei; /* saved value of 'eventignore' */
# endif
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 83,
/**/
82,
/**/