feat(zellij): Added custom keybinds for zellij normal modes
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
imports = [../modules/goread.nix];
|
|
||||||
programs.goread = {
|
programs.goread = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
./nvim.nix
|
./nvim.nix
|
||||||
./goread.nix
|
./goread.nix
|
||||||
./ncmpcpp.nix
|
./ncmpcpp.nix
|
||||||
|
./zellij.nix
|
||||||
|
../modules
|
||||||
]
|
]
|
||||||
++ lib.optionals device.isLinux [../linux];
|
++ lib.optionals device.isLinux [../linux];
|
||||||
|
|
||||||
@@ -145,7 +147,9 @@
|
|||||||
cd = "z";
|
cd = "z";
|
||||||
ls = "eza";
|
ls = "eza";
|
||||||
cat = "bat";
|
cat = "bat";
|
||||||
t = "tmux";
|
j = "just --choose";
|
||||||
|
t = "zellij a -c --index 0";
|
||||||
|
# t = "tmux";
|
||||||
};
|
};
|
||||||
shellAliases = {g = "git";};
|
shellAliases = {g = "git";};
|
||||||
shellInit = ''
|
shellInit = ''
|
||||||
|
|||||||
96
common/zellij.nix
Normal file
96
common/zellij.nix
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
{lib, ...}: {
|
||||||
|
home.sessionVariables = {
|
||||||
|
"ZELLIJ_AUTO_ATTACH" = "true";
|
||||||
|
# "ZELLIJ_AUTO_EXIT" = "true";
|
||||||
|
};
|
||||||
|
programs.zellij = let
|
||||||
|
mkBind = key: action:
|
||||||
|
if builtins.isString action
|
||||||
|
then "bind \"" + key + "\" {" + action + ";}"
|
||||||
|
else "bind \"" + key + "\" {" + (lib.concatStringsSep ";" action) + ";}";
|
||||||
|
|
||||||
|
mkBinds = binds: (lib.attrsets.mapAttrs' (key: action: lib.attrsets.nameValuePair (mkBind key action) []) binds);
|
||||||
|
|
||||||
|
mkCommand = command: (mode: "${command} \"" + mode + "\"");
|
||||||
|
# SwitchToMode = mode: "SwitchToMode \"" + mode + "\"";
|
||||||
|
SwitchToMode = mkCommand "SwitchToMode";
|
||||||
|
GoToTab = tab: "GoToTab ${toString tab}";
|
||||||
|
ToggleTab = "ToggleTab";
|
||||||
|
|
||||||
|
mkKeybinds = {
|
||||||
|
normal ? null,
|
||||||
|
locked ? null,
|
||||||
|
resize ? null,
|
||||||
|
pane ? null,
|
||||||
|
move ? null,
|
||||||
|
tab ? null,
|
||||||
|
scroll ? null,
|
||||||
|
search ? null,
|
||||||
|
entersearch ? null,
|
||||||
|
renametab ? null,
|
||||||
|
renamepane ? null,
|
||||||
|
session ? null,
|
||||||
|
tmux ? null,
|
||||||
|
# unbind ? null,
|
||||||
|
} @ b:
|
||||||
|
lib.attrsets.mapAttrs' (
|
||||||
|
mode: keymaps:
|
||||||
|
lib.attrsets.nameValuePair (
|
||||||
|
if builtins.hasAttr "clear-defaults" keymaps && keymaps.clear-defaults == true
|
||||||
|
then mode + " " + "clear-defaults=true"
|
||||||
|
else mode
|
||||||
|
) (
|
||||||
|
mkBinds (removeAttrs keymaps ["clear-defaults"])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(lib.attrsets.filterAttrs (mode: keymaps: keymaps != {}) b);
|
||||||
|
# mkUnbinds = bindings:
|
||||||
|
# if builtins.hasAttr "unbind" bindings
|
||||||
|
# then mkUnbind bindings.unbind
|
||||||
|
# else "";
|
||||||
|
#
|
||||||
|
# mkUnbind = key:
|
||||||
|
# if key.isString
|
||||||
|
# then "unbind \"" + key + "\""
|
||||||
|
# else lib.concatStringsSep " " (builtins.map ("\"" + key + "\"") key);
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
default_shell = "fish";
|
||||||
|
pane_frames = false;
|
||||||
|
theme = "catppuccin-mocha";
|
||||||
|
default_layout = "compact";
|
||||||
|
keybinds = mkKeybinds {
|
||||||
|
normal = {
|
||||||
|
clear-defaults = true;
|
||||||
|
"Ctrl q" = SwitchToMode "Tmux";
|
||||||
|
};
|
||||||
|
tmux = {
|
||||||
|
"0" = [(GoToTab 10) (SwitchToMode "Normal")];
|
||||||
|
"1" = [(GoToTab 1) (SwitchToMode "Normal")];
|
||||||
|
"2" = [(GoToTab 2) (SwitchToMode "Normal")];
|
||||||
|
"3" = [(GoToTab 3) (SwitchToMode "Normal")];
|
||||||
|
"4" = [(GoToTab 4) (SwitchToMode "Normal")];
|
||||||
|
"5" = [(GoToTab 5) (SwitchToMode "Normal")];
|
||||||
|
"6" = [(GoToTab 6) (SwitchToMode "Normal")];
|
||||||
|
"7" = [(GoToTab 7) (SwitchToMode "Normal")];
|
||||||
|
"8" = [(GoToTab 8) (SwitchToMode "Normal")];
|
||||||
|
"9" = [(GoToTab 9) (SwitchToMode "Normal")];
|
||||||
|
"Ctrl q" = [ToggleTab (SwitchToMode "Normal")];
|
||||||
|
"*" = SwitchToMode "Normal";
|
||||||
|
};
|
||||||
|
scroll = {
|
||||||
|
"g" = "ScrollToTop";
|
||||||
|
"G" = "ScrollToBottom";
|
||||||
|
"/" = "Search \"down\"";
|
||||||
|
"?" = "Search \"up\"";
|
||||||
|
"Ctrl u" = "HalfPageScrollUp";
|
||||||
|
"Ctrl d" = "HalfPageScrollDown";
|
||||||
|
"Ctrl f" = "PageScrollUp";
|
||||||
|
"Ctrl b" = "PageScrollDown";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
enableFishIntegration = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
4
justfile
4
justfile
@@ -1,5 +1,7 @@
|
|||||||
set dotenv-load
|
set dotenv-load
|
||||||
|
|
||||||
|
# clean := `git diff-index --quiet --cached HEAD --`
|
||||||
|
|
||||||
[macos]
|
[macos]
|
||||||
install:
|
install:
|
||||||
nix run nix-darwin -- switch --flake .
|
nix run nix-darwin -- switch --flake .
|
||||||
@@ -13,4 +15,4 @@ build:
|
|||||||
|
|
||||||
|
|
||||||
home:
|
home:
|
||||||
nix --extra-experimental-features "nix-command flakes" run home-manager/master -- switch --flake .
|
nix --extra-experimental-features "nix-command flakes" run home-manager/master -- switch --flake . --show-trace
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
device,
|
device,
|
||||||
osConfig,
|
# osConfig,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [inputs.anyrun.nixosModules.home-manager];
|
imports = [inputs.anyrun.nixosModules.home-manager];
|
||||||
@@ -32,10 +32,10 @@
|
|||||||
|
|
||||||
extraConfigFiles = {
|
extraConfigFiles = {
|
||||||
"nixos-options.ron".text = let
|
"nixos-options.ron".text = let
|
||||||
nixos-options =
|
# nixos-options =
|
||||||
pkgs.lib.optionalString device.isNix
|
# pkgs.lib.optionalString device.isNix
|
||||||
osConfig.system.build.manual.optionsJSON
|
# osConfig.system.build.manual.optionsJSON
|
||||||
+ "/share/doc/nixos/options.json";
|
# + "/share/doc/nixos/options.json";
|
||||||
hm-options =
|
hm-options =
|
||||||
inputs.home-manager.packages.${pkgs.system}.docs-json
|
inputs.home-manager.packages.${pkgs.system}.docs-json
|
||||||
+ "/share/doc/home-manager/options.json";
|
+ "/share/doc/home-manager/options.json";
|
||||||
@@ -48,14 +48,14 @@
|
|||||||
# ":something-else" = [some-other-option];
|
# ":something-else" = [some-other-option];
|
||||||
# ":nall" = [nixos-options hm-options some-other-option];
|
# ":nall" = [nixos-options hm-options some-other-option];
|
||||||
# };
|
# };
|
||||||
options = builtins.toJSON ({
|
options = builtins.toJSON {
|
||||||
":hm" = [hm-options];
|
":hm" = [hm-options];
|
||||||
}
|
};
|
||||||
// (
|
# // (
|
||||||
if device.isNix
|
# if device.isNix
|
||||||
then {":nix" = [nixos-options];}
|
# then {":nix" = [nixos-options];}
|
||||||
else {}
|
# else {}
|
||||||
));
|
# ));
|
||||||
in ''
|
in ''
|
||||||
Config(
|
Config(
|
||||||
options: ${options},
|
options: ${options},
|
||||||
|
|||||||
6
modules/default.nix
Normal file
6
modules/default.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./goread.nix
|
||||||
|
./hyprpaper.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user