diff --git a/lazy-lock.json b/lazy-lock.json index f767fb0..cef29a8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,14 +4,20 @@ "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "kanagawa-paper.nvim": { "branch": "master", "commit": "b0df20cca3b7087c06f241983b488190cc8e23af" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f54e3c11fc9ebfcfc27e696182b0295b071d0811" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.nvim": { "branch": "main", "commit": "3f5d06a6f710966cb93baaadc4897eeb6d6210e5" }, - "nvim-lspconfig": { "branch": "master", "commit": "314b35335cc84bc2a085c84c69da955ba22da163" }, + "mini.nvim": { "branch": "main", "commit": "1b32a3f61f1f649cadc748bd4b7a32b4b4785d29" }, + "nvim-dap": { "branch": "master", "commit": "2edd6375692d9ac1053d50acfe415c1eb2ba92d0" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-rpgle": { "branch": "master", "commit": "8feaf44adf915c1df255920268beec710188df43" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "one-small-step-for-vimkind": { "branch": "main", "commit": "d9f832598e14f3b206b06f5738d02cebede65269" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } diff --git a/lua/pluginmanager.lua b/lua/pluginmanager.lua index 8c56b93..0ed732d 100644 --- a/lua/pluginmanager.lua +++ b/lua/pluginmanager.lua @@ -20,7 +20,7 @@ require("lazy").setup({ spec = { -- import your plugins { import = "plugins" }, - -- "https://git.erik.mertens.digital/erik/nvim-rpgle.git" + "https://git.erik.mertens.digital/erik/nvim-rpgle.git" }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index 04bb9d0..ce56426 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -1,49 +1,52 @@ return { - 'saghen/blink.cmp', - -- optional: provides snippets for the snippet source - dependencies = { 'rafamadriz/friendly-snippets' }, + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, - version = '1.*', + version = '1.*', - ---@module 'blink.cmp' - ---@type blink.cmp.Config - opts = { - -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) - -- 'super-tab' for mappings similar to vscode (tab to accept) - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- All presets have the following mappings: - -- C-space: Open menu or open docs if already open - -- C-n/C-p or Up/Down: Select next/previous item - -- C-e: Hide menu - -- C-k: Toggle signature help (if signature.enabled = true) - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = 'default' }, + cond = function() + return not vim.g.vscode + end, - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'normal' + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'normal' + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" } }, - - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = true } }, - - -- Default list of enabled providers defined so that you can extend it - -- elsewhere in your config, without redefining it, due to `opts_extend` - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, - }, - - -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance - -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, - -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` - -- - -- See the fuzzy documentation for more information - fuzzy = { implementation = "prefer_rust_with_warning" } - }, - opts_extend = { "sources.default" } + opts_extend = { "sources.default" } } - diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua new file mode 100644 index 0000000..03a2323 --- /dev/null +++ b/lua/plugins/debug.lua @@ -0,0 +1,177 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +return { + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', + + -- Required dependency for nvim-dap-ui + 'nvim-neotest/nvim-nio', + + -- Installs the debug adapters for you + 'mason-org/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + -- 'leoluz/nvim-dap-go', + "jbyuki/one-small-step-for-vimkind" + }, + keys = { + -- Basic debugging keymaps, feel free to change to your liking! + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: See last session result.', + }, + { + 'Db', + function() + require('dap').toggle_breakpoint() + end, + desc = '[D]ebug: Toggle [b]reakpoint', + }, + { + 'DB', + function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = '[D]ebug: Set [B]reakpoint condition', + }, + { + "Dl", + function() + require("osv").launch({ port = 8086 }) + end, + desc = "[D]ebug [l]aunch" + }, + { + "Dh", + function() + require("dap.ui.widgets").hover() + end, + desc = "[D]ebug [h]over" + } + + -- vim.keymap.set('n', 'Dl', function() + -- require "osv".launch({ port = 8086 }) + -- end, { noremap = true }) + }, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_installation = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = { + function(config) + require("mason-nvim-dap").default_setup(config) + end + }, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + "firefox_debug_adapter", + "codelldb", + "local-lua-debugger-vscode" + }, + } + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + } + + -- Change breakpoint icons + vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) + vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) + local breakpoint_icons = vim.g.have_nerd_font + and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } + or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } + for type, icon in pairs(breakpoint_icons) do + local tp = 'Dap' .. type + local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' + vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) + end + + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Configure debug adapters + dap.configurations.lua = { + { + type = 'nlua', + request = 'attach', + name = "Attach to running Neovim instance", + } + } + + dap.adapters.nlua = function(callback, config) + callback({ type = 'server', host = config.host or "127.0.0.1", port = config.port or 8086 }) + end + end, +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 87bf363..9e9dadc 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -20,7 +20,7 @@ return { -- LSP Configuration & Plugins map('gd', function() vim.lsp.buf.definition() end, '[G]oto [D]efinition') -- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') -- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + map('gd', require('telescope.builtin').lsp_type_definitions, '[G]oto Type [D]efinition') map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- map('rn', vim.lsp.buf.rename, '[R]e[n]ame') @@ -34,7 +34,8 @@ return { -- LSP Configuration & Plugins -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then + if client and client:supports_method( + vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, callback = vim.lsp.buf.document_highlight, @@ -46,6 +47,13 @@ return { -- LSP Configuration & Plugins }) end + if client and client:supports_method( + vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + map('ti', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "[T]oggle [I]nlay") + end + -- autoformat vim.api.nvim_create_autocmd("BufWritePre", { buffer = event.buf, @@ -84,7 +92,8 @@ return { -- LSP Configuration & Plugins workspace = { library = { [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true + [vim.fn.stdpath("config") .. "/lua"] = true, + ["${3rd}/luv/library"] = true, } } }, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 8e513e7..827f87d 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,12 +1,15 @@ return { "nvim-treesitter/nvim-treesitter", - branch = 'master', + branch = "master", lazy = false, build = ":TSUpdate", event = { "BufRead" }, - opts = { -- Das Plugin bietet noch diverse weitere Optionen. - indent = { enable = true }, -- Automatische Einrückungen mit Tree-sitter + opts = { -- Das Plugin bietet noch diverse weitere Optionen. + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', + 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', "rust", "vue", "typescript", "css" + }, + indent = { enable = true }, -- Automatische Einrückungen mit Tree-sitter highlight = { enable = true }, -- Das Syntax-Highlighting einschalten - auto_install = true, -- Highlighting-Daten automatisch installieren + auto_install = true, -- Highlighting-Daten automatisch installieren } } diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 2a2af95..4699c76 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -1,20 +1,23 @@ return { - "folke/which-key.nvim", - event = "VeryLazy", - opts = {}, - config = function() + "folke/which-key.nvim", + event = "VeryLazy", + opts = {}, + config = function() local wk = require("which-key") wk.add({ { "f", group = "Telescope" } }) - end, - keys = { - { - "?", - function() - require("which-key").show({ global = false }) - end, - desc = "Buffer Local Keymaps (which-key)", + wk.add({ + { "D", group = "Debug" } + }) + end, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, }, - }, } diff --git a/lua/settings.lua b/lua/settings.lua index 399bef2..990cb25 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,4 +1,3 @@ - -- Keymaps -- Copy vim.api.nvim_set_keymap("n", "", '"+gp', { noremap = true }) @@ -52,16 +51,6 @@ vim.o.laststatus = 3 vim.o.breakindent = true vim.o.showbreak = "=>" - - --- setup sign symbols -local signs = { Error = "⛔", Warn = "⚠", Hint = "💡", Info = "⚡" } - -for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) -end - -- -- terminal mode -- if jit.os == "Windows" then -- vim.o.shell = [[C:\Users\mertens\AppData\Local\Programs\Git\bin\bash.exe]] @@ -69,5 +58,15 @@ end -- -- vim.o.backupdir = "C:\\Users\\mertens\\AppData\\Local\\nvim-data\\backup" -- end - -vim.diagnostic.config({ virtual_lines = { current_line = true } }) +vim.diagnostic.config({ + severity_sort = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "⛔", + [vim.diagnostic.severity.WARN] = "⚠", + [vim.diagnostic.severity.HINT] = "💡", + [vim.diagnostic.severity.INFO] = "⚡", + } + }, + virtual_lines = { current_line = true } +})