From 212cbed679002c512338b8a1061f2ccfb3a684f1 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 5 Jan 2025 15:47:42 +0100 Subject: [PATCH 01/12] nvim: Load plugins lazily based on file type --- nvim/lua/plugins/cmp.lua | 2 ++ nvim/lua/plugins/dap-go.lua | 2 ++ nvim/lua/plugins/dap-python.lua | 2 ++ nvim/lua/plugins/dap-ui.lua | 2 ++ nvim/lua/plugins/dap.lua | 2 ++ nvim/lua/plugins/jdtls.lua | 2 ++ 6 files changed, 12 insertions(+) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 7ebe22c..886e80f 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -1,5 +1,7 @@ return { "hrsh7th/nvim-cmp", + lazy = true, + ft = { "java", "go", "python", "html" }, event = "InsertEnter", dependencies = { "hrsh7th/cmp-buffer", diff --git a/nvim/lua/plugins/dap-go.lua b/nvim/lua/plugins/dap-go.lua index c0c9b71..02edb12 100644 --- a/nvim/lua/plugins/dap-go.lua +++ b/nvim/lua/plugins/dap-go.lua @@ -3,6 +3,8 @@ return { dependencies = { "mfussenegger/nvim-dap", }, + lazy = true, + ft = { "go" }, config = function() require('dap-go').setup() end, diff --git a/nvim/lua/plugins/dap-python.lua b/nvim/lua/plugins/dap-python.lua index 7ad395e..2126d31 100644 --- a/nvim/lua/plugins/dap-python.lua +++ b/nvim/lua/plugins/dap-python.lua @@ -3,6 +3,8 @@ return { dependencies = { "mfussenegger/nvim-dap", }, + lazy = true, + ft = { "python" }, config = function() require('dap-python').setup() end, diff --git a/nvim/lua/plugins/dap-ui.lua b/nvim/lua/plugins/dap-ui.lua index 6121c12..9a9a2c4 100644 --- a/nvim/lua/plugins/dap-ui.lua +++ b/nvim/lua/plugins/dap-ui.lua @@ -7,6 +7,8 @@ return { opts = {}, }, }, + lazy = true, + ft = { "java", "go", "python" }, keys = { { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua index c8aa8f4..2729ba7 100644 --- a/nvim/lua/plugins/dap.lua +++ b/nvim/lua/plugins/dap.lua @@ -1,5 +1,7 @@ return { "mfussenegger/nvim-dap", + lazy = true, + ft = { "java", "go", "python" }, dependencies = { "rcarriga/nvim-dap-ui", { diff --git a/nvim/lua/plugins/jdtls.lua b/nvim/lua/plugins/jdtls.lua index 4d2bcbb..2e943bb 100644 --- a/nvim/lua/plugins/jdtls.lua +++ b/nvim/lua/plugins/jdtls.lua @@ -3,6 +3,8 @@ return { dependencies = { "williamboman/mason.nvim" }, + lazy = true, + ft = { "java" }, config = function() local dap = require('dap') dap.configurations.java = {{ From b62cdc7c6453b5b9d0ee8edffef9401bf302cb53 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:46:02 +0200 Subject: [PATCH 02/12] nvim: Replace Mason with local language servers --- nvim/ftplugin/java.lua | 4 +- nvim/lua/plugins/mason.lua | 147 --------------------------------- nvim/lua/plugins/sonarlint.lua | 15 ++-- 3 files changed, 8 insertions(+), 158 deletions(-) delete mode 100644 nvim/lua/plugins/mason.lua diff --git a/nvim/ftplugin/java.lua b/nvim/ftplugin/java.lua index 6243d58..5c94153 100644 --- a/nvim/ftplugin/java.lua +++ b/nvim/ftplugin/java.lua @@ -12,8 +12,8 @@ require('jdtls').start_or_attach({ root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), init_options = { bundles = { - vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.core.jar"), - vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar"), + vim.fn.expand("/usr/share/java-debug/com.microsoft.java.debug.core.jar"), + vim.fn.expand("/usr/share/java-debug/com.microsoft.java.debug.plugin.jar"), }, }, java = { diff --git a/nvim/lua/plugins/mason.lua b/nvim/lua/plugins/mason.lua deleted file mode 100644 index 6debd75..0000000 --- a/nvim/lua/plugins/mason.lua +++ /dev/null @@ -1,147 +0,0 @@ -return { - "williamboman/mason.nvim", - enabled = true, - dependencies = { - "williamboman/mason-lspconfig.nvim", - }, - opts = { - ensure_installed = { - "jdtls", - "java-debug-adapter", - "sonarlint-language-server", - "gradle-language-server", - "html-lsp", - "json-lsp", - "typos-lsp" - }, - }, - config = function() - require("mason").setup() - require("mason-lspconfig").setup() - - lspconfig = require "lspconfig" - - -- Gradle - lspconfig.gradle_ls.setup{} - - -- HTML - lspconfig.html.setup{ - settings = { - html = { - format = { - tabSize = 4, - insertSpaces = true, - indentEmptyLines = false, - indentInnerHtml = true, - wrapLineLength = 120, - wrapAttributes = 'preserve', - wrapAttributesIndentSize = 4, - preserveNewLines = true, - maxPreserveNewLines = 1, - indentScripts = "keep", - extraLiners = "", - }, - }, - } - } - - -- JSON - lspconfig.jsonls.setup{} - - -- Go - lspconfig.gopls.setup{ - settings = { - gopls = { - gofumpt = true, - staticcheck = true, - analyses = { - unusedparams = true, - unusedresult = true, - unusedwrite = true, - unusedvariable = true, - useany = true, - fieldalignment = false, - nilness = true, - shadow = true, - }, - hints = { - assignVariableTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true, - }, - codelenses = { - gc_details = true, - generate = true, - regenerate_cgo = true, - tidy = true, - upgrade_dependency = true, - vendor = true, - }, - }, - }, - } - -- Organize imports and format code on save - vim.api.nvim_create_autocmd({"BufWritePre"}, { - pattern = "*.go", - callback = function() - local params = vim.lsp.util.make_range_params() - params.context = {only = {"source.organizeImports"}} - local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) - for cid, res in pairs(result or {}) do - for _, r in pairs(res.result or {}) do - if r.edit then - local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" - vim.lsp.util.apply_workspace_edit(r.edit, enc) - end - end - end - vim.lsp.buf.format({async = false}) - end - }) - - -- Python - lspconfig.pylsp.setup{ - settings = { - pylsp = { - plugins = { - autopep8 = { - enabled = false, - }, - yapf = { - enabled = true, - }, - pylint = { - enabled = false, - }, - pyflakes = { - enabled = true, - }, - pycodestyle = { - enabled = true, - ignore = { - 'E402', - 'W503', - }, - }, - }, - }, - }, - } - - lspconfig.typos_lsp.setup({ - settings = { - filetypes = { - 'java', - 'go' - }, - }, - init_options = { - diagnosticSeverity = "Info", - } - }) - end, -} diff --git a/nvim/lua/plugins/sonarlint.lua b/nvim/lua/plugins/sonarlint.lua index dd5cc2f..bf621f0 100644 --- a/nvim/lua/plugins/sonarlint.lua +++ b/nvim/lua/plugins/sonarlint.lua @@ -3,20 +3,18 @@ return { url = "https://gitlab.com/schrieveslaach/sonarlint.nvim", lazy = true, ft = {"java", "go", "html", "python"}, - dependencies = { - "williamboman/mason.nvim" - }, config = function() require('sonarlint').setup({ server = { cmd = { - 'sonarlint-language-server', + 'sonarlint-ls', '-stdio', '-analyzers', - vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarjava.jar"), - vim.fn.expand("$MASON/share/sonarlint-analyzers/sonargo.jar"), - vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarhtml.jar"), - vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarpython.jar"), + "/usr/share/java/sonarlint-ls/analyzers/sonarjava.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonargo.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarhtml.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarpython.jar", + "/usr/share/java/sonarlint-ls/analyzers/sonarphp.jar", }, settings = { sonarlint = { @@ -41,4 +39,3 @@ return { end } } - From 1a9e0964e7507c73a5598cd1271987c09a176105 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:47:52 +0200 Subject: [PATCH 03/12] nvim: Fix upstream URL of DAP plugins --- nvim/lua/plugins/dap-go.lua | 2 +- nvim/lua/plugins/dap-python.lua | 4 ++-- nvim/lua/plugins/dap.lua | 2 +- nvim/lua/plugins/jdtls.lua | 5 +---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/nvim/lua/plugins/dap-go.lua b/nvim/lua/plugins/dap-go.lua index 02edb12..33adaa6 100644 --- a/nvim/lua/plugins/dap-go.lua +++ b/nvim/lua/plugins/dap-go.lua @@ -1,7 +1,7 @@ return { "leoluz/nvim-dap-go", dependencies = { - "mfussenegger/nvim-dap", + "https://codeberg.org/mfussenegger/nvim-dap", }, lazy = true, ft = { "go" }, diff --git a/nvim/lua/plugins/dap-python.lua b/nvim/lua/plugins/dap-python.lua index 2126d31..92bbe8c 100644 --- a/nvim/lua/plugins/dap-python.lua +++ b/nvim/lua/plugins/dap-python.lua @@ -1,7 +1,7 @@ return { - "mfussenegger/nvim-dap-python", + "https://codeberg.org/mfussenegger/nvim-dap-python", dependencies = { - "mfussenegger/nvim-dap", + "https://codeberg.org/mfussenegger/nvim-dap", }, lazy = true, ft = { "python" }, diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua index 2729ba7..6642065 100644 --- a/nvim/lua/plugins/dap.lua +++ b/nvim/lua/plugins/dap.lua @@ -1,5 +1,5 @@ return { - "mfussenegger/nvim-dap", + "https://codeberg.org/mfussenegger/nvim-dap", lazy = true, ft = { "java", "go", "python" }, dependencies = { diff --git a/nvim/lua/plugins/jdtls.lua b/nvim/lua/plugins/jdtls.lua index 2e943bb..3b5f99d 100644 --- a/nvim/lua/plugins/jdtls.lua +++ b/nvim/lua/plugins/jdtls.lua @@ -1,8 +1,5 @@ return { - "mfussenegger/nvim-jdtls", - dependencies = { - "williamboman/mason.nvim" - }, + "https://codeberg.org/mfussenegger/nvim-jdtls", lazy = true, ft = { "java" }, config = function() From 399fc584dd4ce4f21f07fcc5a38be6cc53331aaf Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:49:36 +0200 Subject: [PATCH 04/12] nvim: Update LSP configuration --- nvim/lua/plugins/lspconfig.lua | 89 ++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-) diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua index cd69348..53cdab8 100644 --- a/nvim/lua/plugins/lspconfig.lua +++ b/nvim/lua/plugins/lspconfig.lua @@ -26,9 +26,6 @@ return { }, }, config = function() - local nvim_lsp = require("lspconfig") - - local protocol = require("vim.lsp.protocol") local on_attach = function(client, bufnr) -- Format on save @@ -42,5 +39,91 @@ return { }) end end + + -- Typos + vim.lsp.config("typos_lsp", { + settings = { + filetypes = { + 'java', + 'go' + }, + }, + init_options = { + diagnosticSeverity = "Hint", + } + }) + + -- Gradle + --vim.lsp.enable('gradle_ls') + + -- HTML + vim.lsp.enable('html') + + -- CSS + vim.lsp.enable('cssls') + + -- JSON + vim.lsp.enable('jsonls') + + -- Python + vim.lsp.enable('pylsp') + + -- Go + vim.lsp.config("gopls", { + settings = { + gopls = { + gofumpt = true, + staticcheck = true, + analyses = { + unusedparams = true, + unusedresult = true, + unusedwrite = true, + unusedvariable = true, + useany = true, + fieldalignment = false, + nilness = true, + shadow = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + codelenses = { + gc_details = true, + generate = true, + regenerate_cgo = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + }, + }, + }) + -- Organize imports and format code on save + vim.api.nvim_create_autocmd({"BufWritePre"}, { + pattern = "*.go", + callback = function() + local params = vim.lsp.util.make_range_params() + params.context = {only = {"source.organizeImports"}} + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) + for cid, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" + vim.lsp.util.apply_workspace_edit(r.edit, enc) + end + end + end + vim.lsp.buf.format({async = false}) + end + }) + + -- PHP + vim.lsp.enable('phpactor') end, } From 8452ea90e4c37df503ed6c1b688ac7c29bbed141 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:50:09 +0200 Subject: [PATCH 05/12] nvim: Update Java/JDT configuration --- nvim/ftplugin/java.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nvim/ftplugin/java.lua b/nvim/ftplugin/java.lua index 5c94153..8f05e69 100644 --- a/nvim/ftplugin/java.lua +++ b/nvim/ftplugin/java.lua @@ -4,12 +4,15 @@ vim.opt.colorcolumn = "120" vim.opt.textwidth = 120 require('jdtls').start_or_attach({ - cmd = {'jdtls'}, + cmd = { + 'jdtls', + '-parameters' + }, on_attach = function(client, bufnr) require('jdtls').setup_dap({hotcodereplace = 'auto'}) require('jdtls.dap').setup_dap_main_class_configs() end, - root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), + root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'gradle.properties'}, { upward = true })[1]), init_options = { bundles = { vim.fn.expand("/usr/share/java-debug/com.microsoft.java.debug.core.jar"), @@ -51,6 +54,17 @@ require('jdtls').start_or_attach({ url = "/home/oliver/Dokumente/Gallery Systems/Products/GS Eclipse Formatter Java.xml" }, }, + codeGeneration = { + --generateComments = true, + insertionLocation = 'lastMember', + hashCodeEquals = { + useInstanceof = true, + useJava7Objects = true, + }, + }, + telemetry = { + enabled = false, + }, }, }, }) From 09fb4348c37a6adde8de943a2da7ffec59c735fc Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:51:20 +0200 Subject: [PATCH 06/12] nvim: Add key bindings for Neo Tree --- nvim/lua/plugins/neo-tree.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/lua/plugins/neo-tree.lua b/nvim/lua/plugins/neo-tree.lua index 6c3aac9..db38ff2 100644 --- a/nvim/lua/plugins/neo-tree.lua +++ b/nvim/lua/plugins/neo-tree.lua @@ -6,6 +6,10 @@ return { "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", }, + keys = { + { "tt", "Neotree toggle", desc = "NeoTree toggle" }, + { "tr", "Neotree reveal", desc = "NeoTree reveal" }, + }, config = function() require("neo-tree").setup({ window = { From e36e3a757c84586ba8e9eb71b211aea781822c84 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:52:17 +0200 Subject: [PATCH 07/12] nvim: Update telescope configuration --- nvim/lua/plugins/telescope.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index 043cc72..3675166 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -1,25 +1,26 @@ return { 'nvim-telescope/telescope.nvim', branch = '0.1.x', - dependencies = { 'nvim-lua/plenary.nvim', "nvim-telescope/telescope-ui-select.nvim" }, + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope-ui-select.nvim', + }, keys = { { "", "Telescope" }, { "", "Telescope buffers", desc = "Find luffers" }, { "", "Telescope git_files", desc = "Find files" }, { "", "Telescope lsp_document_symbols", desc = "Find symbols" }, + { "", "lua require('telescope.builtin').diagnostics({severity_limit='WARN'})", desc = "Show errors and warnings" }, }, config = function() local t = require("telescope") - t.load_extension("ui-select") t.setup({ defaults = { preview = false, - layout_config = { - vertical = { - width = 0.5, - }, - }, }, }) + + t.load_extension("ui-select") end } From 5c7d1a40fd2e85173ad504c41c6f27de2435f7df Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:52:58 +0200 Subject: [PATCH 08/12] nvim: Add TODO Comments plugin --- nvim/lua/plugins/todo-comments.lua | 8 ++++++++ nvim/lua/plugins/trouble.lua | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 nvim/lua/plugins/todo-comments.lua diff --git a/nvim/lua/plugins/todo-comments.lua b/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..8e8d8ee --- /dev/null +++ b/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,8 @@ +return { + "folke/todo-comments.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + }, +} diff --git a/nvim/lua/plugins/trouble.lua b/nvim/lua/plugins/trouble.lua index e8069b1..562539c 100644 --- a/nvim/lua/plugins/trouble.lua +++ b/nvim/lua/plugins/trouble.lua @@ -53,6 +53,16 @@ return { "Trouble diagnostics filter.buf=0 filter.severity=vim.diagnostic.severity.HINT", desc = "Info Diagnostics (Trouble)", }, + { + "xt", + "Trouble todo", + desc = "TODOs (Trouble)", + }, + { + "xT", + "Trouble todo filter.buf=0", + desc = "TODOs (Trouble)", + }, { "cs", "Trouble symbols toggle focus=false", From 3d14a58707cc80295cadc0487dccd78d59634b13 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:54:02 +0200 Subject: [PATCH 09/12] nvim: Enable SonarLint for Python --- nvim/lua/plugins/sonarlint.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/lua/plugins/sonarlint.lua b/nvim/lua/plugins/sonarlint.lua index bf621f0..386d372 100644 --- a/nvim/lua/plugins/sonarlint.lua +++ b/nvim/lua/plugins/sonarlint.lua @@ -2,7 +2,7 @@ return { { url = "https://gitlab.com/schrieveslaach/sonarlint.nvim", lazy = true, - ft = {"java", "go", "html", "python"}, + ft = {"java", "go", "html", "python", "php"}, config = function() require('sonarlint').setup({ server = { @@ -34,6 +34,7 @@ return { 'go', 'html', 'python', + "php" }, }) end From 0cbc4ab090f0455014d274cff757dafb8c163cd5 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:55:17 +0200 Subject: [PATCH 10/12] nvim: Enable TreeSitter for go instead of rust --- nvim/lua/plugins/treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 5188588..81e10a4 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -31,7 +31,7 @@ return { "lua", "vim", "gitignore", - "rust", + "go", }, incremental_selection = { enable = true, From 1d9b21bc0c08ebeed519e67b84dfe3f2cfca1aeb Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:58:37 +0200 Subject: [PATCH 11/12] nvim Add key binding for most-recent buffer --- nvim/init.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/init.vim b/nvim/init.vim index 31bb1cf..4e10895 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -37,6 +37,7 @@ set hidden " Custom shortcuts map gb :bn map gB :bp +map g# :b# " Close the completion preview window (docstring) automatically autocmd CompleteDone * pclose From b23f3e26c2703b03ac2147a5b80469785e2cd53e Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 20 Sep 2025 11:59:07 +0200 Subject: [PATCH 12/12] aerc: Remove special rule for sidebar width --- aerc/aerc.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/aerc/aerc.conf b/aerc/aerc.conf index be9a323..d0b6530 100644 --- a/aerc/aerc.conf +++ b/aerc/aerc.conf @@ -23,9 +23,6 @@ column-date = {{.Date.Local}} column-name = {{index (.To | names) 0}} column-subject = {{.ThreadPrefix}}{{.Subject}} -[ui:account=gs] -sidebar-width=30 - [viewer] pager=less -R alternatives=text/plain,text/html