Compare commits

..

2 Commits

Author SHA1 Message Date
Henrik Bakken 49e474caeb nvim treewalker (OMG!) 2026-03-19 23:57:59 +01:00
Henrik Bakken 04e1114959 nvim tweaks (gemini) 2026-03-19 23:53:37 +01:00
+77 -18
View File
@@ -567,7 +567,12 @@ local function makespec_lualine()
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "echasnovski/mini.icons", "folke/noice.nvim" }, dependencies = { "echasnovski/mini.icons", "folke/noice.nvim" },
opts = { opts = {
options = { theme = "auto", globalstatus = false, always_divide_middle = false }, options = {
theme = "auto",
globalstatus = false,
always_divide_middle = false,
disabled_filetypes = { statusline = { "snacks_picker_list" } },
},
extensions = { "fugitive", "neo-tree", "lazy" }, extensions = { "fugitive", "neo-tree", "lazy" },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
@@ -605,7 +610,6 @@ local function makespec_lualine()
lualine_b = {}, lualine_b = {},
lualine_c = {}, lualine_c = {},
lualine_x = { lualine_x = {
-- { 'require("noice").api.status.message.get()', color = { fg = "#99c794" } }, -- gets too obtrusive
{ 'require("noice").api.status.mode.get()', color = "lualine_a_command" }, { 'require("noice").api.status.mode.get()', color = "lualine_a_command" },
{ 'require("noice").api.status.command.get()', color = "lualine_a_command" }, { 'require("noice").api.status.command.get()', color = "lualine_a_command" },
}, },
@@ -882,7 +886,7 @@ local function makespec_fugitive()
pattern = { "fugitive", "gitcommit" }, pattern = { "fugitive", "gitcommit" },
callback = function() callback = function()
vim.opt_local.foldmethod = "syntax" vim.opt_local.foldmethod = "syntax"
vim.opt_local.foldlevel = 0 vim.opt_local.foldlevel = 99
end, end,
}) })
end, end,
@@ -1392,6 +1396,29 @@ local function makespec_treesitter()
} }
end end
local function makespec_treewalker()
return {
"aaronik/treewalker.nvim",
-- Load when you open a file that Treesitter supports
event = { "BufReadPost", "BufNewFile" },
opts = {
-- Briefly highlights the block of code you just jumped to
highlight = true,
},
keys = {
-- Normal and Visual mode mappings
{ "]]", "<cmd>Treewalker Down<cr>", mode = { "n", "v" }, desc = "Next Sibling (Current Level)" },
{ "[[", "<cmd>Treewalker Up<cr>", mode = { "n", "v" }, desc = "Prev Sibling (Current Level)" },
{ "((", "<cmd>Treewalker Left<cr>", mode = { "n", "v" }, desc = "Go Out (Parent Level)" },
{ "))", "<cmd>Treewalker Right<cr>", mode = { "n", "v" }, desc = "Go In (Child Level)" },
-- Optional: Swap nodes! (Move current block down/up past its sibling)
{ "<leader>Sj", "<cmd>Treewalker SwapDown<cr>", desc = "Swap Block Down" },
{ "<leader>Sk", "<cmd>Treewalker SwapUp<cr>", desc = "Swap Block Up" },
},
}
end
local function makespec_hlslens() local function makespec_hlslens()
return { return {
-- search count > 99 -- search count > 99
@@ -1422,16 +1449,26 @@ end
local function makespec_lint() local function makespec_lint()
return { return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
require("lint").linters_by_ft = { local lint = require("lint")
lint.linters_by_ft = {
javascript = { "eslint_d" }, javascript = { "eslint_d" },
typescript = { "eslint_d" }, typescript = { "eslint_d" },
html = { "tidy", "eslint_d" }, html = { "tidy", "eslint_d" },
go = { "golangcilint" }, go = { "golangcilint" },
sh = { "shellcheck" }, sh = { "shellcheck" },
} }
local lint_augroup = vim.api.nvim_create_augroup("nvim_lint", { clear = true })
-- Use a timer to debounce linting to prevent UI stutter
local timer = vim.uv.new_timer()
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function() require("lint").try_lint() end, group = lint_augroup,
callback = function()
timer:start(200, 0, vim.schedule_wrap(function() lint.try_lint() end))
end,
}) })
end, end,
} }
@@ -1440,14 +1477,26 @@ end
local function makespec_conform() local function makespec_conform()
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
lazy = true, -- Load conform right before you save a file, or when you trigger a keymap
event = { "BufWritePre" },
cmd = { "ConformInfo" }, cmd = { "ConformInfo" },
keys = { keys = {
{ "<leader>p", function() require("conform").format() end, silent = true, desc = "Autoformat" }, {
"<leader>p",
function() require("conform").format({ async = true, lsp_format = "fallback" }) end,
mode = { "n", "v" },
desc = "Autoformat",
},
{ "<leader>lp", "<cmd>ConformInfo<cr>", desc = "Conform log" }, { "<leader>lp", "<cmd>ConformInfo<cr>", desc = "Conform log" },
{ "<leader>lP", "<cmd>e ~/.local/state/nvim/conform.log<cr>", desc = "Conform log" }, { "<leader>lP", "<cmd>e ~/.local/state/nvim/conform.log<cr>", desc = "Conform log file" },
}, },
opts = { opts = {
-- format_on_save = function(bufnr)
-- -- Disable with a global or buffer-local variable
-- if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then return end
-- return { timeout_ms = 3000, lsp_format = "fallback" }
-- end,
formatters_by_ft = { formatters_by_ft = {
["_"] = { "trim_whitespace" }, ["_"] = { "trim_whitespace" },
css = { "prettierd", "prettier", stop_after_first = true }, css = { "prettierd", "prettier", stop_after_first = true },
@@ -1465,7 +1514,9 @@ local function makespec_conform()
typst = { "typstyle" }, typst = { "typstyle" },
yaml = { "yamlfmt" }, yaml = { "yamlfmt" },
}, },
default_format_opts = { timeout_ms = 3000, lsp_format = "fallback" }, default_format_opts = {
lsp_format = "fallback",
},
formatters = { formatters = {
javascript = { require_cwd = true }, javascript = { require_cwd = true },
stylua = { append_args = { "--indent-type", "Spaces", "--collapse-simple-statement", "Always" } }, stylua = { append_args = { "--indent-type", "Spaces", "--collapse-simple-statement", "Always" } },
@@ -1552,13 +1603,15 @@ local function makespec_noice()
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" }, dependencies = { "MunifTanjim/nui.nvim" },
opts = { opts = {
-- Disable Noice's notification router so Snacks can handle it
notify = { enabled = false },
messages = { messages = {
enabled = true, enabled = true,
view = "notify", view = "mini",
view_error = "notify", view_error = "mini",
view_warn = "notify", view_warn = "mini",
view_history = "popup", view_history = "popup",
view_search = false, view_search = false,
}, },
@@ -1566,19 +1619,24 @@ local function makespec_noice()
override = { override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true, ["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
}, },
signature = { enabled = true, auto_open = { enabled = false, throttle = 50 } }, signature = { enabled = true, auto_open = { enabled = false, throttle = 50 } },
}, },
presets = { command_palette = true, long_message_to_split = true }, presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
lsp_doc_border = true,
},
routes = { routes = {
{ filter = { event = "msg_show", kind = "search_count" }, opts = { skip = true } }, { filter = { event = "msg_show", kind = "search_count" }, opts = { skip = true } },
{ filter = { kind = "", min_height = 2 }, view = "split" },
}, },
}, },
keys = { keys = {
{ "<leader>lx", function() require("noice").cmd("dismiss") end, desc = "Noice dismiss" }, { "<leader>lx", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
{ "<leader>lh", function() require("noice").cmd("all") end, desc = "Noice history" }, { "<leader>lh", function() require("noice").cmd("all") end, desc = "Noice History" },
{ "<leader>ls", function() require("noice").cmd("stats") end, desc = "Noice stats" }, { "<leader>ls", function() require("noice").cmd("stats") end, desc = "Noice Stats" },
{ "<leader>un", function() require("noice").cmd("enable") end, desc = "Enable Noice" }, { "<leader>un", function() require("noice").cmd("enable") end, desc = "Enable Noice" },
{ "<leader>uN", function() require("noice").cmd("disable") end, desc = "Disable Noice" }, { "<leader>uN", function() require("noice").cmd("disable") end, desc = "Disable Noice" },
}, },
@@ -1601,6 +1659,7 @@ for _, spec in ipairs({
makespec_conform(), -- autoformat makespec_conform(), -- autoformat
makespec_lspconfig(), makespec_lspconfig(),
makespec_treesitter(), makespec_treesitter(),
makespec_treewalker(),
makespec_todocomments(), makespec_todocomments(),
makespec_autotag(), makespec_autotag(),
makespec_lint(), makespec_lint(),