Skip to content

Commit e08aab8

Browse files
committed
plugins/substitute: init
plugins/substitute: removed options and used nested plugins/substitute: changed example plugins/substitute: remove __raw plugins/substitute: Fixed failing test plugins/substitute: removedplugins/substitute: init removed
1 parent 027c96a commit e08aab8

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
lib,
3+
...
4+
}:
5+
lib.nixvim.plugins.mkNeovimPlugin {
6+
name = "substitute";
7+
package = "substitute-nvim";
8+
description = "Operator to substitute and exchange text objects quickly.";
9+
10+
maintainers = [ lib.maintainers.fwastring ];
11+
12+
settingsExample = {
13+
on_substitute = lib.nixvim.nestedLiteralLua ''
14+
function(params)
15+
vim.notify("substituted using register " .. params.register)
16+
end
17+
'';
18+
19+
yank_substituted_text = true;
20+
modifiers = [
21+
"join"
22+
"trim"
23+
];
24+
highlight_substituted_text.timer = 750;
25+
range = {
26+
prefix = "S";
27+
complete_word = true;
28+
confirm = true;
29+
subject.motion = "iw";
30+
range.motion = "ap";
31+
suffix = "| call histdel(':', -1)";
32+
auto_apply = true;
33+
cursor_position = "start";
34+
};
35+
exchange = {
36+
motion = "ap";
37+
use_esc_to_cancel = false;
38+
preserve_cursor_position = true;
39+
};
40+
};
41+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{ lib }:
2+
{
3+
empty = {
4+
plugins.substitute.enable = true;
5+
};
6+
7+
defaults = {
8+
plugins.substitute = {
9+
enable = true;
10+
settings = {
11+
on_substitute = lib.nixvim.mkRaw "nil";
12+
yank_substituted_text = false;
13+
preserve_cursor_position = false;
14+
modifiers = lib.nixvim.mkRaw "nil";
15+
16+
highlight_substituted_text = {
17+
enabled = true;
18+
timer = 500;
19+
};
20+
range = {
21+
prefix = "s";
22+
prompt_current_text = false;
23+
confirm = false;
24+
complete_word = false;
25+
group_substituted_text = false;
26+
subject = lib.nixvim.mkRaw "nil";
27+
range = lib.nixvim.mkRaw "nil";
28+
register = lib.nixvim.mkRaw "nil";
29+
suffix = "";
30+
auto_apply = false;
31+
cursor_position = "end";
32+
};
33+
exchange = {
34+
motion = lib.nixvim.mkRaw "nil";
35+
use_esc_to_cancel = true;
36+
preserve_cursor_position = false;
37+
};
38+
};
39+
};
40+
};
41+
42+
example = {
43+
plugins.substitute = {
44+
enable = true;
45+
settings = {
46+
on_substitute = lib.nixvim.mkRaw ''
47+
function(params)
48+
vim.notify("substituted using register " .. params.register)
49+
end
50+
'';
51+
yank_substituted_text = true;
52+
modifiers = [
53+
"join"
54+
"trim"
55+
];
56+
highlight_substituted_text.timer = 750;
57+
range = {
58+
prefix = "S";
59+
complete_word = true;
60+
confirm = true;
61+
subject.motion = "iw";
62+
range.motion = "ap";
63+
suffix = "| call histdel(':', -1)";
64+
auto_apply = true;
65+
cursor_position = "start";
66+
};
67+
exchange = {
68+
motion = "ap";
69+
use_esc_to_cancel = false;
70+
preserve_cursor_position = true;
71+
};
72+
};
73+
};
74+
};
75+
}

0 commit comments

Comments
 (0)