Improve IDE with image preview

main
trivernis 1 year ago
parent 75d9b064f7
commit 552610b484
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -5,6 +5,19 @@ def main [] {
}
def `main open-file` [path: string] {
zellij action move-focus right
zellij action write-chars $":open ($path)\r"
match ($path | path parse | get extension | str downcase) {
"png" => { open-image $path }
"jpg" => { open-image $path }
"jpeg" => { open-image $path }
_ => { open-editor $path }
}
}
def open-editor [path: string] {
zellij ac move-focus right
zellij ac write-chars $":open ($path)\r"
}
def open-image [path: string] {
zellij ac new-pane -f -- chafa -C on --scale max $path
}

@ -1,4 +1,6 @@
modal = true
default_flags = "g"
show_selection_mark = true
[[verbs]]
invocation = "open"
@ -6,3 +8,9 @@ key = "enter"
external = "nu ~/.local/share/scripts/ide.nu open-file '{file}'"
apply_to = "file"
leave_broot = false
[[verbs]]
invocation = "touch {name}"
external = "nu -c \"touch {directory}/{name}\""
apply_to = "any"
leave_broot = false

@ -11,7 +11,7 @@ layout {
tab split_direction="Vertical" {
pane split_direction="Vertical" {
pane command="nu" size="15%" {
args "-c" "broot --conf ~/.config/broot/ide.toml"
args "-c" "broot --conf ~/.config/broot/ide.toml --sort-by-type-dirs-first"
}
pane command="nu" size="50%" {
args "-c helix"

Loading…
Cancel
Save