mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
fix(neovim): Rust test-coverage plugin & coding qol improvements
- Rust: `nvim-coverage` for generating code-coverage report - Rust: Keymaps & nvim-job for test-coverage report display - Coding-QOL: Remove distracting & noisy diagnostic virtual-line - Coding-QOL: Keymaps to disable diagnostic virtual text - Coding-QOL: Disable diagnostic underlines - Fix: Disable telescope `hightlight` to fix frequent crash - Coding-QOL: Telescope Keymaps to move between loops - Coding-QOL: Disable auto fn doc hover through `blink`; `LSPSaga` does it better - Coding-QOL: Adding back `quick-scope` with proper config - Keymap: Use `ctrl-p` to search files; same as vscode
This commit is contained in:
@@ -241,31 +241,7 @@ return {
|
||||
require("lazy.core.loader").add_to_rtp(plugin)
|
||||
require("nvim-treesitter.query_predicates")
|
||||
end,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
config = function()
|
||||
-- When in diff mode, we want to use the default
|
||||
-- vim text objects c & C instead of the treesitter ones.
|
||||
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
for name, fn in pairs(move) do
|
||||
if name:find("goto") == 1 then
|
||||
move[name] = function(q, ...)
|
||||
if vim.wo.diff then
|
||||
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
|
||||
for key, query in pairs(config or {}) do
|
||||
if q == query and key:find("[%]%[][cC]") then
|
||||
vim.cmd("normal! " .. key)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
return fn(q, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
|
||||
config = function()
|
||||
-- See `:help nvim-treesitter`
|
||||
@@ -301,7 +277,7 @@ return {
|
||||
},
|
||||
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
-- highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
|
||||
incremental_selection = {
|
||||
@@ -339,18 +315,22 @@ return {
|
||||
goto_next_start = {
|
||||
["]f"] = { query = "@function.outer", desc = "Goto next inner function start" },
|
||||
["]c"] = { query = "@class.outer", desc = "Goto next inner class start" },
|
||||
["]o"] = { query = "@loop.*", desc = "Goto next loop start" },
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = { query = "@function.outer", desc = "Goto next outer function end" },
|
||||
["]C"] = { query = "@class.outer", desc = "Goto next outer class end" },
|
||||
["]O"] = { query = "@loop.*", desc = "Goto next loop end" },
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = { query = "@function.outer", desc = "Goto goto previous inner function start" },
|
||||
["[c"] = { query = "@class.outer", desc = "Previous inner class start" },
|
||||
["[o"] = { query = "@loop.*", desc = "Goto previous loop start" },
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = { query = "@function.outer", desc = "Goto goto previous outer function start" },
|
||||
["[C"] = { query = "@class.outer", desc = "Goto previous outer class start" },
|
||||
["[O"] = { query = "@loop.*", desc = "Goto previous loop start" },
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -121,4 +121,30 @@ return {
|
||||
{ "<leader>tS", function() require("neotest").summary.toggle() end, desc = "Test: Toggle Summary Panel" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"andythigpen/nvim-coverage",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("coverage").setup({
|
||||
auto_load = true,
|
||||
commands = true, -- Enable coverage commands
|
||||
highlights = {
|
||||
covered = { fg = "#C3E88D" }, -- Green for covered lines
|
||||
uncovered = { fg = "#F07178" }, -- Red for uncovered lines
|
||||
},
|
||||
signs = {
|
||||
covered = { hl = "CoverageCovered", text = "▎" },
|
||||
uncovered = { hl = "CoverageUncovered", text = "▎" },
|
||||
},
|
||||
summary = {
|
||||
min_coverage = 80.0, -- Minimum coverage percentage
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>tC", function()
|
||||
require("coverage").summary()
|
||||
end, { desc = "Test: Toggle coverage" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,10 +55,6 @@ return {
|
||||
border = "rounded",
|
||||
draw = { treesitter = { "lsp" } },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 100,
|
||||
},
|
||||
ghost_text = { enabled = false },
|
||||
trigger = { show_on_trigger_character = true },
|
||||
},
|
||||
|
||||
@@ -6,6 +6,18 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"unblevable/quick-scope",
|
||||
init = function()
|
||||
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
|
||||
|
||||
vim.cmd([[
|
||||
highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline
|
||||
highlight QuickScopeSecondary guifg='#00C7DF' gui=underline ctermfg=81 cterm=underline
|
||||
]])
|
||||
end,
|
||||
},
|
||||
|
||||
-- File Explorer: Neotree
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
@@ -169,8 +181,7 @@ return {
|
||||
vim.keymap.set("n", "<C-S-f>", require("telescope.builtin").live_grep, { desc = "Search/LiveGrep the Project" })
|
||||
|
||||
-- List
|
||||
-- NOTE: Needs terminal configured to send correct key code to NeoVim: \x1b[80;5u
|
||||
vim.keymap.set("n", "<C-S-p>", require("telescope.builtin").find_files, { desc = "Search Files" })
|
||||
vim.keymap.set("n", "<C-p>", require("telescope.builtin").find_files, { desc = "Search Files" })
|
||||
|
||||
-- Git
|
||||
vim.keymap.set("n", "<leader>gc", require("telescope.builtin").git_commits, { desc = "Git: Commits" })
|
||||
|
||||
Reference in New Issue
Block a user