Compare commits

..

1 Commits

Author SHA1 Message Date
Henrik Bakken ad27913a5b nvim tweaks (gemini) 2026-03-19 23:19:21 +01:00
+18 -77
View File
@@ -567,12 +567,7 @@ 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 = { options = { theme = "auto", globalstatus = false, always_divide_middle = false },
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" },
@@ -610,6 +605,7 @@ 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" },
}, },
@@ -886,7 +882,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 = 99 vim.opt_local.foldlevel = 0
end, end,
}) })
end, end,
@@ -1396,29 +1392,6 @@ 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
@@ -1449,26 +1422,16 @@ end
local function makespec_lint() local function makespec_lint()
return { return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
local lint = require("lint") require("lint").linters_by_ft = {
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" }, {
group = lint_augroup, callback = function() require("lint").try_lint() end,
callback = function()
timer:start(200, 0, vim.schedule_wrap(function() lint.try_lint() end))
end,
}) })
end, end,
} }
@@ -1477,26 +1440,14 @@ end
local function makespec_conform() local function makespec_conform()
return { return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
-- Load conform right before you save a file, or when you trigger a keymap lazy = true,
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 file" }, { "<leader>lP", "<cmd>e ~/.local/state/nvim/conform.log<cr>", desc = "Conform log" },
}, },
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 },
@@ -1514,9 +1465,7 @@ local function makespec_conform()
typst = { "typstyle" }, typst = { "typstyle" },
yaml = { "yamlfmt" }, yaml = { "yamlfmt" },
}, },
default_format_opts = { default_format_opts = { timeout_ms = 3000, lsp_format = "fallback" },
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" } },
@@ -1603,15 +1552,13 @@ local function makespec_noice()
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { "MunifTanjim/nui.nvim" }, dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" },
opts = { opts = {
-- Disable Noice's notification router so Snacks can handle it
notify = { enabled = false },
messages = { messages = {
enabled = true, enabled = true,
view = "mini", view = "notify",
view_error = "mini", view_error = "notify",
view_warn = "mini", view_warn = "notify",
view_history = "popup", view_history = "popup",
view_search = false, view_search = false,
}, },
@@ -1619,24 +1566,19 @@ 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 = { presets = { command_palette = true, long_message_to_split = true },
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 = "Dismiss All" }, { "<leader>lx", function() require("noice").cmd("dismiss") end, desc = "Noice dismiss" },
{ "<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" },
}, },
@@ -1659,7 +1601,6 @@ 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(),