Skip to content

Commit dad135b

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 844ea38 commit dad135b

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{ lib, ... }:
2+
lib.nixvim.plugins.mkNeovimPlugin {
3+
name = "substitute";
4+
package = "substitute-nvim";
5+
description = "Operator to substitute and exchange text objects quickly.";
6+
7+
maintainers = [ lib.maintainers.fwastring ];
8+
9+
settingsExample = {
10+
on_substitute = lib.nixvim.nestedLiteralLua ''
11+
function(params)
12+
vim.notify("substituted using register " .. params.register)
13+
end
14+
'';
15+
16+
yank_substituted_text = true;
17+
modifiers = [
18+
"join"
19+
"trim"
20+
];
21+
highlight_substituted_text.timer = 750;
22+
range = {
23+
prefix = "S";
24+
complete_word = true;
25+
auto_apply = true;
26+
cursor_position = "start";
27+
};
28+
};
29+
}
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)