option: Add current directory to &backupdir option

Fixes #3496
This commit is contained in:
ZyX
2015-10-29 00:28:44 +03:00
parent dc8b0c47b1
commit 0bcc2bf126
2 changed files with 7 additions and 3 deletions

View File

@@ -685,9 +685,13 @@ void set_init_1(void)
#endif
false);
char *backupdir = stdpaths_user_data_subpath("backup", 0);
const size_t backupdir_len = strlen(backupdir);
backupdir = xrealloc(backupdir, backupdir_len + 3);
memmove(backupdir + 2, backupdir, backupdir_len + 1);
memmove(backupdir, ".,", 2);
set_string_default("viewdir", stdpaths_user_data_subpath("view", 0), true);
set_string_default("backupdir", stdpaths_user_data_subpath("backup", 0),
true);
set_string_default("backupdir", backupdir, true);
set_string_default("directory", stdpaths_user_data_subpath("swap", 2), true);
set_string_default("undodir", stdpaths_user_data_subpath("undo", 0), true);
// Set default for &runtimepath. All necessary expansions are performed in