commit ab9930d50f61a19b624f7f8606e633e4361ec26e Author: Jan Date: Mon Dec 8 13:57:15 2025 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..55b8979 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("config.lazy") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/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/lua/plugins/autotag.lua b/lua/plugins/autotag.lua new file mode 100644 index 0000000..618d9ed --- /dev/null +++ b/lua/plugins/autotag.lua @@ -0,0 +1,4 @@ +return { + "windwp/nvim-ts-autotag", + lazy = false +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..a011add --- /dev/null +++ b/lua/plugins/lspconfig.lua @@ -0,0 +1,3 @@ +return { + "neovim/nvim-lspconfig" +} diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua new file mode 100644 index 0000000..c196633 --- /dev/null +++ b/lua/plugins/luasnip.lua @@ -0,0 +1,7 @@ +return { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.4", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp" +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..bac34f3 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,73 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", -- Only load when entering insert mode for performance + dependencies = { + -- Snippet engine (REQUIRED by cmp) + { "L3MON4D3/LuaSnip", dependencies = { "saadparwaiz1/cmp_luasnip" } }, + + -- Sources for completion + "hrsh7th/cmp-nvim-lsp", -- LSP suggestions + "hrsh7th/cmp-buffer", -- Buffer words + "hrsh7th/cmp-path", -- File system paths + "hrsh7th/cmp-cmdline", -- Command line completion (if you want it) + + -- You can add more sources here, e.g., 'hrsh7th/cmp-vsnip', 'ray-x/cmp-treesitter' + }, + config = function() + -- Set up nvim-cmp + local cmp = require("cmp") + local luasnip = require("luasnip") + + cmp.setup({ + snippet = { + -- REQUIRED - sets the snippet engine nvim-cmp uses + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept selected item. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- Use to jump to the next snippet placeholder + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + -- Use to jump to the previous snippet placeholder + elseif luasnip.jump_backward() then + luasnip.jump_backward() + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- LSP suggestions + { name = "luasnip" }, -- Snippet source + }, { + { name = "buffer" }, -- Buffer words + { name = "path" }, -- File system paths + }), + }) + + -- Optional: Configure for command line completion + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, +} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 0000000..65e0235 --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,11 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +}; diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..1cb80cc --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,6 @@ +return { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + branch = 'main', + build = ':TSUpdate' +}