summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--editors/vi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 38ce1fdf0..f0bbc9518 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3100,6 +3100,18 @@ static void colon(char *buf)
}
len_R = strlen(R);
+ if (len_F) { // save "find" as last search pattern
+ free(last_search_pattern);
+ last_search_pattern = xstrdup(F - 1);
+ last_search_pattern[0] = '/';
+ } else if (last_search_pattern[1] == '\0') {
+ status_line_bold("No previous search");
+ goto ret;
+ } else {
+ F = last_search_pattern + 1;
+ len_F = strlen(F);
+ }
+
if (e < 0) { // no addr given
q = begin_line(dot); // start with cur line
r = end_line(dot);