This commit is contained in:
diniamo 2024-11-22 11:13:50 +00:00 committed by GitHub
commit 22ef295f14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 91 additions and 0 deletions

View file

@ -201,6 +201,8 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
is bundled with nvf, if you enable the module, since there is no way to is bundled with nvf, if you enable the module, since there is no way to
provide only the LSP server. provide only the LSP server.
- Add `run.nvim` support for running code using cached commands.
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd() [Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
- Make Neovim's configuration file entirely Lua based. This comes with a few - Make Neovim's configuration file entirely Lua based. This comes with a few

View file

@ -1710,6 +1710,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-run-nvim": {
"flake": false,
"locked": {
"lastModified": 1732273891,
"narHash": "sha256-/YLSbKh0wV6VYlNWeGrEbUUBQuchNcJjm1zn6vwYmro=",
"owner": "diniamo",
"repo": "run.nvim",
"rev": "0ae1cb228341ffec317efea4247550610de6fe0e",
"type": "github"
},
"original": {
"owner": "diniamo",
"repo": "run.nvim",
"type": "github"
}
},
"plugin-rustaceanvim": { "plugin-rustaceanvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -2123,6 +2139,7 @@
"plugin-registers": "plugin-registers", "plugin-registers": "plugin-registers",
"plugin-rose-pine": "plugin-rose-pine", "plugin-rose-pine": "plugin-rose-pine",
"plugin-rtp-nvim": "plugin-rtp-nvim", "plugin-rtp-nvim": "plugin-rtp-nvim",
"plugin-run-nvim": "plugin-run-nvim",
"plugin-rustaceanvim": "plugin-rustaceanvim", "plugin-rustaceanvim": "plugin-rustaceanvim",
"plugin-smartcolumn": "plugin-smartcolumn", "plugin-smartcolumn": "plugin-smartcolumn",
"plugin-sqls-nvim": "plugin-sqls-nvim", "plugin-sqls-nvim": "plugin-sqls-nvim",

View file

@ -242,6 +242,12 @@
flake = false; flake = false;
}; };
# Runners
plugin-run-nvim = {
url = "github:diniamo/run.nvim";
flake = false;
};
# Debuggers # Debuggers
plugin-nvim-dap = { plugin-nvim-dap = {
url = "github:mfussenegger/nvim-dap"; url = "github:mfussenegger/nvim-dap";

View file

@ -31,6 +31,7 @@
"notes" "notes"
"projects" "projects"
"rich-presence" "rich-presence"
"runner"
"session" "session"
"snippets" "snippets"
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix # "spellcheck" # FIXME: see neovim/init/spellcheck.nix

View file

@ -0,0 +1,5 @@
{
imports = [
./run-nvim
];
}

View file

@ -0,0 +1,36 @@
{
lib,
config,
options,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding mkSetLuaLznBinding;
cfg = config.vim.runner.run-nvim;
mappingDefinitions = options.vim.runner.run-nvim.mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf cfg.enable {
vim.lazy.plugins.run-nvim = {
package = "run-nvim";
setupModule = "run";
inherit (cfg) setupOpts;
cmd = "Run";
keys = [
(mkSetLznBinding "n" mappings.run "<cmd>Run<CR>")
(mkSetLznBinding "n" mappings.runOverride "<cmd>Run!<CR>")
(mkSetLuaLznBinding "n" mappings.runCommand ''
function()
local input = vim.fn.input("Run command: ")
if input ~= "" then require("run").run(input, false) end
end
'')
];
};
vim.binds.whichKey.register."<leader>r" = mkDefault "+Run";
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./run-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,18 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options = {
vim.runner.run-nvim = {
enable = mkEnableOption "run.nvim";
setupOpts = mkPluginSetupOption "run.nvim" {};
mappings = {
run = mkMappingOption "Run cached" "<leader>ri";
runOverride = mkMappingOption "Run and override" "<leader>ro";
runCommand = mkMappingOption "Run prompt" "<leader>rc";
};
};
};
}