From 63b9f83b93f4eeda1f33f89b0a982027c25cd075 Mon Sep 17 00:00:00 2001 From: krizej Date: Sat, 2 Nov 2024 23:01:44 +0100 Subject: [PATCH] zed stuff --- files/zed-replace-window.patch | 26 ++--- flake.lock | 24 ++--- hosts/desktop/default.nix | 1 - modules/stuff/other-dev-programs.nix | 143 +++++++++++++++++++++++++-- pkgs/default.nix | 8 +- 5 files changed, 161 insertions(+), 41 deletions(-) diff --git a/files/zed-replace-window.patch b/files/zed-replace-window.patch index fb11b79..234f066 100644 --- a/files/zed-replace-window.patch +++ b/files/zed-replace-window.patch @@ -1,13 +1,13 @@ -diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs -index cec913851f..f5c84ca593 100644 ---- a/crates/workspace/src/workspace.rs -+++ b/crates/workspace/src/workspace.rs -@@ -1906,7 +1906,7 @@ impl Workspace { - - if let Some(task) = this - .update(&mut cx, |this, cx| { -- this.open_workspace_for_paths(false, paths, cx) -+ this.open_workspace_for_paths(true, paths, cx) - }) - .log_err() - { +diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs +index 427e3ab9f6..2c231e6591 100644 +--- a/crates/zed/src/zed.rs ++++ b/crates/zed/src/zed.rs +@@ -323,7 +323,7 @@ pub fn initialize_workspace( + if let Some(task) = this + .update(&mut cx, |this, cx| { + if this.project().read(cx).is_local() { +- this.open_workspace_for_paths(false, paths, cx) ++ this.open_workspace_for_paths(true, paths, cx) + } else { + open_new_ssh_project_from_project(this, paths, cx) + } diff --git a/flake.lock b/flake.lock index b432831..fc5125a 100644 --- a/flake.lock +++ b/flake.lock @@ -59,11 +59,11 @@ ] }, "locked": { - "lastModified": 1729321331, - "narHash": "sha256-KVyQq+ez/oB30/WbdNgVD8g/bda34z8NiU187QKQb74=", + "lastModified": 1730490306, + "narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=", "owner": "nix-community", "repo": "home-manager", - "rev": "122f70545b29ccb922e655b08acfe05bfb44ec68", + "rev": "1743615b61c7285976f85b303a36cdf88a556503", "type": "github" }, "original": { @@ -74,11 +74,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1729333370, - "narHash": "sha256-NU+tYe3QWzDNpB8RagpqR3hNQXn4BNuBd7ZGosMHLL8=", + "lastModified": 1730537918, + "narHash": "sha256-GJB1/aaTnAtt9sso/EQ77TAGJ/rt6uvlP0RqZFnWue8=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "38279034170b1e2929b2be33bdaedbf14a57bfeb", + "rev": "f6e0cd5c47d150c4718199084e5764f968f1b560", "type": "github" }, "original": { @@ -90,11 +90,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729256560, - "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "type": "github" }, "original": { @@ -153,11 +153,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1729350650, - "narHash": "sha256-zjJ7rYnyiPWAtk1/hsj1Ee0CFuk3VF6V/p4alHb8+gk=", + "lastModified": 1730572196, + "narHash": "sha256-1YyidD8ylkkTL0Ig4ZgcQPvl9CCt6JEyqSa9juTqJ0M=", "owner": "zed-industries", "repo": "zed", - "rev": "e8207288e554e3619dd0a8186e93b83047719bf1", + "rev": "3b76ba6d5ab6745cd12d2cb632ae4a55680dc89a", "type": "github" }, "original": { diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 2fd04ac..85a36e9 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -46,7 +46,6 @@ viu qbittorrent # jetbrains.idea-community-bin - zed-editor mumble blender godot_4 diff --git a/modules/stuff/other-dev-programs.nix b/modules/stuff/other-dev-programs.nix index 6e18f2b..dc8fb54 100644 --- a/modules/stuff/other-dev-programs.nix +++ b/modules/stuff/other-dev-programs.nix @@ -1,5 +1,5 @@ -{ lib, pkgs, config, ...}: let - inherit (lib) mkIf mkEnableOption mkOption; +{ inputs, lib, pkgs, config, ...}: let + inherit (lib) mkIf mkEnableOption; cfg = config.chuj.stuff.other-dev-programs; user = config.chuj.system.user; in { @@ -21,11 +21,138 @@ in { programs.adb.enable = true; - home-manager.users.${user}.home.packages = with pkgs; [ - # CYA NERDS - # NOTTODO: plugins - # jetbrains.pycharm-community - # jetbrains.clion - ]; + home-manager.users.${user}.programs.zed-editor = { + enable = true; + package = (inputs.zed.packages.${pkgs.system}.zed-editor.overrideAttrs { + patches = [ + ../../files/zed-no-rounded-corners.patch + ../../files/zed-replace-window.patch + ]; + }); + extensions = [ + "gdscript" + "make" + "nix" + "assembly" + "glsl" + "html" + ]; + userSettings = let + font = "Monaspace Xenon"; + in { + # appearance and shit + theme = "MOJE"; + buffer_font_family = font; + ui_font_family = font; + buffer_font_size = 13.5; + buffer_line_height.custom = 1.7; + ui_font_size = 16; + buffer_font_features.calt = false; # disable ligatures + git.inline_blame.enabled = false; + gutter = { + line_numbers = false; + code_actions = false; + runnables = false; + folds = false; + }; + project_panel = { + folder_icons = false; + indent_size = 20; + auto_reveal_entries = false; + auto_fold_dirs = false; + }; + + terminal = { + line_height = "standard"; + blinking = "on"; + font_size = 13.5; + font_weight = 300; + working_directory = "first_project_directory"; + detect_venv.on = { + directories = [".env" "env" ".venv" "venv"]; + activate_script = "fish"; + }; + }; + + # language config crap + lsp.gdscript.binary.args = [ "127.0.0.1" "6005" ]; + languages = { + Nix.tab_size = 2; + JSON.enable_language_server = false; # who up lsp'ing they json + JSONC.enable_language_server = false; + HTML.enable_language_server = false; + CSS.enable_language_server = false; + GDScript.hard_tabs = false; + }; + file_types.C = [ "c" "h" ]; # i don't remember why + + # editor behavior + auto_signature_help = true; + use_system_path_prompts = false; + soft_wrap = "editor_width"; + seed_search_query_from_cursor = "selection"; + double_click_in_multibuffer = "open"; + preview_tabs.enabled = false; + format_on_save = "off"; + auto_update = false; + middle_click_paste = false; + # this + files/zed-window-replace.patch is a workaround for + # https://github.com/zed-industries/zed/issues/18194 + restore_on_startup = "none"; + + # disable stupid shit + assistant = { + enabled = false; + button = false; + }; + features.inline_completion_provider = "none"; + telemetry = { + diagnostics = false; + metrics = false; + }; + + # keymap + base_keymap = "JetBrains"; + }; + userKeymaps = let + context = ctx: stuff: { context = ctx; bindings = stuff; }; + in [ + (context "Editor" { + ctrl-b = "editor::GoToDefinition"; + ctrl-y = "editor::Redo"; + home = "editor::MoveToBeginningOfLine"; + down = "editor::MoveDown"; # why is this here??? + ctrl-r = ["buffer_search::Deploy" { replace_enabled = true; }]; + pageup = null; + shift-pageup = null; + pagedown = null; + shift-pagedown = null; + # multi-cursor + ctrl-alt-up = "editor::AddSelectionAbove"; + ctrl-alt-down = "editor::AddSelectionBelow"; + }) + (context "Pane" { + alt-left = "pane::ActivatePrevItem"; + alt-right = "pane::ActivateNextItem"; + "ctrl-k ctrl-up" = "pane::SplitUp"; + "ctrl-k ctrl-down" = "pane::SplitDown"; + "ctrl-k ctrl-left" = "pane::SplitLeft"; + "ctrl-k ctrl-right" = "pane::SplitRight"; + "ctrl-k up" = ["workspace::ActivatePaneInDirection" "Up"]; + "ctrl-k down" = ["workspace::ActivatePaneInDirection" "Down"]; + "ctrl-k left" = ["workspace::ActivatePaneInDirection" "Left"]; + "ctrl-k right" = ["workspace::ActivatePaneInDirection" "Right"]; + }) + (context "Terminal" { + ctrl-w = "pane::CloseActiveItem"; + }) + (context "Editor && (showing_code_actons || showing_completions)" { + # yes, these are the defaults. for some reason "down" + # does not work unless we repeat it??? + up = "editor::ContextMenuPrev"; + down = "editor::ContextMenuNext"; + }) + ]; + }; }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 0926f56..4f63db9 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: with pkgs; [ +{ pkgs, ... }: with pkgs; [ (final: prevPkgs: { win7-cursors = callPackage ./win7-cursors.nix {}; sddm-i3-theme = callPackage ./sddm-i3-theme.nix {}; @@ -31,11 +31,5 @@ sha256 = "sha256-t794WEMJx/JNX3gTMHfgquFWB7yXkleW07+QURm1NPM="; }; }); - zed-editor = (inputs.zed.packages.${system}.zed-editor.overrideAttrs { - patches = [ - ../files/zed-no-rounded-corners.patch - ../files/zed-replace-window.patch - ]; - }); }) ]