From 47735a56a5e4293d2fdf13111e583f1b1e2db045 Mon Sep 17 00:00:00 2001 From: Tim Wundenberg Date: Fri, 9 Jan 2026 09:54:12 +0100 Subject: [PATCH] fix: remove comments and migrate deprecation --- init.lua | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/init.lua b/init.lua index c0f36cf..092f77a 100644 --- a/init.lua +++ b/init.lua @@ -41,27 +41,12 @@ require('nvim_comment').setup({ end, }) - require('nvim-ts-autotag').setup() --- local function hello() --- local x = vim.fn["nvim_treesitter#statusline(90)"]() --- -- print(x) --- return "test" --- end require('lualine').setup({ options = { theme = "everforest", }, - -- sections = { - -- -- lualine_a = { 'mode' }, - -- -- lualine_b = { 'branch', 'diff', 'diagnostics' }, - -- -- lualine_c = { 'filename' }, - -- lualine_c = { 'filename', hello }, - -- -- lualine_x = { 'encoding', 'fileformat', 'filetype' }, - -- -- lualine_y = { 'progress' }, - -- -- lualine_z = { 'location' } - -- }, }) vim.cmd([[colorscheme everforest]]) @@ -228,7 +213,6 @@ require "nvim-treesitter.configs".setup({ } }) --- Treesitter Java class + method lookup local ts = vim.treesitter local function java_symbol_under_cursor() @@ -247,7 +231,6 @@ local function java_symbol_under_cursor() local class_name = nil local method_name = nil - -- Walk up the syntax tree while node do local type = node:type() if type == "class_declaration" and not class_name then @@ -306,8 +289,6 @@ local function run_all_tests() end --- Keymap to print class + method under cursor - vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Hightlight selection on yank', pattern = '*', @@ -343,31 +324,26 @@ vim.api.nvim_create_autocmd('BufWritePre', { vim.filetype.add({ extension = { templ = "templ" } }) --- Function to find the nearest directory containing go.mod local function find_go_mod_root() - local path = vim.fn.expand("%:p:h") -- current file's directory - local root = vim.fn.finddir("go.mod", path .. ";") -- search upwards + local path = vim.fn.expand("%:p:h") + local root = vim.fn.finddir("go.mod", path .. ";") if root == "" then - return nil -- fallback if no go.mod found + return nil else - return vim.fn.fnamemodify(root, ":h") -- directory containing go.mod + return vim.fn.fnamemodify(root, ":h") end end --- Autocmd for Go files vim.api.nvim_create_autocmd("FileType", { pattern = "go", callback = function() - -- Set makeprg to run in the module root local root = find_go_mod_root() if root then - -- cd into the module root, then run go vim.opt_local.makeprg = "cd " .. root .. " && go build ./..." else vim.opt_local.makeprg = "go build ./..." end - -- Set errorformat for Go errors vim.opt_local.errorformat = table.concat({ "%f:%l:%c: %m", "%f:%l: %m", @@ -393,7 +369,7 @@ vim.keymap.set('n', '', vim.lsp.buf.code_action, {}) vim.keymap.set('n', 'q', ':q', { desc = "Quit current Buffer" }) vim.keymap.set('n', 'w', ':w', { desc = "Write current Buffer" }) vim.keymap.set('n', '', ':noh', { desc = "Clear search and redraw" }) -vim.keymap.set('n', '', vim.diagnostic.goto_next, {}) +vim.keymap.set('n', '', function() vim.diagnostic.jump({ count = 1 }) end, {}) vim.keymap.set("n", "", "h") -- Terminal is sending Backspace instead of , so this needs to be different