Improve the ide script

main
trivernis 10 months ago
parent 23d02a0d91
commit bcfceb416b
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,3 +1,7 @@
scroll_buffer_size 10000
copy_command "wl-copy"
auto_layout false
layout {
default_tab_template {
pane size=1 borderless=true {
@ -8,7 +12,7 @@ layout {
plugin location="zellij:status-bar"
}
}
tab split_direction="Vertical" {
tab name="Editor" split_direction="Vertical" hide_floating_panes=true {
pane split_direction="Vertical" {
pane command="nu" size="15%" {
args "-c" "broot --conf {{dirs.config}}/broot/ide.toml --sort-by-type-dirs-first"
@ -25,6 +29,3 @@ layout {
}
}
}
scroll_buffer_size 10000
copy_command "wl-copy"
auto_layout false

@ -1,7 +1,11 @@
#!/bin/env nu
def main [] {
zellij --layout {{dirs.config}}/zellij/development.toml
if $env.ZELLIJ? == null {
zellij --layout {{dirs.config}}/zellij/development.toml --session (session-name)
} else {
zellij action new-tab --layout {{dirs.config}}/zellij/development.toml --name (tab-name)
}
}
def `main open-file` [path: string] {
@ -21,3 +25,20 @@ def open-editor [path: string] {
def open-image [path: string] {
zellij ac new-pane -f -- chafa -C on --scale max $path
}
def session-name [] {
let dirname = $env.PWD | path parse | get stem
let suffix = ( zellij list-sessions -s
| split row "\n"
| where $it =~ $"ide-($dirname)"
| first
| hash md5
| str substring 0..4
)
$"ide-($dirname)-($suffix)"
}
def tab-name [] {
let dirname = $env.PWD | path parse | get stem
$"Editor \(($dirname)\)"
}

Loading…
Cancel
Save