-- Keymaps for the language-aware project runner in lua/util/project.lua. -- -- r is already the refactoring group, so the run/project verbs live -- under R. Each verb dispatches on the detected project type, so the -- same key does the right thing in a Rust crate, a Python package or a Zephyr -- application. local function p(fn) return function() require("util.project")[fn]() end end return { { "folke/snacks.nvim", -- Remember the last real file buffer, so the run verbs still know which -- project you are in after one of them has opened a terminal (at which -- point the focused buffer is the terminal, not your code). init = function() vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { group = vim.api.nvim_create_augroup("project_run_last_file", { clear = true }), callback = function(ev) if vim.bo[ev.buf].buftype == "" then local name = vim.api.nvim_buf_get_name(ev.buf) if name ~= "" then vim.g.project_last_file = name end end end, }) end, -- stylua: ignore keys = { { "R", "", desc = "+run/project" }, { "Rr", p("run"), desc = "Run project" }, { "Rf", p("run_file"), desc = "Run current file" }, { "Rb", p("build"), desc = "Build" }, { "Rt", p("test"), desc = "Test" }, { "RF", p("flash"), desc = "Build + Flash (Zephyr)" }, { "Rs", p("select_target"), desc = "Select target/board" }, { "Rk", p("configure"), desc = "Configure (menuconfig/clippy)" }, { "Rc", p("clean"), desc = "Clean" }, { "Ri", p("info"), desc = "Project info" }, }, }, { "folke/which-key.nvim", opts = { spec = { { "R", group = "run/project", icon = " " }, }, }, }, }