blob: 3d08603c4890544c296ab96c10535d81555edf68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{
pkgs,
config,
lib,
tsunamiLib,
std,
...
}: let
inherit (tsunamiLib) scriptPath filePath;
cfg = config.tsunami.findFile;
in {
options = {
tsunami.findFile = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
};
config = lib.mkIf cfg.enable {
tsunami.keys.leader = [
{
name = "Find File";
key = "C-f";
exec = ''run-shell "${scriptPath "minibuffer"} -d '#{?@default-path,#{@default-path},#{pane_current_path}}' '${scriptPath "find-file"}'"'';
}
];
tsunami.scripts = {
"minibuffer" = ''
window_height="$(tmux display -p '#{window_height}')"
tmux display-popup -EB \
-w 100% -h 16 \
-x 0 -y "$(($window_height + 1))" \
"$@"
'';
"find-file" = ''${pkgs.broot}/bin/broot --conf ${filePath "broot_find_file.toml"}'';
};
tsunami.files."broot_find_file.toml" = std.serde.toTOML {
imports = ["~/.config/broot/conf.hjson"];
quit_on_last_cancel = true;
verbs = [
{
invocation = "tmux-split";
external = ["bash" "-c" ''${scriptPath "split"} -c "#{?@default-path,#{@default-path},#{pane_current_path}}" "$EDITOR '{file}'"''];
key = "ctrl-s";
apply_to = "file";
leave_broot = true;
}
{
invocation = "tmux-window";
external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "$EDITOR '{file}'"];
key = "ctrl-w";
apply_to = "file";
leave_broot = true;
}
{
key = "enter";
cmd = ":tmux-window";
}
];
};
};
}
|