added trouble and neotest plugins

added trouble and neotest plugins
This commit is contained in:
Simon Ayoub 2025-03-17 15:35:59 +11:00
parent c7833981d5
commit 35472c5be5
1 changed files with 229 additions and 61 deletions

290
init.lua
View File

@ -149,7 +149,7 @@ vim.opt.splitbelow = true
-- See `:help 'list'` -- See `:help 'list'`
-- and `:help 'listchars'` -- and `:help 'listchars'`
vim.opt.list = true vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' } vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '', eol = ''}
-- Preview substitutions live, as you type! -- Preview substitutions live, as you type!
vim.opt.inccommand = 'split' vim.opt.inccommand = 'split'
@ -340,7 +340,7 @@ require('lazy').setup({
-- --
-- Use the `dependencies` key to specify the dependencies of a particular plugin -- Use the `dependencies` key to specify the dependencies of a particular plugin
{ {
"folke/snacks.nvim", 'folke/snacks.nvim',
priority = 1000, priority = 1000,
lazy = false, lazy = false,
---@type snacks.Config ---@type snacks.Config
@ -361,49 +361,154 @@ require('lazy').setup({
styles = { styles = {
notification = { notification = {
-- wo = { wrap = true } -- Wrap notifications -- wo = { wrap = true } -- Wrap notifications
} },
} },
}, },
keys = { keys = {
{ "<leader>z", function() Snacks.zen() end, desc = "Toggle Zen Mode" },
{ "<leader>Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" },
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
{ "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
{ "<leader>cR", function() Snacks.rename.rename_file() end, desc = "Rename File" },
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
{ "<leader>gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line" },
{ "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit Current File History" },
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
{ "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log (cwd)" },
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
{ "<c-_>", function() Snacks.terminal() end, desc = "which_key_ignore" },
{ "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } },
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } },
{ {
"<leader>N", '<leader>z',
desc = "Neovim News",
function() function()
Snacks.win({ Snacks.zen()
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], end,
desc = 'Toggle Zen Mode',
},
{
'<leader>Z',
function()
Snacks.zen.zoom()
end,
desc = 'Toggle Zoom',
},
{
'<leader>.',
function()
Snacks.scratch()
end,
desc = 'Toggle Scratch Buffer',
},
{
'<leader>S',
function()
Snacks.scratch.select()
end,
desc = 'Select Scratch Buffer',
},
{
'<leader>n',
function()
Snacks.notifier.show_history()
end,
desc = 'Notification History',
},
{
'<leader>bd',
function()
Snacks.bufdelete()
end,
desc = 'Delete Buffer',
},
{
'<leader>cR',
function()
Snacks.rename.rename_file()
end,
desc = 'Rename File',
},
{
'<leader>gB',
function()
Snacks.gitbrowse()
end,
desc = 'Git Browse',
mode = { 'n', 'v' },
},
{
'<leader>gb',
function()
Snacks.git.blame_line()
end,
desc = 'Git Blame Line',
},
{
'<leader>gf',
function()
Snacks.lazygit.log_file()
end,
desc = 'Lazygit Current File History',
},
{
'<leader>gg',
function()
Snacks.lazygit()
end,
desc = 'Lazygit',
},
{
'<leader>gl',
function()
Snacks.lazygit.log()
end,
desc = 'Lazygit Log (cwd)',
},
{
'<leader>un',
function()
Snacks.notifier.hide()
end,
desc = 'Dismiss All Notifications',
},
{
'<c-/>',
function()
Snacks.terminal()
end,
desc = 'Toggle Terminal',
},
{
'<c-_>',
function()
Snacks.terminal()
end,
desc = 'which_key_ignore',
},
{
']]',
function()
Snacks.words.jump(vim.v.count1)
end,
desc = 'Next Reference',
mode = { 'n', 't' },
},
{
'[[',
function()
Snacks.words.jump(-vim.v.count1)
end,
desc = 'Prev Reference',
mode = { 'n', 't' },
},
{
'<leader>N',
desc = 'Neovim News',
function()
Snacks.win {
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
width = 0.6, width = 0.6,
height = 0.6, height = 0.6,
wo = { wo = {
spell = false, spell = false,
wrap = false, wrap = false,
signcolumn = "yes", signcolumn = 'yes',
statuscolumn = " ", statuscolumn = ' ',
conceallevel = 3, conceallevel = 3,
}, },
}) }
end, end,
} },
}, },
init = function() init = function()
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd('User', {
pattern = "VeryLazy", pattern = 'VeryLazy',
callback = function() callback = function()
-- Setup some globals for debugging (lazy-loaded) -- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...) _G.dd = function(...)
@ -415,17 +520,17 @@ require('lazy').setup({
vim.print = _G.dd -- Override print to use snacks for `:=` command vim.print = _G.dd -- Override print to use snacks for `:=` command
-- Create some toggle mappings -- Create some toggle mappings
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us") Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw") Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL") Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
Snacks.toggle.diagnostics():map("<leader>ud") Snacks.toggle.diagnostics():map '<leader>ud'
Snacks.toggle.line_number():map("<leader>ul") Snacks.toggle.line_number():map '<leader>ul'
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc") Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
Snacks.toggle.treesitter():map("<leader>uT") Snacks.toggle.treesitter():map '<leader>uT'
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub") Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
Snacks.toggle.inlay_hints():map("<leader>uh") Snacks.toggle.inlay_hints():map '<leader>uh'
Snacks.toggle.indent():map("<leader>ug") Snacks.toggle.indent():map '<leader>ug'
Snacks.toggle.dim():map("<leader>uD") Snacks.toggle.dim():map '<leader>uD'
end, end,
}) })
end, end,
@ -727,14 +832,14 @@ require('lazy').setup({
}) })
-- Change diagnostic symbols in the sign column (gutter) -- Change diagnostic symbols in the sign column (gutter)
-- if vim.g.have_nerd_font then if vim.g.have_nerd_font then
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
-- local diagnostic_signs = {} local diagnostic_signs = {}
-- for type, icon in pairs(signs) do for type, icon in pairs(signs) do
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon diagnostic_signs[vim.diagnostic.severity[type]] = icon
-- end end
-- vim.diagnostic.config { signs = { text = diagnostic_signs } } vim.diagnostic.config { signs = { text = diagnostic_signs } }
-- end end
-- LSP servers and clients are able to communicate to each other what features they support. -- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification. -- By default, Neovim doesn't support everything that is in the LSP specification.
@ -1082,18 +1187,82 @@ require('lazy').setup({
}, },
{ {
'mg979/vim-visual-multi', 'mg979/vim-visual-multi',
-- See https://github.com/mg979/vim-visual-multi/issues/241 -- See https://github.com/mg979/vim-visual-multi/issues/241
init = function() init = function()
vim.g.VM_default_mappings = 0 vim.g.VM_default_mappings = 0
vim.g.VM_maps = { vim.g.VM_maps = {
['Find Under'] = '' ['Find Under'] = '',
} }
vim.g.VM_add_cursor_at_pos_no_mappings = 1 vim.g.VM_add_cursor_at_pos_no_mappings = 1
end, end,
}, },
{ {
'wakatime/vim-wakatime', 'wakatime/vim-wakatime',
lazy = false lazy = false,
},
{
'nvim-neotest/neotest',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-neotest/nvim-nio',
'nvim-lua/plenary.nvim',
'antoinemadec/FixCursorHold.nvim',
'nvim-treesitter/nvim-treesitter',
'alfaix/neotest-gtest',
},
config = function()
require('neotest').setup {
adapters = {
require('neotest-gtest').setup {
-- Add neotest-gtest specific configuration here if needed
-- For example, to specify the test runner:
-- runner = "path/to/your/gtest_runner", -- If not in your PATH
-- Or other options as described in the neotest-gtest documentation.
},
},
-- Add neotest general configuration here if needed
-- For example, to change the default behavior:
-- open_on_run = true,
-- ... other neotest options
}
end,
},
{
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
cmd = "Trouble",
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
}, },
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and -- init.lua. If you want these files, they are in the repository, so you can just download them and
@ -1117,8 +1286,7 @@ require('lazy').setup({
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
{ import = 'custom.plugins' }, { import = 'custom.plugins' },
}, }, {
{
ui = { ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table