diff options
| -rw-r--r-- | .config/nvim/init.lua | 33 | ||||
| -rw-r--r-- | .config/nvim/lazy-lock.json | 18 | ||||
| -rw-r--r-- | .config/nvim/lua/config/lazy.lua | 30 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 93 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/gruvbox_material.lua | 15 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lspconfig.lua | 5 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lualine.lua | 9 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/treesitter.lua | 13 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/vimtex.lua | 10 | 
9 files changed, 226 insertions, 0 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..a7afba8 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,33 @@ +-- general settings +vim.opt.number = true                       -- show line numbers +vim.opt.relativenumber = true               -- relative line numbers for navigation +vim.opt.clipboard:append { 'unnamedplus' }  -- use clipboard +vim.opt.mouse = "a"                         -- enable mouse support +vim.opt.updatetime = 250                    -- Faster updates (e.g., for LSP diagnostics) +vim.opt.timeoutlen = 500                    -- Shorter timeout for key sequences +vim.opt.splitright = true                   -- vsplit opens new buffer on the right side + +-- tab and indentation settings +vim.opt.expandtab = true            -- tabs are converted to spaces +vim.opt.shiftwidth = 4              -- 4 spaces for indentation +vim.opt.tabstop = 4                 -- 4 spaces for tabs +vim.opt.softtabstop = 4             -- 4 spaces for tab key +vim.opt.autoindent = true           -- Copy indent from previous line + +-- plugin preparation +vim.opt.signcolumn = "yes"                              -- LSP diagnostics +vim.opt.termguicolors = true                            -- enable true colors +vim.opt.completeopt = { "menu", "menuone", "noselect" } -- required for nvim-cmp + +-- plugin manager (set leader key before loading lazy.nvim) +vim.g.mapleader = " "               -- Set leader to space +vim.g.maplocalleader = "\\"         -- Set local leader to backslash +require("config.lazy") + +-- load lsp's +vim.lsp.enable({ +    'lua_ls', +    'clangd', +    'pyright' +}) + diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..ad87f95 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,18 @@ +{ +  "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, +  "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, +  "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, +  "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, +  "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, +  "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, +  "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, +  "gruvbox-material": { "branch": "master", "commit": "834dbf21836862300ced7444db4262b796330ab7" }, +  "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, +  "lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" }, +  "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, +  "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, +  "nvim-lspconfig": { "branch": "master", "commit": "a844e89ea0e0e4b207ec550c3b51fb6e471881a4" }, +  "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, +  "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, +  "vimtex": { "branch": "master", "commit": "2e1bbabeb2c34bb17d7bc8cfdf8f95b16dd0db0c" } +} diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..b2f67ca --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,30 @@ +-- 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 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/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..7126173 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,93 @@ +return { +    { +        "hrsh7th/nvim-cmp", +        event = { "InsertEnter", "CmdlineEnter" }, -- Load on insert or cmdline mode +        dependencies = { +            "hrsh7th/cmp-nvim-lsp", -- LSP completion source +            "hrsh7th/cmp-buffer", -- Buffer completion source +            "hrsh7th/cmp-path", -- Path completion source +            "hrsh7th/cmp-cmdline", -- Cmdline completion source +            "L3MON4D3/LuaSnip", -- Snippet engine +            "saadparwaiz1/cmp_luasnip", -- LuaSnip completion source +            "rafamadriz/friendly-snippets", -- Predefined snippets +            "onsails/lspkind.nvim", -- Icons for completion items +        }, +        config = function() +            local cmp = require("cmp") +            local luasnip = require("luasnip") +            local lspkind = require("lspkind") + +            -- Load friendly-snippets +            require("luasnip.loaders.from_vscode").lazy_load() + +            cmp.setup { +                snippet = { +                    expand = function(args) +                        luasnip.lsp_expand(args.body) +                    end, +                }, +                mapping = cmp.mapping.preset.insert({ +                    ["<C-b>"] = cmp.mapping.scroll_docs(-4), -- Scroll up docs +                    ["<C-f>"] = cmp.mapping.scroll_docs(4), -- Scroll down docs +                    ["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion +                    ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept selection +                    ["<Tab>"] = cmp.mapping(function(fallback) +                        if cmp.visible() then +                            cmp.select_next_item() +                        elseif luasnip.expand_or_jumpable() then +                            luasnip.expand_or_jump() +                        else +                            fallback() +                        end +                    end, { "i", "s" }), +                    ["<S-Tab>"] = cmp.mapping(function(fallback) +                        if cmp.visible() then +                            cmp.select_prev_item() +                        elseif luasnip.jumpable(-1) then +                            luasnip.jump(-1) +                        else +                            fallback() +                        end +                    end, { "i", "s" }), +                }), +                sources = cmp.config.sources({ +                    { name = "nvim_lsp" }, -- LSP completions +                    { name = "luasnip" }, -- Snippet completions +                    { name = "buffer" }, -- Buffer completions +                    { name = "path" }, -- Path completions +                }), +                formatting = { +                    format = lspkind.cmp_format({ +                        mode = "symbol_text", -- Show symbol and text +                        maxwidth = 50, -- Limit width +                        ellipsis_char = "...", -- Truncation character +                    }), +                }, +                window = { +                    completion = cmp.config.window.bordered(), -- Bordered completion menu +                    documentation = cmp.config.window.bordered(), -- Bordered documentation window +                }, +                experimental = { +                    ghost_text = true, -- Show ghost text for inline completion +                }, +            } + +            -- Command-line completion for `/` and `?` +            cmp.setup.cmdline({ "/", "?" }, { +                mapping = cmp.mapping.preset.cmdline(), +                sources = { +                    { name = "buffer" }, +                }, +            }) + +            -- Command-line completion for `:` +            cmp.setup.cmdline(":", { +                mapping = cmp.mapping.preset.cmdline(), +                sources = cmp.config.sources({ +                    { name = "path" }, +                    { name = "cmdline" }, +                }), +            }) +        end, +    }, +} diff --git a/.config/nvim/lua/plugins/gruvbox_material.lua b/.config/nvim/lua/plugins/gruvbox_material.lua new file mode 100644 index 0000000..7858be6 --- /dev/null +++ b/.config/nvim/lua/plugins/gruvbox_material.lua @@ -0,0 +1,15 @@ +return { +    { +        'sainnhe/gruvbox-material', +        lazy = false, +        priority = 1000, +        config = function() +            vim.g.gruvbox_material_background = "hard"        -- hard/medium/soft +            vim.g.gruvbox_material_foreground = "material"    -- material/mix/original +            vim.g.gruvbox_material_enable_italic = true +            vim.g.gruvbox_material_disable_italic_comment = 0 +            vim.g.gruvbox_material_better_performance = 1 +            vim.cmd.colorscheme('gruvbox-material') +        end +    } +} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..4742835 --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,5 @@ +return { +    { +        "neovim/nvim-lspconfig" +    } +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..26e0f4b --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,9 @@ +return { +    { +        'nvim-lualine/lualine.nvim', +        dependencies = { 'nvim-tree/nvim-web-devicons' }, +        config = function() +            require('lualine').setup() +        end +    } +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..a6ffac9 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,13 @@ +return  { +    "nvim-treesitter/nvim-treesitter", +    build = ":TSUpdate", +    config = function() +        local configs = require("nvim-treesitter.configs") +        configs.setup({ +            ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" }, +            sync_install = false, +            highlight = { enable = true }, +            indent = { enable = true }, +        }) +    end +} diff --git a/.config/nvim/lua/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua new file mode 100644 index 0000000..f14d0ea --- /dev/null +++ b/.config/nvim/lua/plugins/vimtex.lua @@ -0,0 +1,10 @@ +return { +    { +        "lervag/vimtex", +        ft = { "tex", "bib" }, +        dependencies = { "nvim-treesitter/nvim-treesitter" }, +        config = function() +            vim.g.vimtex_view_method = "mupdf" +        end +    } +}  | 
