From 3f53f9071cdedc8a4164ec301829d220f2b24208 Mon Sep 17 00:00:00 2001 From: Anton Livaja Date: Tue, 4 Mar 2025 12:05:28 -0800 Subject: [PATCH] switch to using lazy nvim --- nvim/.config/nvim/init.lua | 1 + nvim/.config/nvim/init.vim | 1 - nvim/.config/nvim/lazy-lock.json | 6 ++++ nvim/.config/nvim/lua/config/lazy.lua | 35 +++++++++++++++++++ .../.config/nvim/lua/plugins/editorconfig.lua | 6 ++++ nvim/.config/nvim/lua/plugins/theme.lua | 8 +++++ nvim/.config/nvim/lua/plugins/treesitter.lua | 13 +++++++ 7 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 nvim/.config/nvim/init.lua delete mode 100644 nvim/.config/nvim/init.vim create mode 100644 nvim/.config/nvim/lazy-lock.json create mode 100644 nvim/.config/nvim/lua/config/lazy.lua create mode 100644 nvim/.config/nvim/lua/plugins/editorconfig.lua create mode 100644 nvim/.config/nvim/lua/plugins/theme.lua create mode 100644 nvim/.config/nvim/lua/plugins/treesitter.lua diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..55b8979 --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1 @@ +require("config.lazy") diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim deleted file mode 100644 index 74cd227..0000000 --- a/nvim/.config/nvim/init.vim +++ /dev/null @@ -1 +0,0 @@ -colorscheme lackluster-hack diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..9048a14 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,6 @@ +{ + "editorconfig-vim": { "branch": "master", "commit": "91bd0b0a2c6a72a110ab9feae335e1224480c233" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "nvim-treesitter": { "branch": "master", "commit": "2b0760dca2354fecf48ea35fdf1d753a232e3de2" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" } +} diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/nvim/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap 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 + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/nvim/.config/nvim/lua/plugins/editorconfig.lua b/nvim/.config/nvim/lua/plugins/editorconfig.lua new file mode 100644 index 0000000..1b59c8a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/editorconfig.lua @@ -0,0 +1,6 @@ +return { + "editorconfig/editorconfig-vim", + event = "BufReadPre", + lazy = false -- Load immediately to ensure `.editorconfig` rules apply +} + diff --git a/nvim/.config/nvim/lua/plugins/theme.lua b/nvim/.config/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..48f500b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/theme.lua @@ -0,0 +1,8 @@ +return { + "folke/tokyonight.nvim", + lazy = false, -- Load at startup + priority = 1000, -- Ensure it loads before everything else + config = function() + vim.cmd("colorscheme tokyonight") -- Apply the theme + end +} diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..f9e74f6 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,13 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua", "vim", "bash", "python", "javascript" }, -- Add needed languages + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} +