From e44dba355a55e8f21a64cbae36ec2d7040a0a633 Mon Sep 17 00:00:00 2001 From: Joakim Repomaa Date: Sun, 30 Mar 2025 20:13:24 +0300 Subject: [PATCH] home: zed and lazygit config --- home/common/default.nix | 22 +++++++++++++++++++--- home/modules/zed/default.nix | 22 +++++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/home/common/default.nix b/home/common/default.nix index d133a95..916f01b 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -220,9 +220,10 @@ branchLogCmd = "git log {{branchName}} --first-parent --color=always --pretty=format:'%Cgreen%h%Creset %Cblue%aN%Creset %C(cyan)%<(14)%ar%Creset %s' --abbrev-commit"; }; os = { - edit = "$EDITOR {{filename}}"; - editAtLine = "$EDITOR {{filename}}:{{line}}"; - editAtLineAndWait = "$EDITOR --wait {{filename}}:{{line}}"; + edit = "\${EDITOR} -- {{filename}}"; + editAtLine = "\${EDITOR} -- {{filename}}:{{line}}"; + editAtLineAndWait = "\${EDITOR} --wait -- {{filename}}:{{line}}"; + openDirInEditor = "\${EDITOR} -- {{dir}}"; }; promptToReturnFromSubprocess = false; keybinding = { @@ -246,6 +247,21 @@ gh pr view --web ''; } + { + key = "N"; + context = "localBranches"; + prompts = [ + { + type = "input"; + title = "New Branch Name:"; + key = "BranchName"; + initialValue = "{{.SelectedLocalBranch.Name}}_review"; + } + ]; + command = '' + git checkout -b {{.Form.BranchName | quote}} + ''; + } ]; }; }; diff --git a/home/modules/zed/default.nix b/home/modules/zed/default.nix index d350cc5..a3c885c 100644 --- a/home/modules/zed/default.nix +++ b/home/modules/zed/default.nix @@ -123,6 +123,12 @@ in buffer_font_size = 16; ui_font_size = 17; relative_line_numbers = true; + file_types = { + JSONC = [ + "tsconfig.json" + "tsconfig.*.json" + ]; + }; }; userKeymaps = [ { @@ -176,10 +182,20 @@ in } ]; - userTasks = with pkgs; [ + userTasks = [ { label = "lazygit"; - command = "${lib.getExe lazygit} -p $ZED_WORKTREE_ROOT"; + command = lib.getExe config.programs.lazygit.package; + env = { + EDITOR = lib.getExe cfg.package; + }; + args = [ + "-p" + "$ZED_WORKTREE_ROOT" + ]; + reveal = "always"; + allow_concurrent_runs = true; + use_new_terminal = false; hide = "on_success"; } ]; @@ -188,7 +204,7 @@ in xdg.configFile."zed/tasks.json".text = builtins.toJSON cfg.userTasks; home.sessionVariables = lib.mkIf cfg.defaultEditor { - EDITOR = lib.getExe pkgs.zed-editor; + EDITOR = lib.getExe cfg.package; }; }; }