peter-bread / peter.nvim

My Neovim Config
1 stars 0 forks source link

Merging Test #23

Open peter-bread opened 3 weeks ago

peter-bread commented 3 weeks ago

Test out looping through files in a directory and using vim.tbl_deep_extend to merge them, e.g. some lsp configs and formatter setup (using vim.list_extend).

If this works, then I can use vim.g to store configs for plugins and also mirror the opts merging from lazy.nvim to potentially be used with vim plug.

peter-bread commented 2 weeks ago
local t1 = {
  servers = {
    lua_ls = {
      inlay_hints = true,
    },
    vtsls = {},
  },
}

local t2 = {
  servers = {
    gopls = {},
    lua_ls = {
      inlay_hints = false,
    },
  },
}

local t3 = vim.tbl_deep_extend("force", t1, t2)

print(vim.inspect(t1))
print(vim.inspect(t2))
print(vim.inspect(t3))
-- t1
{
  servers = {
    lua_ls = {
      inlay_hints = true
    },
    vtsls = {}
  }
}

-- t2
{
  servers = {
    gopls = {},
    lua_ls = {
      inlay_hints = false
    }
  }
}

-- t3
{
  servers = {
    gopls = {},
    lua_ls = {
      inlay_hints = false
    },
    vtsls = {}
  }
}