Skip to content

Commit c5fdc66

Browse files
committed
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)
1 parent 6c39767 commit c5fdc66

File tree

6 files changed

+20
-0
lines changed

6 files changed

+20
-0
lines changed

runtime/doc/cmdline.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ terminals)
356356
List the recent five entries from all histories: >
357357
:history all -5,
358358
359+
:keepp[atterns] {command} *:keepp* *:keeppatterns*
360+
Execute {command}, without adding anything to the search
361+
history
362+
359363
==============================================================================
360364
2. Command-line completion *cmdline-completion*
361365

src/ex_cmds.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier,
477477
NEEDARG|EXTRA|NOTRLCOM),
478478
EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier,
479479
NEEDARG|EXTRA|NOTRLCOM),
480+
EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier,
481+
NEEDARG|EXTRA|NOTRLCOM),
480482
EX(CMD_keepalt, "keepalt", ex_wrongmodifier,
481483
NEEDARG|EXTRA|NOTRLCOM),
482484
EX(CMD_list, "list", ex_print,

src/ex_docmd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,11 @@ do_one_cmd(cmdlinep, sourcing,
18431843
cmdmod.keepalt = TRUE;
18441844
continue;
18451845
}
1846+
if (checkforcmd(&ea.cmd, "keeppatterns", 5))
1847+
{
1848+
cmdmod.keeppatterns = TRUE;
1849+
continue;
1850+
}
18461851
if (!checkforcmd(&ea.cmd, "keepjumps", 5))
18471852
break;
18481853
cmdmod.keepjumps = TRUE;
@@ -2584,6 +2589,7 @@ do_one_cmd(cmdlinep, sourcing,
25842589
case CMD_keepalt:
25852590
case CMD_keepjumps:
25862591
case CMD_keepmarks:
2592+
case CMD_keeppatterns:
25872593
case CMD_leftabove:
25882594
case CMD_let:
25892595
case CMD_lockmarks:
@@ -3089,6 +3095,7 @@ static struct cmdmod
30893095
{"keepalt", 5, FALSE},
30903096
{"keepjumps", 5, FALSE},
30913097
{"keepmarks", 3, FALSE},
3098+
{"keeppatterns", 5, FALSE},
30923099
{"leftabove", 5, FALSE},
30933100
{"lockmarks", 3, FALSE},
30943101
{"noautocmd", 3, FALSE},
@@ -3597,6 +3604,7 @@ set_one_cmd_context(xp, buff)
35973604
case CMD_keepalt:
35983605
case CMD_keepjumps:
35993606
case CMD_keepmarks:
3607+
case CMD_keeppatterns:
36003608
case CMD_leftabove:
36013609
case CMD_lockmarks:
36023610
case CMD_rightbelow:

src/ex_getln.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5498,6 +5498,9 @@ add_to_history(histype, new_entry, in_map, sep)
54985498
if (hislen == 0) /* no history */
54995499
return;
55005500

5501+
if (cmdmod.keeppatterns && histype == HIST_SEARCH)
5502+
return;
5503+
55015504
/*
55025505
* Searches inside the same mapping overwrite each other, so that only
55035506
* the last line is kept. Be careful not to remove a line that was moved

src/structs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ typedef struct
542542
int keepmarks; /* TRUE when ":keepmarks" was used */
543543
int keepjumps; /* TRUE when ":keepjumps" was used */
544544
int lockmarks; /* TRUE when ":lockmarks" was used */
545+
int keeppatterns; /* TRUE when ":keeppatterns" was used */
545546
# ifdef FEAT_AUTOCMD
546547
char_u *save_ei; /* saved value of 'eventignore' */
547548
# endif

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
83,
741743
/**/
742744
82,
743745
/**/

0 commit comments

Comments
 (0)