diff --git a/init.lua b/init.lua index a75bc2d..f22d517 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,2 @@ -require("config") -require("plugins") +require("config.settings") +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..44ff11f --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,6 @@ +{ + "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, + "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" } +} diff --git a/lua/config/init.lua b/lua/config/init.lua deleted file mode 100644 index 33773ad..0000000 --- a/lua/config/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -require('config.settings') -require('config.keybindings') -require('config.pack') diff --git a/lua/config/keybindings.lua b/lua/config/keybindings.lua deleted file mode 100644 index 7ed1daf..0000000 --- a/lua/config/keybindings.lua +++ /dev/null @@ -1,6 +0,0 @@ --- setup leader and local leader -vim.g.mapleader = " " -vim.g.maplocalleader = ";" - --- source current file -vim.keymap.set("n", " ", ":update :source") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..b5bab23 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,45 @@ +-- 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) + +--setup lazy.nvim +require("lazy").setup({ + spec = { + -- import plugins from specific directory + { import = "plugins" }, + }, + -- setup correct colorscheme + install = { colorscheme = { "gruvbox"} }, + -- automatically check for plugin updates + checker = { enabled = true }, + rocks = { + enabled = false + }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/pack.lua b/lua/config/pack.lua deleted file mode 100644 index a24bd02..0000000 --- a/lua/config/pack.lua +++ /dev/null @@ -1,5 +0,0 @@ -vim.pack.add({ - {src = "https://github.com/ellisonleao/gruvbox.nvim"}, - {src = "https://github.com/nvim-treesitter/nvim-treesitter"}, - {src = "https://github.com/neovim/nvim-lspconfig"}, -}) diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 3fdff37..50c5be3 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -26,5 +26,6 @@ vim.opt.inccommand = "split" -- ignore case vim.opt.ignorecase = true --- disable neovim swap files -vim.opt.swapfile = false +-- setup leader and local leader +vim.g.mapleader = " " +vim.g.maplocalleader = ";" diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index f82912a..696deb4 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,2 +1,12 @@ -vim.o.background = "dark" -vim.cmd([[colorscheme gruvbox]]) +return { + { + "ellisonleao/gruvbox.nvim", + lazy = false, + priority = 1000, + config = function() + -- load colorscheme here + vim.o.background = "dark" + vim.cmd([[colorscheme gruvbox]]) + end, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index cb496ab..0000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1 +0,0 @@ -require("plugins.colorscheme") diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 22ce210..aa96f78 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,3 +1,9 @@ -vim.lsp.enable( - "nixd" -) +return { + { + "neovim/nvim-lspconfig", + config = function() + + vim.lsp.enable("nixd") + end, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index e9d94e8..e51ef9b 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,19 +1,26 @@ -require("nvim-treesitter.configs").setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "go", "nix" }, +return { + { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "go", "nix" }, - auto_install = true, + auto_install = true, - highlight = { - enable = true, + highlight = { + enable = true, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "ss", + node_incremental = "si", + scope_incremental = "sc", + node_decremental = "sd", + }, + }, + }) + end, }, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "ss", - node_incremental = "si", - scope_incremental = "sc", - node_decremental = "sd", - }, - }, -}) +} diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json deleted file mode 100644 index b6d8b78..0000000 --- a/nvim-pack-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "plugins": { - "gruvbox.nvim": { - "rev": "5e0a460", - "src": "https://github.com/ellisonleao/gruvbox.nvim" - }, - "nvim-lspconfig": { - "rev": "ac98db2", - "src": "https://github.com/neovim/nvim-lspconfig" - }, - "nvim-treesitter": { - "rev": "42fc28ba", - "src": "https://github.com/nvim-treesitter/nvim-treesitter" - } - } -} \ No newline at end of file