From 3c53c98bd7791f88b013da4e222007a1fa48bc68 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Wed, 4 Mar 2026 12:14:30 +0100 Subject: [PATCH] Add linux-like bindings on macos --- lib/mksystem.nix | 31 +++++++++++++++++++++++++++++++ modules/cli/darwin.nix | 8 ++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lib/mksystem.nix b/lib/mksystem.nix index 1f798d9..e169478 100644 --- a/lib/mksystem.nix +++ b/lib/mksystem.nix @@ -69,6 +69,37 @@ in ../modules/cli/home.nix (../environments + "/${env}/home.nix") ] + ++ nixpkgs.lib.optionals darwin [ + { + # setup home/end keys + ctrl/shift with arrows/delete keys like on linux + home.file."Library/KeyBindings/DefaultKeyBinding.dict".text = '' + { + "\UF729" = moveToBeginningOfParagraph:; // home + "\UF72B" = moveToEndOfParagraph:; // end + "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home + "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end + "^\UF729" = moveToBeginningOfDocument:; // ctrl-home + "^\UF72B" = moveToEndOfDocument:; // ctrl-end + "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home + "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end + + "^\Uf702" = "moveWordBackward:"; // ctrl-left + "^\Uf703" = "moveWordForward:"; // ctrl-right + "^$\Uf702" = "moveWordBackwardAndModifySelection:"; // ctrl-shift-left + "^$\Uf703" = "moveWordRightAndModifySelection:"; // ctrl-shift-right + "^\U007f" = "deleteWordBackward:"; // ctrl-backspace + "^\Uf728" = "deleteWordForward:"; // ctrl-delete + + "^a" = "selectAll:"; + "^x" = "cut:"; + "^c" = "copy:"; + "^v" = "paste:"; + "^z" = "undo:"; + "^~z" = "redo:"; + } + ''; + } + ] ++ customHome; }; }; diff --git a/modules/cli/darwin.nix b/modules/cli/darwin.nix index 9151a49..dd8cc4c 100644 --- a/modules/cli/darwin.nix +++ b/modules/cli/darwin.nix @@ -1,4 +1,8 @@ -{pkgs, lib, ...}: { +{ + pkgs, + lib, + ... +}: { imports = [ ./nix/nix.nix ]; @@ -41,7 +45,7 @@ }; }; - launchd.user.agents.ssh-tunnel = let + launchd.user.agents.ssh-tunnel = let ssh-tunnel = pkgs.writeShellScriptBin "ssh-tunnel" '' while true; do dns-sd -m -Q fuhen.local