Repository: neovim/neovim
File: src/nvim/main.c (C)

Code before:
  // init.vim
  if (do_source(user_vimrc, true, DOSO_VIMRC, NULL) != FAIL) {
    do_exrc = p_exrc;
    if (do_exrc) {
      do_exrc = (path_full_compare(VIMRC_FILE, user_vimrc, false, true) != kEqualFiles);
    }
    xfree(user_vimrc);
    return do_exrc;
  }
  xfree(user_vimrc);

  char *const config_dirs = stdpaths_get_xdg_var(kXDGConfigDirs);
  if (config_dirs != NULL) {
    const char *appname = get_appname(false);
    size_t appname_len = strlen(appname);

    const void *iter = NULL;
    do {
      const char *dir;
      size_t dir_len;
      iter = vim_env_iter(':', config_dirs, iter, &dir, &dir_len);
      if (dir == NULL || dir_len == 0) {
        break;
      }

      // init.lua
      const char init_lua_suffix[] = { PATHSEP, 'i', 'n', 'i', 't', '.', 'l', 'u', 'a', NUL };
      size_t init_lua_len = dir_len + 1 + appname_len + sizeof(init_lua_suffix);
      char *init_lua = xmalloc(init_lua_len);
      memcpy(init_lua, dir, dir_len);
      init_lua[dir_len] = PATHSEP;
      memcpy(init_lua + dir_len + 1, appname, appname_len);
      memcpy(init_lua + dir_len + 1 + appname_len, init_lua_suffix, sizeof(init_lua_suffix));

      // init.vim
      const char init_vim_suffix[] = { PATHSEP, 'i', 'n', 'i', 't', '.', 'v', 'i', 'm', NUL };
      size_t init_vim_len = dir_len + 1 + appname_len + sizeof(init_vim_suffix);
      char *init_vim = xmalloc(init_vim_len);
      memcpy(init_vim, dir, dir_len);
      init_vim[dir_len] = PATHSEP;
      memcpy(init_vim + dir_len + 1, appname, appname_len);
      memcpy(init_vim + dir_len + 1 + appname_len, init_vim_suffix, sizeof(init_vim_suffix));

      if (os_path_exists(init_lua)
          && do_source(init_lua, true, DOSO_VIMRC, NULL)) {
        if (os_path_exists(init_vim)) {
          semsg(e_conflicting_configs, init_lua, init_vim);
        }

        xfree(init_vim);
        xfree(init_lua);

Review comment (suggestion):
```suggestion
      // Build: <xdg_dir>/<appname>/init.lua
```

Code after:
  // init.vim
  if (do_source(user_vimrc, true, DOSO_VIMRC, NULL) != FAIL) {
    do_exrc = p_exrc;
    if (do_exrc) {
      do_exrc = (path_full_compare(VIMRC_FILE, user_vimrc, false, true) != kEqualFiles);
    }
    xfree(user_vimrc);
    return do_exrc;
  }
  xfree(user_vimrc);

  char *const config_dirs = stdpaths_get_xdg_var(kXDGConfigDirs);
  if (config_dirs != NULL) {
    const char *appname = get_appname(false);
    size_t appname_len = strlen(appname);

    const void *iter = NULL;
    do {
      const char *dir;
      size_t dir_len;
      iter = vim_env_iter(':', config_dirs, iter, &dir, &dir_len);
      if (dir == NULL || dir_len == 0) {
        break;
      }

      // Build: <xdg_dir>/<appname>/init.lua
      const char init_lua_suffix[] = { PATHSEP, 'i', 'n', 'i', 't', '.', 'l', 'u', 'a', NUL };
      size_t init_lua_len = dir_len + 1 + appname_len + sizeof(init_lua_suffix);
      char *init_lua = xmalloc(init_lua_len);
      memcpy(init_lua, dir, dir_len);
      init_lua[dir_len] = PATHSEP;
      memcpy(init_lua + dir_len + 1, appname, appname_len);
      memcpy(init_lua + dir_len + 1 + appname_len, init_lua_suffix, sizeof(init_lua_suffix));

      // Build: <xdg_dir>/<appname>/init.vim
      const char init_vim_suffix[] = { PATHSEP, 'i', 'n', 'i', 't', '.', 'v', 'i', 'm', NUL };
      size_t init_vim_len = dir_len + 1 + appname_len + sizeof(init_vim_suffix);
      char *init_vim = xmalloc(init_vim_len);
      memcpy(init_vim, dir, dir_len);
      init_vim[dir_len] = PATHSEP;
      memcpy(init_vim + dir_len + 1, appname, appname_len);
      memcpy(init_vim + dir_len + 1 + appname_len, init_vim_suffix, sizeof(init_vim_suffix));

      if (os_path_exists(init_lua)
          && do_source(init_lua, true, DOSO_VIMRC, NULL)) {
        if (os_path_exists(init_vim)) {
          semsg(e_conflicting_configs, init_lua, init_vim);
        }

        xfree(init_vim);
        xfree(init_lua);