1
0
forked from aniani/vim

updated for version 7.4.083

Problem:    It's hard to avoid adding a used pattern to the search history.
Solution:   Add the ":keeppatterns" modifier. (Christian Brabandt)
This commit is contained in:
Bram Moolenaar 2013-11-09 05:30:26 +01:00
parent 8e69b4a319
commit a939e43440
6 changed files with 20 additions and 0 deletions

View File

@ -356,6 +356,10 @@ terminals)
List the recent five entries from all histories: > List the recent five entries from all histories: >
:history all -5, :history all -5,
:keepp[atterns] {command} *:keepp* *:keeppatterns*
Execute {command}, without adding anything to the search
history
============================================================================== ==============================================================================
2. Command-line completion *cmdline-completion* 2. Command-line completion *cmdline-completion*

View File

@ -477,6 +477,8 @@ EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM), NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier, EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM), NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_keepalt, "keepalt", ex_wrongmodifier, EX(CMD_keepalt, "keepalt", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM), NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_list, "list", ex_print, EX(CMD_list, "list", ex_print,

View File

@ -1843,6 +1843,11 @@ do_one_cmd(cmdlinep, sourcing,
cmdmod.keepalt = TRUE; cmdmod.keepalt = TRUE;
continue; continue;
} }
if (checkforcmd(&ea.cmd, "keeppatterns", 5))
{
cmdmod.keeppatterns = TRUE;
continue;
}
if (!checkforcmd(&ea.cmd, "keepjumps", 5)) if (!checkforcmd(&ea.cmd, "keepjumps", 5))
break; break;
cmdmod.keepjumps = TRUE; cmdmod.keepjumps = TRUE;
@ -2584,6 +2589,7 @@ do_one_cmd(cmdlinep, sourcing,
case CMD_keepalt: case CMD_keepalt:
case CMD_keepjumps: case CMD_keepjumps:
case CMD_keepmarks: case CMD_keepmarks:
case CMD_keeppatterns:
case CMD_leftabove: case CMD_leftabove:
case CMD_let: case CMD_let:
case CMD_lockmarks: case CMD_lockmarks:
@ -3089,6 +3095,7 @@ static struct cmdmod
{"keepalt", 5, FALSE}, {"keepalt", 5, FALSE},
{"keepjumps", 5, FALSE}, {"keepjumps", 5, FALSE},
{"keepmarks", 3, FALSE}, {"keepmarks", 3, FALSE},
{"keeppatterns", 5, FALSE},
{"leftabove", 5, FALSE}, {"leftabove", 5, FALSE},
{"lockmarks", 3, FALSE}, {"lockmarks", 3, FALSE},
{"noautocmd", 3, FALSE}, {"noautocmd", 3, FALSE},
@ -3597,6 +3604,7 @@ set_one_cmd_context(xp, buff)
case CMD_keepalt: case CMD_keepalt:
case CMD_keepjumps: case CMD_keepjumps:
case CMD_keepmarks: case CMD_keepmarks:
case CMD_keeppatterns:
case CMD_leftabove: case CMD_leftabove:
case CMD_lockmarks: case CMD_lockmarks:
case CMD_rightbelow: case CMD_rightbelow:

View File

@ -5498,6 +5498,9 @@ add_to_history(histype, new_entry, in_map, sep)
if (hislen == 0) /* no history */ if (hislen == 0) /* no history */
return; return;
if (cmdmod.keeppatterns && histype == HIST_SEARCH)
return;
/* /*
* Searches inside the same mapping overwrite each other, so that only * 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 * the last line is kept. Be careful not to remove a line that was moved

View File

@ -542,6 +542,7 @@ typedef struct
int keepmarks; /* TRUE when ":keepmarks" was used */ int keepmarks; /* TRUE when ":keepmarks" was used */
int keepjumps; /* TRUE when ":keepjumps" was used */ int keepjumps; /* TRUE when ":keepjumps" was used */
int lockmarks; /* TRUE when ":lockmarks" was used */ int lockmarks; /* TRUE when ":lockmarks" was used */
int keeppatterns; /* TRUE when ":keeppatterns" was used */
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
char_u *save_ei; /* saved value of 'eventignore' */ char_u *save_ei; /* saved value of 'eventignore' */
# endif # endif

View File

@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
83,
/**/ /**/
82, 82,
/**/ /**/