summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-23 22:15:25 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-23 22:15:25 +0200
commitc3328169d5566b97a6a6921067017e4369dd7cd6 (patch)
tree88ffb8f039efc23a461181aeae7b0bdf606b2404 /src/ex_cmds.c
parentc61a48d25995e5ee2a3813f64c531b91bb23e9b9 (diff)
patch 8.1.1736: viminfo support is spread outv8.1.1736
Problem: Viminfo support is spread out. Solution: Move more viminfo code to viminfo.c. (Yegappan Lakshmanan, closes #4717) Reorder code to make most functions static.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 47d1998e8a..9e093ee1b3 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5085,24 +5085,23 @@ global_exe(char_u *cmd)
}
#ifdef FEAT_VIMINFO
- int
-read_viminfo_sub_string(vir_T *virp, int force)
+/*
+ * Get the previous substitute pattern.
+ */
+ char_u *
+get_old_sub(void)
{
- if (force)
- vim_free(old_sub);
- if (force || old_sub == NULL)
- old_sub = viminfo_readstring(virp, 1, TRUE);
- return viminfo_readline(virp);
+ return old_sub;
}
+/*
+ * Set the previous substitute pattern. "val" must be allocated.
+ */
void
-write_viminfo_sub_string(FILE *fp)
+set_old_sub(char_u *val)
{
- if (get_viminfo_parameter('/') != 0 && old_sub != NULL)
- {
- fputs(_("\n# Last Substitute String:\n$"), fp);
- viminfo_writestring(fp, old_sub);
- }
+ vim_free(old_sub);
+ old_sub = val;
}
#endif // FEAT_VIMINFO