From 1f1479385b90678d6e4ff3b0f7b6294081102724 Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Tue, 20 May 2025 20:56:11 -0600 Subject: [PATCH] adapted config to latest version --- .gitignore | 1 - lazy-lock.json | 30 +++++++++++++++++ lua/config/lazy.lua | 7 ++-- lua/config/mappings.lua | 63 ++++++++++++++++-------------------- lua/config/plugins/cmp.lua | 59 +++++++++++++++++---------------- lua/config/plugins/lsp.lua | 2 -- lua/config/plugins/mason.lua | 9 ------ lua/config/settings.lua | 2 +- lua/plugins/autopairs.lua | 17 ++++++++++ lua/plugins/autosave.lua | 20 ------------ lua/plugins/cmp.lua | 44 ++----------------------- lua/plugins/lspconfig.lua | 25 +------------- lua/plugins/mason.lua | 23 +++++++++++++ lua/plugins/nonels.lua | 14 -------- lua/plugins/telescope.lua | 1 + lua/plugins/ui.lua | 43 +++++++----------------- 16 files changed, 146 insertions(+), 214 deletions(-) create mode 100644 lazy-lock.json delete mode 100644 lua/config/plugins/lsp.lua delete mode 100644 lua/config/plugins/mason.lua create mode 100644 lua/plugins/autopairs.lua delete mode 100644 lua/plugins/autosave.lua create mode 100644 lua/plugins/mason.lua delete mode 100644 lua/plugins/nonels.lua diff --git a/.gitignore b/.gitignore index f274119..9bbbeea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ .luarc.json -lazy-lock.json diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..330f166 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c1851d5c519611dfc451b6582961b2602e0af89b" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ce0e87c0be12e7c48296a7513e90430e3eac7f24" }, + "mason.nvim": { "branch": "main", "commit": "9eaedb864cdadc29c6eb7d761a6c0d8aee26c91b" }, + "neo-tree.nvim": { "branch": "main", "commit": "56f383aa157f1ff20a59154907cc5f9fe26e4db9" }, + "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "pywal16.nvim": { "branch": "main", "commit": "0e9f3878c6f9fe8adaf7884cd7da871b9abb2447" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 1132bdd..ff9a50c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -27,9 +27,6 @@ require("lazy").setup({ -- 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 = { "neopywal" } }, - -- automatically check for plugin updates - checker = { enabled = false }, + install = { colorscheme = { "pywal16" } }, + checker = { enabled = true }, }) diff --git a/lua/config/mappings.lua b/lua/config/mappings.lua index a2e2780..d858e25 100644 --- a/lua/config/mappings.lua +++ b/lua/config/mappings.lua @@ -1,49 +1,40 @@ local map = vim.keymap.set --- Set mapleader -vim.g.mapleader = " " - -- Disable arrow keys in normal, visual, and insert modes. local keys = { "", "", "", "" } for _, key in ipairs(keys) do map({ "n", "i", "v" }, key, "", { noremap = true, silent = true }) end --- Toggle spellcheck (When working with LaTeX/Typst) -local spelllangs = {"es_mx", "en_us"} -local current_index = 1 - -function ToggleSpell() - vim.o.spelllang = spelllangs[current_index] - vim.o.spell = not vim.o.spell - print("Spellcheck " .. (vim.o.spell and "enabled" or "disabled") .. ": " .. spelllangs[current_index]) -end - -map("n", "ts", ":lua ToggleSpell()", { noremap = true, silent = true }) - --- Toggle spellcheck language. -function ToggleSpellLang() - current_index = (current_index % #spelllangs) + 1 - vim.o.spelllang = spelllangs[current_index] - print("Spelllang: " .. spelllangs[current_index]) -end - -map("n", "sp", ":lua ToggleSpellLang()", { noremap = true, silent = true }) - --- Open terminal -map("n", "t", "8split | terminal", { noremap = true, silent = true }) - -- Neotree -map("n", "", "Neotree toggle", { desc = "open neotree"}) +map("n", "", "Neotree toggle", { desc = "Open neotree"}) -- Telescope -map("n", "", "Telescope find_files", { desc = "telescope find files" }) -map("n", "", "Telescope live_grep", { desc = "telescope live grep" }) +map("n", "", "Telescope find_files", { desc = "Telescope: Find files" }) +map("n", "", "Telescope live_grep", { desc = "Telescope: Live grep" }) --- Nonels -map("n", "gf", vim.lsp.buf.format, {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local opts = { buffer = ev.buf } + local tele = require("telescope.builtin") --- LSP Stuff -map('n', 'K', vim.lsp.buf.hover, {}) -map('n', 'gd', vim.lsp.buf.definition, {}) -map({'n', 'v'}, 'ca', vim.lsp.buf.code_action, {}) + -- LSP + map("n", "gd", tele.lsp_definitions, vim.tbl_extend("force", opts, { desc = "Goto Definition" })) + map("n", "fs", tele.lsp_document_symbols, vim.tbl_extend("force", opts, { desc = "Doc Symbols" })) + map("n", "fS", tele.lsp_dynamic_workspace_symbols, vim.tbl_extend("force", opts, { desc = "Dynamic Symbols" })) + map("n", "ft", tele.lsp_type_definitions, vim.tbl_extend("force", opts, { desc = "Goto Type" })) + map("n", "fr", tele.lsp_references, vim.tbl_extend("force", opts, { desc = "Goto References" })) + map("n", "fi", tele.lsp_implementations, vim.tbl_extend("force", opts, { desc = "Goto Impl" })) + + map("n", "K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover" })) + map("n", "e", vim.diagnostic.open_float, vim.tbl_extend("force", opts, { desc = "Diagnostic" })) + map("n", "k", vim.lsp.buf.signature_help, vim.tbl_extend("force", opts, { desc = "Sig Help" })) + map("n", "rn", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename" })) + map("n", "ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" })) + map("n", "wf", vim.lsp.buf.format, vim.tbl_extend("force", opts, { desc = "Format" })) + + -- Visual mode code action + map("v", "ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" })) + end, +}) diff --git a/lua/config/plugins/cmp.lua b/lua/config/plugins/cmp.lua index b8f9866..690e54d 100644 --- a/lua/config/plugins/cmp.lua +++ b/lua/config/plugins/cmp.lua @@ -1,30 +1,33 @@ - local cmp = require'cmp' - require("luasnip.loaders.from_vscode").lazy_load() +local cmp = require'cmp' +require("luasnip.loaders.from_vscode").lazy_load() - cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. - { name = 'nvim_lua' }, - -- { name = 'buffer' }, - { name = 'path' }, - { name = 'nvim_lsp_signature_help' }, - -- { name = 'cmdline' }, - }) +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + { name = 'nvim_lua' }, + -- { name = 'buffer' }, + { name = 'path' }, + { name = 'nvim_lsp_signature_help' }, + -- { name = 'cmdline' }, }) +}) diff --git a/lua/config/plugins/lsp.lua b/lua/config/plugins/lsp.lua deleted file mode 100644 index e7b4600..0000000 --- a/lua/config/plugins/lsp.lua +++ /dev/null @@ -1,2 +0,0 @@ -local lspconfig = require("lspconfig") -lspconfig.lua_ls.setup({}) diff --git a/lua/config/plugins/mason.lua b/lua/config/plugins/mason.lua deleted file mode 100644 index 3e5e15f..0000000 --- a/lua/config/plugins/mason.lua +++ /dev/null @@ -1,9 +0,0 @@ -ui = { - icons = { - package_installed = "", - package_pending = "", - package_uninstalled = "" - } -} - -max_concurrent_installers = 10 diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 282008a..9974e13 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -29,7 +29,6 @@ o.showmatch = true o.inccommand = "split" o.splitright = true o.splitbelow = true -o.termguicolors = true o.updatetime = 250 o.ignorecase = true o.incsearch = true @@ -45,3 +44,4 @@ g.loaded_node_provider = 0 g.loaded_python3_provider = 0 g.loaded_perl_provider = 0 g.loaded_ruby_provider = 0 + diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 0000000..0766b8c --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,17 @@ +return { + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = { + fast_wrap = {}, + disable_filetype = { "TelescopePrompt", "vim" }, + map_cr = true, + }, + config = function(opts) + require("nvim-autopairs").setup(opts) + local cmp_autopairs = require "nvim-autopairs.completion.cmp" + local cmp = require('cmp') + require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end + } +} diff --git a/lua/plugins/autosave.lua b/lua/plugins/autosave.lua deleted file mode 100644 index 655002f..0000000 --- a/lua/plugins/autosave.lua +++ /dev/null @@ -1,20 +0,0 @@ -return { - { - "okuuva/auto-save.nvim", - version = '^1.0.0', - cmd = "ASToggle", - event = { "InsertLeave", "TextChanged" }, - opts = { - enabled = true, - trigger_events = { - immediate_save = { - { "BufLeave", pattern = { "*.typ", "*.tex" } } - }, - defer_save = { - { "BufLeave", pattern = { "*.typ", "*.tex"} } - }, - cancel_deferred_save = { "InsertEnter" }, - }, - } - } -} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 81e88b6..3c26641 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -7,21 +7,6 @@ return { { "hrsh7th/cmp-cmdline" }, { "hrsh7th/cmp-path" }, { "hrsh7th/cmp-buffer" }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = { - fast_wrap = {}, - disable_filetype = { "TelescopePrompt", "vim" }, - map_cr = true, - }, - config = function(opts) - require("nvim-autopairs").setup(opts) - local cmp_autopairs = require "nvim-autopairs.completion.cmp" - local cmp = require('cmp') - require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end - }, }, opts = function() require "config.plugins.cmp" @@ -30,40 +15,15 @@ return { { "hrsh7th/cmp-nvim-lsp", dependencies = {}, - config = function () + config = function() local lspconfig = require('lspconfig') local capabilities = require('cmp_nvim_lsp').default_capabilities() - - lspconfig.lua_ls.setup({ - capabilities = capabilities, - }) - lspconfig.clangd.setup({ - capabilities = capabilities, - }) - lspconfig.tinymist.setup({ - capabilities = capabilities, - }) - lspconfig.texlab.setup({ - capabilities = capabilities, - }) - lspconfig.cssls.setup({ - capabilities = capabilities, - }) - lspconfig.html.setup({ - capabilities = capabilities, - }) - lspconfig.pyright.setup({ - capabilities = capabilities, - }) - lspconfig.arduino_language_server.setup({ - capabilities = capabilities, - }) end, }, { "L3MON4D3/LuaSnip", dependencies = { - "saadparwaiz1/cmp_luasnip", + "saadparwaiz1/cmp_luasnip", "rafamadriz/friendly-snippets" }, opts = {} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index a80ab28..daa3bd6 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -3,30 +3,7 @@ return { "neovim/nvim-lspconfig", dependencies= {}, config = function() - require "config.plugins.lsp" + local lspconfig = require("lspconfig") end, }, - { - "williamboman/mason.nvim", - dependencies = {}, - opts = function () - require "config.plugins.mason" - end - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = {}, - config = function() - require("mason-lspconfig").setup { - ensure_installed = { - "lua_ls", - "tinymist", - "arduino_language_server", - "pylsp", - "texlab", - "clangd" - }, - } - end, - } } diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..e02cd38 --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,23 @@ +return { + { + "mason-org/mason.nvim", + opts = { + ui = { + icons = { + package_installed = "󰏖", + package_pending = "󰏗", + package_uninstalled = "󱧖" + } + } + } + }, + { + "mason-org/mason-lspconfig.nvim", + dependencies = { + "neovim/nvim-lspconfig", + }, + opts = { + automatic_enable = true + }, + }, +} diff --git a/lua/plugins/nonels.lua b/lua/plugins/nonels.lua deleted file mode 100644 index e480c5b..0000000 --- a/lua/plugins/nonels.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - "nvimtools/none-ls.nvim", - config = function() - local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.completion.spell, - }, - }) - end, - }, -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 058aab6..cae381f 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -18,3 +18,4 @@ return { end, } } + diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 9c69b0b..782f69b 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -5,61 +5,40 @@ return { }, { "folke/tokyonight.nvim", - priority = 1000, - opts = { - transparent = false, - styles = { - sidebars = "transparent", - floats = "transparent", - }, - }, + opts = {} }, { "norcalli/nvim-colorizer.lua", - opts = { - 'css'; - 'javascript'; - html = { - mode = 'foreground'; - } - } + opts = { 'css'; 'javascript'; html = {mode = 'foreground';} }, }, { - -- Lua status-bar "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, opts = { options = { icons_enabled = true, theme = 'pywal16-nvim', - component_separators = { left = "|", right = "|"}, - section_separators = { left = "", right = ""}, - } + component_separators = { left = "|", right = "|" }, + section_separators = { left = "", right = "" }, + }, } }, { - 'akinsho/bufferline.nvim', + "akinsho/bufferline.nvim", version = "*", - dependencies = {'nvim-tree/nvim-web-devicons'}, + dependencies = { "nvim-tree/nvim-web-devicons" }, opts = { options = { mode = "buffers", diagnostics = "nvim_lsp", offsets = { - { - filetype = "neo-tree", - text = "File Explorer", - text_align = "center", - separator = true + { + filetype = "neo-tree", text = "File Explorer", + text_align = "center", separator = true } }, themable = false, }, - } - }, - { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPost", "BufNewFile" }, - opts = {} + }, }, }