From 05b317d2752bd5388c9857be436cebd91d518309 Mon Sep 17 00:00:00 2001 From: Vivian Date: Thu, 21 Mar 2024 17:20:29 +0100 Subject: [PATCH] more nvim config --- common/hm-modules/nvim/default.nix | 45 ++++++++++++++++++++------- common/hm-modules/rust.nix | 49 +++++++++++++++++++----------- flake.nix | 2 ++ 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/common/hm-modules/nvim/default.nix b/common/hm-modules/nvim/default.nix index ddc9a4cf..51b01928 100644 --- a/common/hm-modules/nvim/default.nix +++ b/common/hm-modules/nvim/default.nix @@ -6,6 +6,15 @@ }: let cfg = config.programs.v.nvim; + nvim-nio = pkgs.vimUtils.buildVimPlugin { + name = "nvim-nio"; + src = pkgs.fetchFromGitHub { + owner = "nvim-neotest"; + repo = "nvim-nio"; + rev = "refs/tags/v1.8.0"; + sha256 = "sha256-RFmH+683vrg4BELwtAQqjV8oGkvRgzcd6kd5r1s3Jp8="; + }; + }; in with lib; { @@ -103,15 +112,20 @@ with lib; lua = true; } # Switch buffers + { + mode = "n"; + key = "q"; + action = ":bd"; # Delete buffer + } { mode = "n"; key = "s"; - action = ":bn"; + action = ":bn"; # Buffer next } { mode = "n"; key = "a"; - action = ":bp"; + action = ":bp"; # Buffer previous } # Change Indenting { @@ -119,6 +133,11 @@ with lib; key = ""; action = "<<_"; } + { + mode = "n"; + key = ""; + action = ">>_"; + } { mode = "v"; key = ""; @@ -165,6 +184,7 @@ with lib; extraPlugins = with pkgs.vimPlugins; [ FixCursorHold-nvim nvim-web-devicons + nvim-nio ]; colorschemes.catppuccin = { @@ -194,14 +214,14 @@ with lib; folder = "daily"; }; workspaces = [ - { - name = "notes"; - path = "~/src/notes"; - } { name = "uni"; path = "~/cloud/Documents/CESE/notes"; } + { + name = "notes"; + path = "~/src/notes"; + } ]; completion = { min_chars = 2; @@ -233,6 +253,7 @@ with lib; progress = { ignoreDoneAlready = true; ignore = [ "ltex" ]; + display.doneTtl = 5; }; notification = { overrideVimNotify = true; @@ -240,10 +261,13 @@ with lib; }; neotest = { enable = true; - adapters.plenary.enable = true; - adapters.rust = { - enable = true; - settings.args = [ "--no-capture" ]; + adapters = { + plenary.enable = true; + python.enable = true; + rust = { + enable = true; + settings.args = [ "--no-capture" ]; + }; }; }; treesitter = { @@ -334,7 +358,6 @@ with lib; }; vimtex.enable = true; floaterm.enable = true; - cmp = { enable = true; autoEnableSources = true; diff --git a/common/hm-modules/rust.nix b/common/hm-modules/rust.nix index 5a56c65f..d822f8d6 100644 --- a/common/hm-modules/rust.nix +++ b/common/hm-modules/rust.nix @@ -1,28 +1,41 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: with lib; -let cfg = config.programs.v.rust; -in { - options.programs.v.rust = { enable = mkEnableOption "rust"; }; +let + cfg = config.programs.v.rust; +in +{ + options.programs.v.rust.enable = mkEnableOption "rust"; + config = mkIf cfg.enable { home = { - packages = with pkgs; [ rustup cargo-nextest cargo-msrv cargo-dist cargo-cross]; + packages = with pkgs; [ + rustup + cargo-binutils + cargo-nextest + cargo-msrv + cargo-dist + cargo-cross + ]; - file = { - ".cargo/config.toml".text = '' - [registries.crates-io] - protocol = "sparse" + file.".cargo/config.toml".text = '' + [registries.crates-io] + protocol = "sparse" - [build] - rustc-wrapper = "${pkgs.sccache}/bin/sccache" + [build] + rustc-wrapper = "${pkgs.sccache}/bin/sccache" - [target.'cfg(not(target_arch = "mips"))'] - linker = "${pkgs.clang}/bin/clang" - rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] + [target.'cfg(not(target_arch = "mips"))'] + linker = "${pkgs.clang}/bin/clang" + rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] - [profile.rust-analyzer] - inherits = "dev" - ''; - }; + [profile.rust-analyzer] + inherits = "dev" + ''; sessionPath = [ "$HOME/.cargo/bin" ]; }; diff --git a/flake.nix b/flake.nix index a7e96a9a..61ccfcfc 100644 --- a/flake.nix +++ b/flake.nix @@ -133,6 +133,7 @@ devShells.default = channels.nixpkgs.mkShell { name = "devShell"; VAULT_ADDR = "http://vault.olympus:8200/"; + FLAKE = "/home/vivian/src/infrastructure-new"; packages = with pkgs; [ attic.packages.${system}.attic apply-local @@ -144,6 +145,7 @@ yamllint jq fup-repl + nh ]; }; };