diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0a65cde..89e6f7e 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,24 +1,35 @@ { + "LuaSnip": { "branch": "master", "commit": "21f74f7ba8c49f95f9d7c8293b147c2901dd2d3a" }, "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" }, "fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" }, + "fzf.vim": { "branch": "master", "commit": "879db51d0965515cdaef9b7f6bdeb91c65d2829e" }, "github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" }, + "lazygit.nvim": { "branch": "main", "commit": "0a1ec57f91ecc9c5e97fb26edb2574cf8b13c7cc" }, + "lsp_signature.nvim": { "branch": "master", "commit": "62cadce83aaceed677ffe7a2d6a57141af7131ea" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" }, "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lspconfig": { "branch": "master", "commit": "408cf07b97535825cca6f1afa908d98348712ba6" }, + "nvim-dap": { "branch": "master", "commit": "7523676a4be17644587aa47e4d42f6f7646d4727" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, + "nvim-lightbulb": { "branch": "master", "commit": "aa3a8b0f4305b25cfe368f6c9be9923a7c9d0805" }, + "nvim-lspconfig": { "branch": "master", "commit": "7de54fc6cae5080a656329a9c2f2dff03d914cdd" }, "nvim-tree.lua": { "branch": "master", "commit": "321bc61580fd066b76861c32de3319c3a6d089e7" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" }, + "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "vim-highlighter": { "branch": "main", "commit": "b12fa20268cf838ac18e295eb408d0112cf0e855" }, - "vim-wakatime": { "branch": "master", "commit": "ecba6015dd9a8c7657583efcdcd95c362e5ed20b" }, + "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/nvim/lua/zinn/init.lua b/nvim/lua/zinn/init.lua index a94c286..6c5c6f0 100644 --- a/nvim/lua/zinn/init.lua +++ b/nvim/lua/zinn/init.lua @@ -1,4 +1,7 @@ require("zinn.lazy") require("zinn.options") +vim.keymap.set("n", "", ":NvimTreeToggle", { silent = true }) + + vim.cmd("colorscheme github_dark_high_contrast") diff --git a/nvim/lua/zinn/lazy.lua b/nvim/lua/zinn/lazy.lua index 4447ee2..ca57491 100644 --- a/nvim/lua/zinn/lazy.lua +++ b/nvim/lua/zinn/lazy.lua @@ -22,8 +22,8 @@ require("lazy").setup({ version = false }, spec = { - - { import = "zinn.plugins" } + { import = "zinn.plugins" }, + {'junegunn/fzf.vim'}, }, performance = { rtp = { diff --git a/nvim/lua/zinn/plugins/lsp-ui.lua b/nvim/lua/zinn/plugins/lsp-ui.lua new file mode 100644 index 0000000..361afcf --- /dev/null +++ b/nvim/lua/zinn/plugins/lsp-ui.lua @@ -0,0 +1,62 @@ +return { + -- Enhanced LSP UI + { + "j-hui/fidget.nvim", + opts = {}, + }, + -- Improved diagnostics display + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, + }, + -- Signature help + { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = {}, + config = function(_, opts) require'lsp_signature'.setup(opts) end + }, + -- Lightbulb for code actions + { + "kosayoda/nvim-lightbulb", + config = function() + require("nvim-lightbulb").setup({ + autocmd = { enabled = true } + }) + end, + }, +} \ No newline at end of file diff --git a/nvim/lua/zinn/plugins/lsp.lua b/nvim/lua/zinn/plugins/lsp.lua index a8831dd..ba1dd43 100644 --- a/nvim/lua/zinn/plugins/lsp.lua +++ b/nvim/lua/zinn/plugins/lsp.lua @@ -1,54 +1,50 @@ return { - -- LSP Configuration { - "neovim/nvim-lspconfig", + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", dependencies = { - -- LSP Management "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - - -- Optional but recommended - "hrsh7th/nvim-cmp", -- Completion engine - "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp - "j-hui/fidget.nvim", -- LSP status updates - "folke/neodev.nvim", -- Additional Lua configuration + "neovim/nvim-lspconfig", }, config = function() - -- Setup language servers + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "ts_ls", + "html", + "cssls", + "gopls", + "rust_analyzer", + }, + }) + end, + }, + { + "neovim/nvim-lspconfig", + dependencies = { "williamboman/mason-lspconfig.nvim" }, + config = function() local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").default_capabilities() - -- Configure each language server - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - checkThirdParty = false, - }, - telemetry = { - enable = false, - }, - }, - }, - }) + local servers = { "lua_ls", "ts_ls", "html", "cssls", "gopls", "rust_analyzer" } - -- Add more language servers - lspconfig.pyright.setup({ - capabilities = capabilities, - }) + for _, server_name in ipairs(servers) do + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end - -- Add keybindings for LSP functions vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) local opts = { buffer = ev.buf, noremap = true, silent = true } - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) @@ -60,33 +56,4 @@ return { }) end, }, - { - "williamboman/mason.nvim", - config = function() - require("mason").setup() - end, - }, - { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup({ - ensure_installed = { - -- Add the language servers you want to auto-install - "lua_ls", - "pyright", - "ts_ls" - }, - }) - end, - }, - -- Optional: Add nvim-cmp and its sources - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - -- Add other sources as needed - }, - }, -} \ No newline at end of file +} diff --git a/nvim/lua/zinn/plugins/mason-lsp.lua b/nvim/lua/zinn/plugins/mason-lsp.lua deleted file mode 100644 index b06150d..0000000 --- a/nvim/lua/zinn/plugins/mason-lsp.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - { - "williamboman/mason.nvim", - config = function() - require("mason").setup({ - ui = { - border = "rounded", -- Nice UI borders - }, - }) - end, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { - "williamboman/mason.nvim", - "neovim/nvim-lspconfig", - }, - config = function() - local mason_lspconfig = require("mason-lspconfig") - - mason_lspconfig.setup({ - ensure_installed = { - -- "ts_ls", -- Typescript - -- "html", -- HTML - -- "cssls", -- CSS - -- "gopls", -- Go - -- "clangd", -- C++/C - -- "lua_ls", -- Lua - }, - automatic_installation = true, - }) - end, - }, - { - "neovim/nvim-lspconfig", -- Core LSP config - dependencies = { "williamboman/mason.nvim" }, - }, -} diff --git a/nvim/lua/zinn/plugins/mvim-cmp.lua b/nvim/lua/zinn/plugins/mvim-cmp.lua deleted file mode 100644 index 9bac70c..0000000 --- a/nvim/lua/zinn/plugins/mvim-cmp.lua +++ /dev/null @@ -1,20 +0,0 @@ -return { --- -- In the config function of nvim-cmp --- config = function() --- local cmp = require("cmp") --- --- cmp.setup({ --- mapping = cmp.mapping.preset.insert({ --- [""] = cmp.mapping.complete(), --- [""] = cmp.mapping.confirm({ select = true }), --- [""] = cmp.mapping.select_next_item(), --- [""] = cmp.mapping.select_prev_item(), --- }), --- sources = cmp.config.sources({ --- { name = "nvim_lsp" }, --- { name = "buffer" }, --- { name = "path" }, --- }), --- }) --- end -} diff --git a/nvim/lua/zinn/plugins/nvim-cmp.lua b/nvim/lua/zinn/plugins/nvim-cmp.lua new file mode 100644 index 0000000..98e99bb --- /dev/null +++ b/nvim/lua/zinn/plugins/nvim-cmp.lua @@ -0,0 +1,88 @@ +return { + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind.nvim", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + 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 }), + [""] = 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" }), + [""] = 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" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) + + -- Use buffer source for `/` and `?` + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" } + } + }) + + -- Use cmdline & path source for `:` + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" } + }, { + { name = "cmdline" } + }) + }) + end, + } +} diff --git a/nvim/lua/zinn/plugins/nvim-dap.lua b/nvim/lua/zinn/plugins/nvim-dap.lua new file mode 100644 index 0000000..b5fa879 --- /dev/null +++ b/nvim/lua/zinn/plugins/nvim-dap.lua @@ -0,0 +1,49 @@ +return { + { + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + }, + config = function() end, + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap" }, + config = function() end, + }, + { + "mxsdev/nvim-dap-vscode-js", + dependencies = { "mfussenegger/nvim-dap" }, + config = function() + require('dap-vscode-js').setup({ + debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug", + adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, + }) + + for _, language in ipairs({ "typescript", "javascript" }) do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, + } + end + end, + }, + { + "mfussenegger/nvim-dap", + keys = { + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "do", function() require("dap").step_over() end, desc = "Step Over" }, + { "dO", function() require("dap").step_out() end, desc = "Step Out" }, + { "dr", function() require("dap").repl.open() end, desc = "Open Repl" }, + { "dl", function() require("dap").run_last() end, desc = "Run Last" }, + }, + }, +} \ No newline at end of file