Skip to content

Commit 0533100

Browse files
committed
plugins/vim-suda: init
1 parent fc9178d commit 0533100

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

plugins/by-name/vim-suda/default.nix

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{ lib, helpers, ... }:
2+
3+
lib.nixvim.vim-plugin.mkVimPlugin {
4+
name = "vim-suda";
5+
globalPrefix = "suda#";
6+
maintainers = [ lib.maintainers.marcel ];
7+
8+
settingsOptions = {
9+
executable = helpers.defaultNullOpts.mkStr "sudo" ''
10+
Path to the sudo binary.
11+
'';
12+
13+
noninteractive = helpers.defaultNullOpts.mkFlagInt 0 ''
14+
If set, suda will not prompt you for a password before saving a file.
15+
It is supposed to support a setup with passwordless sudo or doas.
16+
Use with care.
17+
'';
18+
19+
prompt = helpers.defaultNullOpts.mkStr "Password: " ''
20+
A prompt string used to ask password.
21+
'';
22+
23+
# TODO: til https://github.com/lambdalisue/vim-suda/pull/84
24+
# makes it into nixos-unstable
25+
# NOTE: also update in `settingsExample` and test cases
26+
#smart_edit = helpers.defaultNullOpts.mkFlagInt 0 ''
27+
# If set, an `|autocmd|` is created that performs a heuristic check on
28+
# every buffer and decides whether to replace it with a suda buffer.
29+
# The check is done only once for every buffer and it is designed to be
30+
# optimized as possible so you shouldn't feel any slowdown when opening
31+
# buffers.
32+
#'';
33+
};
34+
35+
settingsExample = {
36+
path = "doas";
37+
noninteractive = 1;
38+
prompt = "Pass: ";
39+
#smart_edit = 1;
40+
};
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
empty = {
3+
plugins.vim-suda.enable = true;
4+
};
5+
6+
defaults = {
7+
plugins.vim-suda = {
8+
enable = true;
9+
settings = {
10+
path = "sudo";
11+
noninteractive = 0;
12+
prompt = "Password: ";
13+
#smart_edit = 0;
14+
};
15+
};
16+
};
17+
18+
example = {
19+
plugins.vim-suda = {
20+
enable = true;
21+
settings = {
22+
path = "doas";
23+
noninteractive = 1;
24+
prompt = "Pass: ";
25+
#smart_edit = 1;
26+
};
27+
};
28+
};
29+
}

0 commit comments

Comments
 (0)