-- Load core configurations
require("core.options")
require("core.keymaps")
require("core.highlights")
require("core.colorcolumn")

-- Set up lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    error("Error cloning lazy.nvim:\n" .. out)
  end
end
vim.opt.rtp:prepend(lazypath)

-- Set up plugins with lazy.nvim
require("lazy").setup({
  -- Core plugins
  require("plugins.neotree"),
  require("plugins.colorscheme"),
  require("plugins.bufferline"),
  require("plugins.treesitter"),
  require("plugins.telescope"),
  require("plugins.lsp"),
  require("plugins.nvim-autopairs"),
  require("plugins.autoformatting"),
  require("plugins.gitsigns"),
  require("plugins.alpha"),
  require("plugins.indent-blank"),
  require("plugins.misc"),
  require("plugins.autocompletion"),
  require("plugins.emmet-vim"),
  require("plugins.presence"),
  -- require("plugins.ultisnips"),
  {
    -- LuaSnip Plugin
    "L3MON4D3/LuaSnip",
    dependencies = {
      "saadparwaiz1/cmp_luasnip", -- Snippet completions
    },
  },
  {
    "hrsh7th/nvim-cmp",
    dependencies = {
      "hrsh7th/cmp-buffer",       -- Buffer completions
      "hrsh7th/cmp-path",         -- Path completions
      "hrsh7th/cmp-nvim-lsp",     -- LSP completions
      "L3MON4D3/LuaSnip",         -- Snippet engine
      "saadparwaiz1/cmp_luasnip", -- Snippet completions
    },
    config = function()
      require("plugins.nvim-cmp") -- Load cmp configuration
    end,
  },
  {
    "editorconfig/editorconfig-vim",
    config = function()
      -- You can add configuration options here if needed
      -- editorconfig.nvim will work out of the box
    end,
  },
})
