From 7a8fd48a71c46b909ea2bf6d7f26895596dde2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Wi=C4=85cek?= Date: Tue, 4 Nov 2025 21:06:32 +0100 Subject: [PATCH 1/2] Make peer-reviewed updates --- init.lua | 1 + lua/autocommands.lua | 6 +----- lua/health.lua | 43 +++++++++++++++++++++++++++++++++++++++++++ lua/mappings.lua | 4 ++++ lua/options.lua | 3 +++ 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 lua/health.lua diff --git a/init.lua b/init.lua index 670dbf0..a2564b8 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,7 @@ require("mappings") require("options") require("autocommands") require("config.lazy") +require("health") if vim.fn.has("mac") == 1 then require("config.mac") diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 766813f..16f3138 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -1,12 +1,8 @@ --- Highlight yanked text -local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }) - vim.api.nvim_set_hl(0, "YankHighlight", { bg = "#2d3f5f" }) - vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank { higroup = "YankHighlight", timeout = 250 } end, - group = highlight_group, + group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }), pattern = "*", }) diff --git a/lua/health.lua b/lua/health.lua new file mode 100644 index 0000000..7755afc --- /dev/null +++ b/lua/health.lua @@ -0,0 +1,43 @@ +local check_version = function() + local verstr = tostring(vim.version()) + if not vim.version.ge then + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + return + end + + if vim.version.ge(vim.version(), "0.12-dev") then + vim.health.ok(string.format("Neovim version is: '%s'", verstr)) + else + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + end +end + +local check_external_reqs = function() + -- Basic utils: `git`, `make`, `unzip` + for _, exe in ipairs { "git", "make", "unzip", "rg" } do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found executable: '%s'", exe)) + else + vim.health.warn(string.format("Could not find executable: '%s'", exe)) + end + end + + return true +end + +return { + check = function() + vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth` + + Fix only warnings for plugins and languages you intend to use. + Mason will give warnings for languages that are not installed. + You do not need to install, unless you want to use those languages!]]) + + local uv = vim.uv or vim.loop + vim.health.info("System Information: " .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + end, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index 8a40ad0..66ac97b 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -32,6 +32,10 @@ map("x", "", "gc", { remap = true }) -- clearing highlights map("n", "h", "nohlsearch") +-- diagnostics +map("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) +map("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) + -- toggle diff mode local function toggle_diff() if vim.wo.diff then diff --git a/lua/options.lua b/lua/options.lua index c2e26c8..912d4b0 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -8,6 +8,7 @@ local options = { hidden = true, -- required to keep multiple buffers and open multiple buffers hlsearch = true, -- highlight all matches on previous search pattern ignorecase = true, -- required for smartcase to work + inccommand = 'split', -- show incremental substitution mouse = "a", -- enable mouse in all modes pumheight = 10, -- pop up menu height showmode = false, -- included in statusline @@ -36,6 +37,8 @@ local options = { whichwrap = "<,>,[,],h,l" -- which "horizontal" keys should wrap to next/previous line } +vim.g.have_nerd_font = true + vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches -- stylua: ignore end From 212a5bd1d4523e2320dd19972ccc4c128de13b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Wi=C4=85cek?= Date: Tue, 4 Nov 2025 21:10:17 +0100 Subject: [PATCH 2/2] Shorten message --- lua/health.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/health.lua b/lua/health.lua index 7755afc..e1f5e97 100644 --- a/lua/health.lua +++ b/lua/health.lua @@ -30,9 +30,7 @@ return { check = function() vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth` - Fix only warnings for plugins and languages you intend to use. - Mason will give warnings for languages that are not installed. - You do not need to install, unless you want to use those languages!]]) + Fix only warnings for plugins and languages you intend to use.]]) local uv = vim.uv or vim.loop vim.health.info("System Information: " .. vim.inspect(uv.os_uname()))