From d7ae87e67182f5fdd00cc08b61efa3436abf9a7b Mon Sep 17 00:00:00 2001 From: iofq Date: Mon, 21 Jul 2025 23:53:08 -0500 Subject: [PATCH] nixfmt, callHierarchy --- nix/neovim-overlay.nix | 2 +- nvim/lua/plugins/lsp.lua | 20 +++++++-- nvim/lua/plugins/treesitter.lua | 75 ++++++++++++++++----------------- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index f95bed6..1b83895 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -47,7 +47,7 @@ let yamllint jq hadolint - alejandra + nixfmt shellcheck # LSPs diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 88e4cb6..c6c1c56 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -62,6 +62,13 @@ return { require('plugins.lib.snacks').diagnostics { cwd = false } end, { buffer = ev.buf, desc = 'LSP diagnostics' }) + vim.keymap.set('n', 'grc', function() + vim.lsp.buf.incoming_calls() + end, { buffer = ev.buf, desc = 'LSP incoming_calls' }) + vim.keymap.set('n', 'gro', function() + vim.lsp.buf.outgoing_calls() + end, { buffer = ev.buf, desc = 'LSP outgoing_calls' }) + -- Auto-refresh code lenses if client.server_capabilities.codeLensProvider then vim.api.nvim_create_autocmd({ 'InsertLeave', 'TextChanged' }, { @@ -108,7 +115,7 @@ return { puppet = { 'puppet-lint' }, lua = { 'stylua' }, python = { 'ruff' }, - nix = { 'alejandra' }, + nix = { 'nixfmt' }, fish = { 'fish_indent' }, ['*'] = { 'trim_whitespace' }, }, @@ -117,7 +124,7 @@ return { if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then return end - return { timeout_ms = 500, lsp_format = 'last' } + return { timeout_ms = 1500, lsp_format = 'fallback' } end, default_format_opts = { timeout_ms = 1500, @@ -141,7 +148,14 @@ return { nix = { 'nix' }, php = { 'php' }, } - vim.api.nvim_command('au BufWritePost * lua require("lint").try_lint()') + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = vim.api.nvim_create_augroup('lint', { clear = true }), + callback = function() + if vim.bo.modifiable then + require('lint').try_lint() + end + end, + }) end, }, } diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index 51efd4d..cb8bbb1 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,54 +1,53 @@ return { { - 'nvim-treesitter/nvim-treesitter', - event = 'VeryLazy', + "nvim-treesitter/nvim-treesitter", + event = "VeryLazy", dependencies = { { - 'nvim-treesitter/nvim-treesitter-context', + "nvim-treesitter/nvim-treesitter-context", opts = { max_lines = 2, min_window_height = 50, }, }, - 'nvim-treesitter/nvim-treesitter-textobjects', - 'RRethy/nvim-treesitter-textsubjects', + "nvim-treesitter/nvim-treesitter-textobjects", + "RRethy/nvim-treesitter-textsubjects", }, - config = function() - require('nvim-treesitter.configs').setup { - ensure_installed = {}, - auto_install = false, - highlight = { + main = "nvim-treesitter.configs", + opts = { + ensure_installed = {}, + auto_install = false, + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + matchup = { + enable = true, + }, + textobjects = { + move = { enable = true, - }, - indent = { - enable = true, - }, - matchup = { - enable = true, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { - [']a'] = '@parameter.inner', - [']f'] = '@function.outer', - }, - goto_previous_start = { - ['[a'] = '@parameter.inner', - ['[f'] = '@function.outer', - }, + goto_next_start = { + ["]a"] = "@parameter.inner", + ["]f"] = "@function.outer", }, - swap = { - enable = true, - swap_next = { - ['a]'] = '@parameter.inner', - }, - swap_previous = { - ['a['] = '@parameter.inner', - }, + goto_previous_start = { + ["[a"] = "@parameter.inner", + ["[f"] = "@function.outer", }, }, - } - end, + swap = { + enable = true, + swap_next = { + ["a]"] = "@parameter.inner", + }, + swap_previous = { + ["a["] = "@parameter.inner", + }, + }, + }, + }, }, }