local M = {} -- local file_name = vim.fn.expand("%:t") -- local file_name_no_ext = vim.fn.expand("%:t:r") if pcode.active_cpp_config then M = { { "nvimtools/none-ls.nvim", optional = true, opts = function(_, opts) local nls = require("null-ls") opts.sources = opts.sources or {} table.insert(opts.sources, nls.builtins.formatting.clang_format.with({ filetypes = { "cpp", "c" } })) end, }, { "nvim-neotest/neotest", ft = { "cpp" }, dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-neotest/nvim-nio", "antoinemadec/FixCursorHold.nvim", "nvim-lua/plenary.nvim", "alfaix/neotest-gtest", }, config = function() require("neotest").setup({ adapters = { require("neotest-gtest").setup({}), }, }) end, -- stylua: ignore keys = { { "T","",desc="  Test"}, { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, { "rc", "terminalg++ --debug main.cpp -o main", desc = "Compile Debug main.cpp" }, }, }, { "stevearc/conform.nvim", event = { "BufReadPre", "BufNewFile" }, opts = function(_, opts) opts.formatters_by_ft = opts.formatters_by_ft or {} opts.formatters_by_ft.cpp = { "clang-format" } opts.format_on_save = { timeout_ms = 500, lsp_fallback = true, } return opts end, config = function(_, opts) local conform = require("conform") conform.setup(opts) vim.keymap.set({ "n", "v" }, "lF", function() conform.format({ lsp_fallback = true, async = false, timeout_ms = 500, }) end, { desc = "Format file or range (in visual mode)" }) end, }, } end return M