mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
runner/run-nvim: init
This commit is contained in:
parent
b6785f8218
commit
e52c0c7846
8 changed files with 91 additions and 0 deletions
|
@ -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
|
||||||
|
|
17
flake.lock
17
flake.lock
|
@ -1710,6 +1710,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-run-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732227783,
|
||||||
|
"narHash": "sha256-csaSdZLmgXF9ShHbwhwVIx9l4/nVPzxG72g1xFv4JHA=",
|
||||||
|
"owner": "diniamo",
|
||||||
|
"repo": "run.nvim",
|
||||||
|
"rev": "c028adc1141b78e0773757e69851e2d255e8c799",
|
||||||
|
"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",
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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
|
||||||
|
|
5
modules/plugins/runner/default.nix
Normal file
5
modules/plugins/runner/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./run-nvim
|
||||||
|
];
|
||||||
|
}
|
36
modules/plugins/runner/run-nvim/config.nix
Normal file
36
modules/plugins/runner/run-nvim/config.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/runner/run-nvim/default.nix
Normal file
6
modules/plugins/runner/run-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./run-nvim.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
18
modules/plugins/runner/run-nvim/run-nvim.nix
Normal file
18
modules/plugins/runner/run-nvim/run-nvim.nix
Normal 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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue