feat: implement zide
This commit is contained in:
Generated
+17
@@ -187,6 +187,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"onedark-yazi": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1744707994,
|
||||
"narHash": "sha256-tfkzVa+UdUVKF2DS1awEusfoJEjJh40Bx1cREPtewR0=",
|
||||
"owner": "BennyOe",
|
||||
"repo": "onedark.yazi",
|
||||
"rev": "668d71d967857392012684c7dd111605cfa36d1a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "BennyOe",
|
||||
"repo": "onedark.yazi",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plasma-manager": {
|
||||
"inputs": {
|
||||
"home-manager": [
|
||||
@@ -216,6 +232,7 @@
|
||||
"home-manager": "home-manager",
|
||||
"nix4vscode": "nix4vscode",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"onedark-yazi": "onedark-yazi",
|
||||
"plasma-manager": "plasma-manager"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
url = "github:nix-community/nix4vscode";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
onedark-yazi = {
|
||||
url = "github:BennyOe/onedark.yazi";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, globalprotect-openconnect, ... }@inputs:
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
../modules/starship.nix
|
||||
../modules/typst.nix
|
||||
../modules/vscode.nix
|
||||
../modules/zoom.nix
|
||||
../modules/yazi.nix
|
||||
../modules/zellij.nix
|
||||
../modules/zig.nix
|
||||
../modules/zoom.nix
|
||||
../modules/zsh.nix
|
||||
./git.nix
|
||||
./gh.nix
|
||||
|
||||
+23
-22
@@ -1,5 +1,18 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
baseKeybinds = [
|
||||
"ctrl+t=new_tab"
|
||||
"ctrl+shift+w=close_tab"
|
||||
"ctrl+tab=next_tab"
|
||||
"ctrl+shift+o=new_split:right"
|
||||
"ctrl+shift+e=new_split:down"
|
||||
"ctrl+comma=open_config"
|
||||
"ctrl+shift+comma=reload_config"
|
||||
"ctrl+equal=increase_font_size:1"
|
||||
"ctrl+minus=decrease_font_size:1"
|
||||
"ctrl+zero=reset_font_size"
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.ghostty = {
|
||||
enable = true;
|
||||
@@ -12,13 +25,14 @@
|
||||
|
||||
# Theme & Colors (OneDark)
|
||||
"background" = "#282c34";
|
||||
"foreground" = "#ffffff";
|
||||
"foreground" = "#abb2bf";
|
||||
"cursor-style" = "block";
|
||||
"palette" = [
|
||||
"0=#1d1f21" "1=#cc6666" "2=#b5bd68" "3=#f0c674" "4=#81a2be"
|
||||
"5=#b294bb" "6=#8abeb7" "7=#c5c8c6" "8=#666666" "9=#d54e53"
|
||||
"10=#b9ca4a" "11=#e7c547" "12=#7aa6da" "13=#c397d8" "14=#70c0b1"
|
||||
"15=#eaeaea" "16=#000000" "17=#00005f" "18=#000087" "19=#0000af"
|
||||
"0=#282c34" "1=#e06c75" "2=#98c379" "3=#e5c07b"
|
||||
"4=#61afef" "5=#c678dd" "6=#56b6c2" "7=#abb2bf"
|
||||
"8=#5c6370" "9=#e06c75" "10=#98c379" "11=#e5c07b"
|
||||
"12=#61afef" "13=#c678dd" "14=#56b6c2" "15=#ffffff"
|
||||
"16=#000000" "17=#00005f" "18=#000087" "19=#0000af"
|
||||
"20=#0000d7" "21=#0000ff" "22=#005f00" "23=#005f5f" "24=#005f87"
|
||||
"25=#005faf" "26=#005fd7" "27=#005fff" "28=#008700" "29=#00875f"
|
||||
"30=#008787" "31=#0087af" "32=#0087d7" "33=#0087ff" "34=#00af00"
|
||||
@@ -78,24 +92,11 @@
|
||||
"confirm-close-surface" = true;
|
||||
|
||||
# Keybindings (Tabs & Splits)
|
||||
"keybind" = [
|
||||
"ctrl+t=new_tab"
|
||||
"ctrl+shift+w=close_tab"
|
||||
"ctrl+tab=next_tab"
|
||||
"ctrl+shift+o=new_split:right"
|
||||
"ctrl+shift+e=new_split:down"
|
||||
"ctrl+comma=open_config"
|
||||
"ctrl+shift+comma=reload_config"
|
||||
"ctrl+equal=increase_font_size:1"
|
||||
"ctrl+minus=decrease_font_size:1"
|
||||
"ctrl+zero=reset_font_size"
|
||||
];
|
||||
}
|
||||
// lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
# macOS Specifics
|
||||
"keybind" = baseKeybinds
|
||||
++ lib.optionals pkgs.stdenv.isDarwin [ "super+d=unbind" ];
|
||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
"macos-titlebar-style" = "transparent";
|
||||
"macos-icon" = "official";
|
||||
"keybind" = [ "super+d=unbind" ]; # Fix Linux conflict on Mac
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -116,6 +116,13 @@ in
|
||||
"C-g" = [ ":new" ":insert-output lazygit" ":buffer-close!" ":redraw" ];
|
||||
"d" = "delete_selection_noyank";
|
||||
"A-d" = "delete_selection";
|
||||
"C-y" = [
|
||||
":sh rm -f /tmp/yazi-chooser"
|
||||
'':insert-output yazi "%{buffer_name}" --chooser-file=/tmp/yazi-chooser''
|
||||
'':sh printf '\x1b[?1049h\x1b[?2004h' > /dev/tty''
|
||||
'':open %sh{cat /tmp/yazi-chooser}''
|
||||
":redraw"
|
||||
];
|
||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin macKeys;
|
||||
|
||||
keys.select = {
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
hx-zellij-open = pkgs.writeShellScriptBin "hx-zellij-open" ''
|
||||
set -eu
|
||||
if [ -z "''${ZELLIJ:-}" ]; then
|
||||
exec "''${EDITOR:-hx}" "$@"
|
||||
fi
|
||||
zellij="${pkgs.zellij}/bin/zellij"
|
||||
"$zellij" action move-focus right
|
||||
"$zellij" action write 27
|
||||
for f in "$@"; do
|
||||
"$zellij" action write-chars ":open \"$f\""
|
||||
"$zellij" action write 13
|
||||
done
|
||||
'';
|
||||
|
||||
helixOpener = [
|
||||
{ run = ''hx-zellij-open "$@"''; desc = "Open in Helix pane"; block = false; for = "unix"; }
|
||||
];
|
||||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
ideYaziToml = tomlFormat.generate "yazi.toml" {
|
||||
mgr = {
|
||||
ratio = [ 0 1 0 ];
|
||||
linemode = "none";
|
||||
};
|
||||
opener.edit = helixOpener;
|
||||
};
|
||||
|
||||
ideKeymapToml = tomlFormat.generate "keymap.toml" {
|
||||
mgr.prepend_keymap = [
|
||||
{ on = "h"; run = "plugin bounded-leave"; desc = "Parent dir (stop at project root)"; }
|
||||
{ on = "<Left>"; run = "plugin bounded-leave"; desc = "Parent dir (stop at project root)"; }
|
||||
];
|
||||
};
|
||||
|
||||
boundedLeave = ''
|
||||
--- @sync entry
|
||||
local function entry()
|
||||
local cwd = tostring(cx.active.current.cwd)
|
||||
local root = os.getenv("YAZI_ROOT")
|
||||
if root and root ~= "" and cwd == root then
|
||||
-- At the project root: refuse to go higher.
|
||||
return
|
||||
end
|
||||
ya.emit("leave", {})
|
||||
end
|
||||
|
||||
return { entry = entry }
|
||||
'';
|
||||
|
||||
yazi-ide = pkgs.writeShellScriptBin "yazi-ide" ''
|
||||
set -eu
|
||||
export YAZI_CONFIG_HOME="$HOME/.config/yazi-ide"
|
||||
root="$(${pkgs.git}/bin/git rev-parse --show-toplevel 2>/dev/null || true)"
|
||||
export YAZI_ROOT="''${root:-$PWD}"
|
||||
exec ${pkgs.yazi}/bin/yazi "$@"
|
||||
'';
|
||||
|
||||
ideThemeToml = tomlFormat.generate "theme.toml" {
|
||||
status = {
|
||||
overall = { fg = "#abb2bf"; bg = "#21252b"; }; # readable text on a dark bar
|
||||
progress_label = { fg = "#abb2bf"; bold = true; };
|
||||
progress_normal = { fg = "#98c379"; bg = "#21252b"; };
|
||||
progress_error = { fg = "#e06c75"; bg = "#21252b"; };
|
||||
};
|
||||
mode = {
|
||||
normal_main = { fg = "#21252b"; bg = "#61afef"; bold = true; };
|
||||
normal_alt = { fg = "#61afef"; bg = "#21252b"; };
|
||||
select_main = { fg = "#21252b"; bg = "#98c379"; bold = true; };
|
||||
select_alt = { fg = "#98c379"; bg = "#21252b"; };
|
||||
unset_main = { fg = "#21252b"; bg = "#e06c75"; bold = true; };
|
||||
unset_alt = { fg = "#e06c75"; bg = "#21252b"; };
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = [ hx-zellij-open yazi-ide ];
|
||||
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
shellWrapperName = "y";
|
||||
settings.opener.edit = helixOpener;
|
||||
};
|
||||
|
||||
|
||||
xdg.configFile = {
|
||||
"yazi-ide/yazi.toml".source = ideYaziToml;
|
||||
"yazi-ide/theme.toml".source = ideThemeToml;
|
||||
"yazi-ide/keymap.toml".source = ideKeymapToml;
|
||||
"yazi-ide/plugins/bounded-leave.yazi/main.lua".text = boundedLeave;
|
||||
|
||||
"yazi-ide/init.lua".text = ''
|
||||
-- Render the header path relative to YAZI_ROOT (the project root you
|
||||
-- launched the layout in), anchored on the project's directory name.
|
||||
-- Outside that root, fall back to Yazi's default ~/-style path.
|
||||
function Header:cwd()
|
||||
local max = self._area.w - self._right_width
|
||||
if max <= 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
local cwd = tostring(self._current.cwd)
|
||||
local root = os.getenv("YAZI_ROOT") or ""
|
||||
local s
|
||||
if root ~= "" and (cwd == root or cwd:sub(1, #root + 1) == root .. "/") then
|
||||
local base = root:match("([^/]+)/?$") or root -- project dir name
|
||||
s = base .. cwd:sub(#root + 1) -- e.g. "myrepo/src/lib"
|
||||
else
|
||||
s = ya.readable_path(cwd)
|
||||
end
|
||||
|
||||
s = s .. self:flags()
|
||||
return ui.Span(ui.truncate(s, { max = max, rtl = true })):style(th.mgr.cwd)
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs.zellij.enable = true;
|
||||
|
||||
xdg.configFile."zellij/config.kdl".text = ''
|
||||
theme "onedark"
|
||||
pane_frames false
|
||||
simplified_ui true
|
||||
show_startup_tips false
|
||||
|
||||
themes {
|
||||
onedark {
|
||||
fg "#abb2bf"
|
||||
bg "#282c34"
|
||||
black "#3f4451"
|
||||
red "#e06c75"
|
||||
green "#98c379"
|
||||
yellow "#e5c07b"
|
||||
blue "#61afef"
|
||||
magenta "#c678dd"
|
||||
cyan "#56b6c2"
|
||||
white "#abb2bf"
|
||||
orange "#d19a66"
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
xdg.configFile."zellij/layouts/ide.kdl".text = ''
|
||||
layout {
|
||||
pane split_direction="horizontal" {
|
||||
pane size="75%" split_direction="vertical" {
|
||||
pane size="20%" {
|
||||
command "yazi-ide"
|
||||
}
|
||||
pane {
|
||||
command "hx"
|
||||
args "."
|
||||
}
|
||||
}
|
||||
pane size="25%"
|
||||
}
|
||||
pane size=1 borderless=true {
|
||||
plugin location="zellij:compact-bar"
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
l = "ls -CF";
|
||||
tp = "tree -I '__init__*' -I '__pycache__'";
|
||||
clear = "/run/current-system/sw/bin/clear";
|
||||
zide = "zellij --layout ide";
|
||||
};
|
||||
|
||||
sessionVariables = {
|
||||
|
||||
Reference in New Issue
Block a user