plugins/vim-suda: add back the smart_edit option

This commit is contained in:
Gaetan Lepage 2025-01-19 15:14:20 +01:00
parent 85e4e16de8
commit ab693bb1cd
2 changed files with 17 additions and 18 deletions

View file

@ -1,41 +1,40 @@
{ lib, helpers, ... }: { lib, ... }:
let
inherit (lib.nixvim) defaultNullOpts;
in
lib.nixvim.plugins.mkVimPlugin { lib.nixvim.plugins.mkVimPlugin {
name = "vim-suda"; name = "vim-suda";
globalPrefix = "suda#"; globalPrefix = "suda#";
maintainers = [ lib.maintainers.marcel ]; maintainers = [ lib.maintainers.marcel ];
settingsOptions = { settingsOptions = {
executable = helpers.defaultNullOpts.mkStr "sudo" '' executable = defaultNullOpts.mkStr "sudo" ''
Path to the sudo binary. Path to the sudo binary.
''; '';
noninteractive = helpers.defaultNullOpts.mkFlagInt 0 '' noninteractive = defaultNullOpts.mkFlagInt 0 ''
If set, suda will not prompt you for a password before saving a file. If set, suda will not prompt you for a password before saving a file.
It is supposed to support a setup with passwordless sudo or doas. It is supposed to support a setup with passwordless sudo or doas.
Use with care. Use with care.
''; '';
prompt = helpers.defaultNullOpts.mkStr "Password: " '' prompt = defaultNullOpts.mkStr "Password: " ''
A prompt string used to ask password. A prompt string used to ask password.
''; '';
# TODO: til https://github.com/lambdalisue/vim-suda/pull/84 smart_edit = defaultNullOpts.mkFlagInt 0 ''
# makes it into nixos-unstable If set, an `|autocmd|` is created that performs a heuristic check on
# NOTE: also update in `settingsExample` and test cases every buffer and decides whether to replace it with a suda buffer.
#smart_edit = helpers.defaultNullOpts.mkFlagInt 0 '' The check is done only once for every buffer and it is designed to be
# If set, an `|autocmd|` is created that performs a heuristic check on optimized as possible so you shouldn't feel any slowdown when opening
# every buffer and decides whether to replace it with a suda buffer. buffers.
# The check is done only once for every buffer and it is designed to be '';
# optimized as possible so you shouldn't feel any slowdown when opening
# buffers.
#'';
}; };
settingsExample = { settingsExample = {
path = "doas"; path = "doas";
noninteractive = 1; noninteractive = 1;
prompt = "Pass: "; prompt = "Pass: ";
#smart_edit = 1; smart_edit = 1;
}; };
} }

View file

@ -10,7 +10,7 @@
path = "sudo"; path = "sudo";
noninteractive = 0; noninteractive = 0;
prompt = "Password: "; prompt = "Password: ";
#smart_edit = 0; smart_edit = 0;
}; };
}; };
}; };
@ -22,7 +22,7 @@
path = "doas"; path = "doas";
noninteractive = 1; noninteractive = 1;
prompt = "Pass: "; prompt = "Pass: ";
#smart_edit = 1; smart_edit = 1;
}; };
}; };
}; };