editor: drop zellij IDE layer, keep helix as terminal editor

This commit is contained in:
elwrcl committed 2026-09-07 16:01:05 +03:00
1 parent 31f883a0cd
commit fde7614c99
6 files changed
+1 -275

No files matched your search

-3
View File
@@ -41,13 +41,10 @@ in
config.flake.homeModules.home-nushell-greeting config.flake.homeModules.home-nushell-greeting
config.flake.homeModules.home-helix config.flake.homeModules.home-helix
config.flake.homeModules.home-helix-keys config.flake.homeModules.home-helix-keys
config.flake.homeModules.home-helix-sidebar
config.flake.homeModules.home-helix-languages config.flake.homeModules.home-helix-languages
config.flake.homeModules.home-helix-language-servers config.flake.homeModules.home-helix-language-servers
config.flake.homeModules.home-zellij config.flake.homeModules.home-zellij
config.flake.homeModules.home-zellij-keybinds config.flake.homeModules.home-zellij-keybinds
config.flake.homeModules.home-zellij-layout-ide
config.flake.homeModules.home-zellij-ide-command
config.flake.homeModules.home-vscode config.flake.homeModules.home-vscode
config.flake.homeModules.home-vscode-extensions config.flake.homeModules.home-vscode-extensions
config.flake.homeModules.home-vscode-helix config.flake.homeModules.home-vscode-helix
@@ -14,7 +14,6 @@
"keep_primary_selection" "keep_primary_selection"
]; ];
"A-s" = ":sh hx-sidebar-toggle";
"A-S" = "split_selection_on_newline"; "A-S" = "split_selection_on_newline";
"C-f" = "search"; "C-f" = "search";
@@ -1,127 +0,0 @@
{ ... }:
{
flake.homeModules.home-helix-sidebar =
{ config, pkgs, ... }:
let
open = pkgs.writeShellApplication {
name = "hx-open";
runtimeInputs = [
config.programs.zellij.finalPackage
pkgs.gnused
];
text = ''
if [ "$#" -eq 0 ]; then
exit 0
fi
quote() {
printf "'%s'" "$(printf '%s' "$1" | sed "s/'/&&/g")"
}
zellij action move-focus right >/dev/null 2>&1 || true
if [ "$#" -eq 1 ] && [ -d "$1" ]; then
command=":cd $(quote "$1")"
else
args=""
for path in "$@"; do
args="$args $(quote "$path")"
done
command=":open$args"
fi
zellij action write 27 >/dev/null 2>&1
zellij action write-chars "$command" >/dev/null 2>&1
zellij action write 13 >/dev/null 2>&1
'';
};
sidebarConfig = pkgs.writeTextDir "yazi.toml" ''
[mgr]
ratio = [ 1, 1, 2 ]
show_hidden = false
show_symlink = true
linemode = "size"
scrolloff = 4
sort_by = "natural"
sort_dir_first = true
[[plugin.prepend_fetchers]]
url = "*"
run = "git"
group = "git"
[[plugin.prepend_fetchers]]
url = "*/"
run = "git"
group = "git"
[opener]
edit = [
{ run = '$EDITOR "$@"', block = false, for = "unix" },
]
'';
sidebar = pkgs.writeShellApplication {
name = "hx-sidebar";
runtimeInputs = [
pkgs.yazi
pkgs.git
];
text = ''
cd "''${1:-.}"
export YAZI_CONFIG_HOME=${sidebarConfig}
export EDITOR=${open}/bin/hx-open
export VISUAL="$EDITOR"
echo $$ > "''${XDG_RUNTIME_DIR:-/tmp}/hx-sidebar.''${ZELLIJ_SESSION_NAME:-none}"
exec yazi .
'';
};
toggle = pkgs.writeShellApplication {
name = "hx-sidebar-toggle";
runtimeInputs = [
config.programs.zellij.finalPackage
pkgs.coreutils
];
text = ''
if [ -z "''${ZELLIJ_SESSION_NAME:-}" ]; then
echo "hx-sidebar-toggle: not inside a zellij session" >&2
exit 1
fi
marker="''${XDG_RUNTIME_DIR:-/tmp}/hx-sidebar.''${ZELLIJ_SESSION_NAME}"
pid=""
if [ -r "$marker" ]; then
pid=$(cat "$marker")
fi
if [ -n "$pid" ] && [ "$(cat "/proc/$pid/comm" 2>/dev/null || true)" = "yazi" ]; then
kill "$pid"
rm -f "$marker"
exit 0
fi
rm -f "$marker"
id=$(zellij action new-pane \
--direction right \
--name files \
--close-on-exit \
-- ${sidebar}/bin/hx-sidebar "$PWD")
zellij action move-pane --pane-id "$id" left >/dev/null
for _ in 1 2 3 4 5; do
zellij action resize --pane-id "$id" decrease right >/dev/null 2>&1
done
'';
};
in
{
home.packages = [
open
sidebar
toggle
];
};
}
+1 -1
View File
@@ -11,7 +11,7 @@
shellAliases = { shellAliases = {
e = "hx"; e = "hx";
cop = "ide ~/copland"; cop = "codium ~/copland";
}; };
#/nu/# #/nu/#
extraConfig = '' extraConfig = ''
@@ -1,44 +0,0 @@
{ ... }:
{
flake.homeModules.home-zellij-ide-command =
{ config, pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication {
name = "ide";
runtimeInputs = [
config.programs.zellij.finalPackage
pkgs.coreutils
pkgs.gawk
];
text = ''
case "''${1:-}" in
-h | --help)
echo "usage: ide [directory]"
echo
echo "opens re-attaches to a Zellij session named after the"
echo "directory, running Helix in the 'ide' layout."
exit 0
;;
esac
cd "''${1:-.}"
session=$(basename "$PWD")
session=$(printf '%s' "$session" | tr -c 'A-Za-z0-9._-' '-')
if zellij list-sessions --no-formatting 2>/dev/null |
awk -v s="$session" '$1 == s && $0 !~ /EXITED/ { hit = 1 } END { exit !hit }'; then
exec zellij attach "$session"
fi
# Drop any dead session squatting on the name so the layout is rebuilt
# from scratch rather than resurrected.
zellij delete-session "$session" >/dev/null 2>&1 || true
exec zellij --session "$session" --new-session-with-layout ide
'';
})
];
};
}
@@ -1,99 +0,0 @@
{ ... }:
{
flake.homeModules.home-zellij-layout-ide =
{
config,
lib,
pkgs,
...
}:
let
p = config.elars.theme.palette;
c = hex: "#${hex}";
bg = c p.base00;
bgAlt = c p.base01;
dim = c p.base03;
muted = c p.base04;
accent = c p.accent;
mode =
key: background: label:
''mode_${key} "#[bg=${background},fg=${bg},bold] ${label} "'';
modes = lib.concatStringsSep "\n " [
(mode "normal" (c p.base0B) "NORMAL")
(mode "tmux" (c p.base09) "ZELLIJ")
(mode "locked" dim "LOCKED")
(mode "resize" (c p.base0D) "RESIZE")
(mode "scroll" (c p.base0C) "SCROLL")
(mode "search" (c p.base0C) "SEARCH")
(mode "entersearch" (c p.base0C) "SEARCH")
(mode "renametab" (c p.base0E) "RENAME")
(mode "renamepane" (c p.base0E) "RENAME")
];
in
{
programs.zellij.layouts.ide = ''
layout {
default_tab_template {
pane size=1 borderless=true {
plugin location="file:${pkgs.zellijPlugins.zjstatus}" {
format_left "{mode}#[bg=${bgAlt},fg=${accent},bold] {session} #[bg=${bg}] {tabs}"
format_right "#[bg=${bg},fg=${dim}]{swap_layout} {datetime}"
format_space "#[bg=${bg}]"
border_enabled "false"
hide_frame_for_single_pane "false"
${modes}
tab_normal "#[bg=${bgAlt},fg=${muted}] {index} {name} "
tab_active "#[bg=${accent},fg=${bg},bold] {index} {name} "
datetime "#[bg=${bg},fg=${muted},bold] {format} "
datetime_format "%H:%M"
datetime_timezone "Europe/Istanbul"
}
}
children
}
tab name="edit" focus=true {
pane split_direction="vertical" {
pane size=40 name="files" command="hx-sidebar" close_on_exit=true {
args "."
}
pane focus=true command="hx" close_on_exit=true
}
floating_panes {
pane name="terminal" command="nu" {
x "5%"
y "52%"
width "90%"
height "44%"
}
}
}
swap_tiled_layout name="vertical" {
tab {
pane split_direction="vertical" { children; }
}
}
swap_tiled_layout name="horizontal" {
tab {
pane split_direction="horizontal" { children; }
}
}
swap_tiled_layout name="stacked" {
tab {
pane stacked=true { children; }
}
}
}
'';
};
}