diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-02-08 11:49:10 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-02-08 11:49:10 +0100 |
| commit | 9b9eab0b94e1aa7202226002d8774603677d23ba (patch) | |
| tree | c6b9f4d4485d0873553bf324a976b7691aa70667 /lua | |
| parent | 0f181056a80d84e71f402b4d202c68c0212e215a (diff) | |
✨feat: add LSP and IDEish plugins
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/config/mappings.lua | 24 | ||||
| -rw-r--r-- | lua/plugins/completions.lua | 52 | ||||
| -rw-r--r-- | lua/plugins/dadbod.lua | 16 | ||||
| -rw-r--r-- | lua/plugins/debugging.lua | 68 | ||||
| -rw-r--r-- | lua/plugins/indent-blankline.lua | 13 | ||||
| -rw-r--r-- | lua/plugins/lsp-config.lua | 55 | ||||
| -rw-r--r-- | lua/plugins/none-ls.lua | 16 | ||||
| -rw-r--r-- | lua/plugins/rustaceanvim.lua | 5 | ||||
| -rw-r--r-- | lua/plugins/tailwind-tools.lua | 5 | ||||
| -rw-r--r-- | lua/plugins/treesitter.lua | 18 |
10 files changed, 270 insertions, 2 deletions
diff --git a/lua/config/mappings.lua b/lua/config/mappings.lua index a203a65..cc6d97b 100644 --- a/lua/config/mappings.lua +++ b/lua/config/mappings.lua @@ -15,7 +15,27 @@ vim.api.nvim_set_keymap( ) vim.api.nvim_set_keymap("n", "<Esc>", ":noh<CR>", { noremap = true, silent = true, desc = "Clear Search" }) - -- bufferline keymaps -vim.api.nvim_set_keymap("n", "<leader>C", ":BufferLineCloseOthers<CR>", { noremap = true, silent = true, desc = "Close Other Buffers" }) +vim.api.nvim_set_keymap( + "n", + "<leader>C", + ":BufferLineCloseOthers<CR>", + { noremap = true, silent = true, desc = "Close Other Buffers" } +) + +-- nvim-dap keymaps + +vim.keymap.set("n", "<Leader>db", require("dap").toggle_breakpoint, { desc = "DAP Toggle Breakpoint" }) +vim.keymap.set("n", "<Leader>dc", require("dap").continue, { desc = "DAP Continue" }) +vim.keymap.set("n", "<Leader>dsv", require("dap").step_over, { desc = "DAP Step Over" }) +vim.keymap.set("n", "<Leader>dsi", require("dap").step_into, { desc = "DAP Step Into" }) +vim.keymap.set("n", "<Leader>dso", require("dap").step_out, { desc = "DAP Step Out" }) + +-- lsp keymaps + +vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "LSP Hover" }) +vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "LSP Definition" }) +vim.keymap.set("n", "er", vim.diagnostic.open_float, { desc = "LSP Diagnostics" }) +vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, { desc = "LSP Code Action" }) +vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, { desc = "LSP Format" }) diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua new file mode 100644 index 0000000..5aa87aa --- /dev/null +++ b/lua/plugins/completions.lua @@ -0,0 +1,52 @@ +return { + { + "hrsh7th/cmp-nvim-lsp", + lazy = false, + config = true, + }, + { + "L3MON4D3/LuaSnip", + lazy = false, + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) + end, + }, + { + "hrsh7th/nvim-cmp", + lazy = false, + config = function() + local cmp = require("cmp") + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + ["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + ["<C-b>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.abort(), + ["<CR>"] = 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" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, +} diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua new file mode 100644 index 0000000..888e066 --- /dev/null +++ b/lua/plugins/dadbod.lua @@ -0,0 +1,16 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql", "sqloracle" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + init = function() + vim.g.db_ui_use_nerd_fonts = 1 + end, +} diff --git a/lua/plugins/debugging.lua b/lua/plugins/debugging.lua new file mode 100644 index 0000000..0479f28 --- /dev/null +++ b/lua/plugins/debugging.lua @@ -0,0 +1,68 @@ +return { + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "nvim-neotest/nvim-nio", + }, + + config = function() + local dap, dapui = require("dap"), require("dapui") + + require("dapui").setup() + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + dap.adapters.lldb = { + type = "executable", + command = "/usr/bin/lldb-vscode", + name = "lldb", + } + + dap.configurations.rust = { + { + name = "Launch", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = {}, + + initCommands = function() + -- Find out where to look for the pretty printer Python module + local rustc_sysroot = vim.fn.trim(vim.fn.system("rustc --print sysroot")) + + local script_import = 'command script import "' + .. rustc_sysroot + .. '/lib/rustlib/etc/lldb_lookup.py"' + local commands_file = rustc_sysroot .. "/lib/rustlib/etc/lldb_commands" + + local commands = {} + local file = io.open(commands_file, "r") + if file then + for line in file:lines() do + table.insert(commands, line) + end + file:close() + end + table.insert(commands, 1, script_import) + + return commands + end, + }, + } + end, +} diff --git a/lua/plugins/indent-blankline.lua b/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..ac33ea1 --- /dev/null +++ b/lua/plugins/indent-blankline.lua @@ -0,0 +1,13 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {}, + config = function() + require("ibl").setup({ + whitespace = { + remove_blankline_trail = true, + }, + scope = { enabled = false }, + }) + end, +} diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..af20e91 --- /dev/null +++ b/lua/plugins/lsp-config.lua @@ -0,0 +1,55 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "rust_analyzer", + "texlab", + "svelte", + "bashls", + "cssls", + "html", + "vtsls", + "ts_ls", + "clangd", + "tailwindcss", + }, + }) + end, + }, + { + "neovim/nvim-lspconfig", + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + local lspconfig = require("lspconfig") + local servers = { + "lua_ls", + "texlab", + "svelte", + "bashls", + "cssls", + "html", + "vtsls", + "ts_ls", + "clangd", + "clangd", + "tailwindcss", + } + + for _, lsp in ipairs(servers) do + lspconfig[lsp].setup({ + capabilities = capabilities, + }) + end + end, + }, +} diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua new file mode 100644 index 0000000..c43dd73 --- /dev/null +++ b/lua/plugins/none-ls.lua @@ -0,0 +1,16 @@ +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.formatting.prettier, + null_ls.builtins.formatting.markdownlint, + null_ls.builtins.formatting.sql_formatter, + null_ls.builtins.formatting.bibclean, + }, + }) + end, +} diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua new file mode 100644 index 0000000..168e16e --- /dev/null +++ b/lua/plugins/rustaceanvim.lua @@ -0,0 +1,5 @@ +return { + "mrcjkb/rustaceanvim", + version = "^5", -- Recommended + lazy = false, -- This plugin is already lazy +} diff --git a/lua/plugins/tailwind-tools.lua b/lua/plugins/tailwind-tools.lua new file mode 100644 index 0000000..eddbc7f --- /dev/null +++ b/lua/plugins/tailwind-tools.lua @@ -0,0 +1,5 @@ +return { + "luckasRanarison/tailwind-tools.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + opts = {}, -- your configuration +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..ca5e733 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,18 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + sync_install = false, + + auto_install = true, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + }) + end, +} |
