option,main: Partial support of XDG base directory specification

- Add functions that are able to query XDG.
- Replace defaults for
  - &runtimepath. Does not follow #78.
  - &viewdir.
  - &undodir.
  - &directory.
  - &backupdir. Does not follow #78.
  - vimrc location.
- Remove user vimrc file line from :version message.
This commit is contained in:
Keerthan Jaic
2015-08-04 21:41:38 -04:00
committed by ZyX
parent e38cbb9367
commit c2dd07448f
8 changed files with 125 additions and 69 deletions

View File

@@ -301,6 +301,15 @@ static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview",
# include "option.c.generated.h"
#endif
static void set_runtimepath_default(void)
{
garray_T rtp_ga;
ga_init(&rtp_ga, (int)sizeof(const char *), 1);
GA_APPEND(const char *, &rtp_ga, get_user_conf_dir());
GA_APPEND(const char *, &rtp_ga, concat_fnames(get_user_conf_dir(), "after", true));
set_string_default("runtimepath", ga_concat_strings(&rtp_ga));
}
/*
* Initialize the options, first part.
*
@@ -437,6 +446,12 @@ void set_init_1(void)
"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
);
set_string_default("viewdir", (char_u *)get_from_user_data("view"));
set_string_default("backupdir", (char_u *)get_from_user_data("backup"));
set_string_default("directory", (char_u *)get_from_user_data("swap"));
set_string_default("undodir", (char_u *)get_from_user_data("undo"));
set_runtimepath_default();
/*
* Set all the options (except the terminal options) to their default
* value. Also set the global value for local options.