mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
Merge pull request #474 from diniamo/run-nvim
Some checks are pending
Check for typos in the source tree / check-typos (push) Waiting to run
Some checks are pending
Check for typos in the source tree / check-typos (push) Waiting to run
runner/run-nvim: init
This commit is contained in:
commit
29b7c415a9
12 changed files with 119 additions and 15 deletions
|
@ -59,5 +59,10 @@ in {
|
|||
With Trouble having so many different modes, and breaking changes
|
||||
upstream, it no longer makes sense, nor works, to toggle only Trouble.
|
||||
'')
|
||||
# 2024-11-30
|
||||
(mkRemovedOptionModule ["vim" "leaderKey"] ''
|
||||
This has been deprecated in favor of using the more generic `vim.globals`
|
||||
(you can use `vim.globals.mapleader` to change this instead).
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
"notes"
|
||||
"projects"
|
||||
"rich-presence"
|
||||
"runner"
|
||||
"session"
|
||||
"snippets"
|
||||
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
||||
|
|
|
@ -14,12 +14,6 @@
|
|||
cfg = config.vim;
|
||||
in {
|
||||
options.vim = {
|
||||
leaderKey = mkOption {
|
||||
type = str;
|
||||
default = " ";
|
||||
description = "The leader key used for `<leader>` mappings";
|
||||
};
|
||||
|
||||
colourTerm = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
|
@ -197,8 +191,6 @@ in {
|
|||
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||
|
||||
${optionalString cfg.undoFile.enable ''
|
||||
vim.o.undofile = true
|
||||
|
|
|
@ -145,13 +145,13 @@ in {
|
|||
on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
|
||||
vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
|
||||
vim.keymap.set("n", "<localleader>rr", ":RustLsp runnables<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rp", ":RustLsp parentModule<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||
vim.keymap.set("n", "<localleader>rc", ":RustLsp openCargo", opts)
|
||||
vim.keymap.set("n", "<localleader>rg", ":RustLsp crateGraph x11", opts)
|
||||
${optionalString cfg.dap.enable ''
|
||||
vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
|
||||
vim.keymap.set("n", "<localleader>rd", ":RustLsp debuggables<cr>", opts)
|
||||
vim.keymap.set(
|
||||
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||
function()
|
||||
|
|
5
modules/plugins/runner/default.nix
Normal file
5
modules/plugins/runner/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./run-nvim
|
||||
];
|
||||
}
|
38
modules/plugins/runner/run-nvim/config.nix
Normal file
38
modules/plugins/runner/run-nvim/config.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
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
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -101,7 +101,10 @@ in {
|
|||
|
||||
globals = mkOption {
|
||||
type = attrs;
|
||||
default = {};
|
||||
default = {
|
||||
mapleader = " ";
|
||||
maplocalleader = ",";
|
||||
};
|
||||
example = {"some_variable" = 42;};
|
||||
description = ''
|
||||
An attribute set containing global variable values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue