--[[ 50-runner.lua — run the current buffer's file with a per-filetype command. Registers a run command for each supported file type and exposes running the current buffer through the dotfiles.runner engine. User commands: Run: run the current buffer's file Keymaps: `r` run the current buffer's file ]] local runner = require("dotfiles.runner") ---------------------------------------------------------------------------------------------------- -- Runners ----------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -- The `sh` runner shells out to ; `%` expands to the current file path. runner.register("lua", { "nvim", "-l", "%" }) runner.register("python", { "python", "%" }) runner.register("sh", { "bash", "%" }) ---------------------------------------------------------------------------------------------------- -- Commands & keymaps ------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------- -- Run the current buffer's file. local function run_current() runner.run() end -- stylua: ignore start vim.api.nvim_create_user_command("Run", run_current, { desc = "Run the current buffer" }) vim.keymap.set("n", "r", run_current, { desc = "Run the current buffer" })