From 6fd9424a96b35cca50b2374963c55662e140b50e Mon Sep 17 00:00:00 2001 From: 4Lost Date: Fri, 20 Feb 2026 23:38:41 +0100 Subject: [PATCH] neovim -> nixvim --- builds/flutter.nix | 82 ----- configuration.nix | 41 ++- flake.lock | 114 ++++++- flake.nix | 111 ++++--- home/default.nix | 4 - home/programs/default.nix | 3 +- home/programs/nixvim/default.nix | 104 ++++++ home/programs/nixvim/plugins/autopairs.nix | 13 + home/programs/nixvim/plugins/barbar.nix | 85 +++++ home/programs/nixvim/plugins/bullets.nix | 68 ++++ home/programs/nixvim/plugins/cmp.nix | 73 +++++ home/programs/nixvim/plugins/comment-box.nix | 56 ++++ home/programs/nixvim/plugins/comment.nix | 16 + home/programs/nixvim/plugins/conform.nix | 133 ++++++++ home/programs/nixvim/plugins/dap.nix | 298 ++++++++++++++++++ home/programs/nixvim/plugins/default.nix | 52 +++ home/programs/nixvim/plugins/diffview.nix | 12 + home/programs/nixvim/plugins/dynomark.nix | 43 +++ home/programs/nixvim/plugins/edgy.nix | 80 +++++ home/programs/nixvim/plugins/gitsigns.nix | 11 + .../programs/nixvim/plugins/haskell-tools.nix | 19 ++ home/programs/nixvim/plugins/knap.nix | 68 ++++ home/programs/nixvim/plugins/leap.nix | 30 ++ home/programs/nixvim/plugins/lsp.nix | 102 ++++++ home/programs/nixvim/plugins/ltex-extra.nix | 9 + home/programs/nixvim/plugins/lualine.nix | 49 +++ .../nixvim/plugins/markdown-preview.nix | 9 + home/programs/nixvim/plugins/mkdnflow.nix | 191 +++++++++++ home/programs/nixvim/plugins/neoscroll.nix | 28 ++ home/programs/nixvim/plugins/neotree.nix | 14 + home/programs/nixvim/plugins/noice.nix | 22 ++ home/programs/nixvim/plugins/notify.nix | 17 + home/programs/nixvim/plugins/oil.nix | 9 + home/programs/nixvim/plugins/otter.nix | 9 + home/programs/nixvim/plugins/papis.nix | 28 ++ home/programs/nixvim/plugins/peek.nix | 12 + .../nixvim/plugins/render-markdown.nix | 29 ++ home/programs/nixvim/plugins/smart-splits.nix | 104 ++++++ home/programs/nixvim/plugins/snippets.nix | 15 + home/programs/nixvim/plugins/sniprun.nix | 28 ++ home/programs/nixvim/plugins/startup.nix | 71 +++++ home/programs/nixvim/plugins/surround.nix | 162 ++++++++++ home/programs/nixvim/plugins/telescope.nix | 49 +++ home/programs/nixvim/plugins/texpresso.nix | 30 ++ .../programs/nixvim/plugins/todo-comments.nix | 94 ++++++ home/programs/nixvim/plugins/toggleterm.nix | 43 +++ home/programs/nixvim/plugins/treesitter.nix | 18 ++ home/programs/nixvim/plugins/trouble.nix | 170 ++++++++++ .../programs/nixvim/plugins/typst-preview.nix | 38 +++ home/programs/nixvim/plugins/typst-vim.nix | 17 + home/programs/nixvim/plugins/undotree.nix | 11 + home/programs/nixvim/plugins/vimtex.nix | 40 +++ home/programs/nixvim/plugins/which-key.nix | 9 + home/programs/nixvim/plugins/yanky.nix | 69 ++++ home/programs/nixvim/plugins/zk.nix | 95 ++++++ home/programs/planify.nix | 5 - home/programs/taskwarrior/catppuccin.theme | 4 +- home/programs/taskwarrior/default.nix | 40 +++ home/programs/zsh.nix | 18 +- home/services/default.nix | 7 +- 60 files changed, 3005 insertions(+), 176 deletions(-) delete mode 100644 builds/flutter.nix create mode 100644 home/programs/nixvim/default.nix create mode 100644 home/programs/nixvim/plugins/autopairs.nix create mode 100644 home/programs/nixvim/plugins/barbar.nix create mode 100644 home/programs/nixvim/plugins/bullets.nix create mode 100644 home/programs/nixvim/plugins/cmp.nix create mode 100644 home/programs/nixvim/plugins/comment-box.nix create mode 100644 home/programs/nixvim/plugins/comment.nix create mode 100644 home/programs/nixvim/plugins/conform.nix create mode 100644 home/programs/nixvim/plugins/dap.nix create mode 100644 home/programs/nixvim/plugins/default.nix create mode 100644 home/programs/nixvim/plugins/diffview.nix create mode 100644 home/programs/nixvim/plugins/dynomark.nix create mode 100644 home/programs/nixvim/plugins/edgy.nix create mode 100644 home/programs/nixvim/plugins/gitsigns.nix create mode 100644 home/programs/nixvim/plugins/haskell-tools.nix create mode 100644 home/programs/nixvim/plugins/knap.nix create mode 100644 home/programs/nixvim/plugins/leap.nix create mode 100644 home/programs/nixvim/plugins/lsp.nix create mode 100644 home/programs/nixvim/plugins/ltex-extra.nix create mode 100644 home/programs/nixvim/plugins/lualine.nix create mode 100644 home/programs/nixvim/plugins/markdown-preview.nix create mode 100644 home/programs/nixvim/plugins/mkdnflow.nix create mode 100644 home/programs/nixvim/plugins/neoscroll.nix create mode 100644 home/programs/nixvim/plugins/neotree.nix create mode 100644 home/programs/nixvim/plugins/noice.nix create mode 100644 home/programs/nixvim/plugins/notify.nix create mode 100644 home/programs/nixvim/plugins/oil.nix create mode 100644 home/programs/nixvim/plugins/otter.nix create mode 100644 home/programs/nixvim/plugins/papis.nix create mode 100644 home/programs/nixvim/plugins/peek.nix create mode 100644 home/programs/nixvim/plugins/render-markdown.nix create mode 100644 home/programs/nixvim/plugins/smart-splits.nix create mode 100644 home/programs/nixvim/plugins/snippets.nix create mode 100644 home/programs/nixvim/plugins/sniprun.nix create mode 100644 home/programs/nixvim/plugins/startup.nix create mode 100644 home/programs/nixvim/plugins/surround.nix create mode 100644 home/programs/nixvim/plugins/telescope.nix create mode 100644 home/programs/nixvim/plugins/texpresso.nix create mode 100644 home/programs/nixvim/plugins/todo-comments.nix create mode 100644 home/programs/nixvim/plugins/toggleterm.nix create mode 100644 home/programs/nixvim/plugins/treesitter.nix create mode 100644 home/programs/nixvim/plugins/trouble.nix create mode 100644 home/programs/nixvim/plugins/typst-preview.nix create mode 100644 home/programs/nixvim/plugins/typst-vim.nix create mode 100644 home/programs/nixvim/plugins/undotree.nix create mode 100644 home/programs/nixvim/plugins/vimtex.nix create mode 100644 home/programs/nixvim/plugins/which-key.nix create mode 100644 home/programs/nixvim/plugins/yanky.nix create mode 100644 home/programs/nixvim/plugins/zk.nix delete mode 100644 home/programs/planify.nix diff --git a/builds/flutter.nix b/builds/flutter.nix deleted file mode 100644 index 9ea9c3b..0000000 --- a/builds/flutter.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.programs.flutter; - androidComposition = pkgs.androidenv.composeAndroidPackages { - toolsVersion = "26.1.1"; - platformToolsVersion = "35.0.1"; - buildToolsVersions = [ - "30.0.3" - "33.0.1" - "34.0.0" - ]; - platformVersions = [ - "31" - "33" - "34" - ]; - abiVersions = [ "x86_64" ]; - includeEmulator = true; - emulatorVersion = "35.1.4"; - includeSystemImages = true; - systemImageTypes = [ "google_apis_playstore" ]; - includeSources = false; - extraLicenses = [ - "android-googletv-license" - "android-sdk-arm-dbt-license" - "android-sdk-license" - "android-sdk-preview-license" - "google-gdk-license" - "intel-android-extra-license" - "intel-android-sysimage-license" - "mips-android-sysimage-license" - ]; - }; - androidSdk = androidComposition.androidsdk; - buildToolsVersion = "33.0.1"; -in { - options.programs.flutter = { - enable = mkEnableOption "Flutter development environment"; - addToKvmGroup = mkEnableOption "Add user to KVM group for hardware acceleration"; - enableAdb = mkEnableOption "Enable ADB and add user to adbusers group"; - user = mkOption { - type = types.str; - description = "Username for Flutter development"; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - flutter - androidSdk - # android-studio - jdk17 - firebase-tools - ]; - - environment.variables = { - ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; - ANDROID_HOME = "${androidSdk}/libexec/android-sdk"; - JAVA_HOME = "${pkgs.jdk17}"; - GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2"; - }; - - nixpkgs.config = { - android_sdk.accept_license = true; - allowUnfree = true; - }; - - environment.shellInit = '' - export PATH=$PATH:${androidSdk}/libexec/android-sdk/platform-tools - export PATH=$PATH:${androidSdk}/libexec/android-sdk/cmdline-tools/latest/bin - export PATH=$PATH:${androidSdk}/libexec/android-sdk/emulator - export PATH="$PATH":"$HOME/.pub-cache/bin" - ''; - - programs.adb.enable = cfg.enableAdb; - - users.users.${cfg.user}.extraGroups = - (optional cfg.addToKvmGroup "kvm") ++ (optional cfg.enableAdb "adbusers"); - }; -} - diff --git a/configuration.nix b/configuration.nix index 5cf5bae..1463694 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,7 +2,10 @@ { # Importing necessary setup for Steam & Printing & Flutter. - imports = [ ./builds/steam/default.nix ./home/extras/printer.nix ./builds/flutter.nix ]; + imports = [ + ./builds/steam/default.nix + ./home/extras/printer.nix + ]; # Use the systemd-boot EFI boot loader. boot.loader = { @@ -33,7 +36,10 @@ }; # Activate Flakes. - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; # Configuration of the Garbage collect. nix.gc = { @@ -65,7 +71,6 @@ zsh.enable = true; }; - # Define a user account. users = { mutableUsers = false; @@ -73,9 +78,14 @@ isNormalUser = true; home = "/home/elias"; shell = pkgs.zsh; - extraGroups = [ "wheel" "networkmanager" "audio" "video" "adbusers" ]; - hashedPassword = - "$6$pdAJt1f0v7Zb13Ri$1WpKrErAp5JCb7eXs7EeeWYRMBLu5/WKDdMyGzJyYQDijG2NiywUXpAkl/8p1noxOOqYbb.MTw7JmTzhWGsT21"; + extraGroups = [ + "wheel" + "networkmanager" + "audio" + "video" + "adbusers" + ]; + hashedPassword = "$6$pdAJt1f0v7Zb13Ri$1WpKrErAp5JCb7eXs7EeeWYRMBLu5/WKDdMyGzJyYQDijG2NiywUXpAkl/8p1noxOOqYbb.MTw7JmTzhWGsT21"; }; }; @@ -84,16 +94,13 @@ (catppuccin-sddm.override { flavor = "mocha"; accent = "mauve"; - font = "Fira Code"; + font = "Fira Code"; fontSize = "9"; # background = "${./wallpaper.png}"; loginBackground = true; }) exiftool - flutter - dart - git wget curl @@ -129,19 +136,8 @@ XDG_STATE_HOME = "$HOME/.local/state"; }; - # Virtualbox - # boot.kernelParams = [ "kvm.enable_virt_at_load=0" ]; - # boot.kernelModules = ["kvm-amd"]; - # virtualisation.virtualbox.host.enable = true; - # users.extraGroups.vboxusers.members = [ "user-with-access-to-virtualbox" "kv" ]; - # virtualisation.virtualbox.host.enableExtensionPack = true; - # virtualisation.virtualbox.guest.enable = true; - # virtualisation.virtualbox.guest.dragAndDrop = true; - # virtualisation.virtualbox.host.enableKvm = true; - # virtualisation.virtualbox.host.addNetworkInterface = false; - # Hyprlock - security.pam.services.hyprlock = {}; + security.pam.services.hyprlock = { }; # Enabling the Keyring. security.pam.services.lightdm.enableGnomeKeyring = true; @@ -173,4 +169,3 @@ }; system.stateVersion = "23.11"; } - diff --git a/flake.lock b/flake.lock index a4d457f..63e464b 100644 --- a/flake.lock +++ b/flake.lock @@ -22,6 +22,27 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "nur", @@ -66,9 +87,7 @@ "inputs": { "flake-parts": "flake-parts", "neovim-src": "neovim-src", - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1764547590, @@ -100,23 +119,59 @@ "type": "github" } }, + "nix-vscode-extensions": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771555311, + "narHash": "sha256-aFjIc57eYBx5jgyLcHujraPf6b/p9RWxzvOGnHML5h0=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "88fc33a8a8868de1ac41362fb62341513904dc0f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1764517877, - "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", + "lastModified": 1771177547, + "narHash": "sha256-trTtk3WTOHz7hSw89xIIvahkgoFJYQ0G43IlqprFoMA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", + "rev": "ac055f38c798b0d87695240c7b761b82fc7e5bc2", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { + "locked": { + "lastModified": 1764517877, + "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1764517877, "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", @@ -132,10 +187,32 @@ "type": "github" } }, - "nur": { + "nixvim": { "inputs": { "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1771135771, + "narHash": "sha256-wyvBIhDuyCRyjB3yPg77qoyxrlgQtBR1rVW3c9knV3E=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "ed0424f0b08d303a7348f52f7850ad1b2704f9ba", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1764594412, @@ -155,9 +232,26 @@ "inputs": { "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", - "nixpkgs": "nixpkgs", + "nix-vscode-extensions": "nix-vscode-extensions", + "nixpkgs": "nixpkgs_2", + "nixvim": "nixvim", "nur": "nur" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 8a220f8..72e0c52 100644 --- a/flake.nix +++ b/flake.nix @@ -9,57 +9,76 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - nur = { url = "github:nix-community/NUR"; }; + nur = { + url = "github:nix-community/NUR"; + }; - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; + nixvim = { + url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; + + # Nix expressions for VSCode and OpenVSX extensions + nix-vscode-extensions = { + url = "github:nix-community/nix-vscode-extensions"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; }; - outputs = { nixpkgs, home-manager, nur, ... }@inputs: { - formatter.x86_64-linux = - nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; - nixosConfigurations = { - eliasLaptop = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./machines/configuration-laptop.nix - ./home/services/pipewire.nix - nur.modules.nixos.default - home-manager.nixosModules.home-manager - { - home-manager = { - useUserPackages = true; - extraSpecialArgs = { inherit inputs; }; - users.elias = import ./home/default-laptop.nix; - }; - nixpkgs.overlays = [ - # (import ./overlays/river-status.nix) - inputs.nur.overlays.default - ]; - } - ]; - }; - eliasDesktop = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./machines/configuration-desktop.nix - ./home/services/pipewire.nix - nur.modules.nixos.default - home-manager.nixosModules.home-manager - { - home-manager = { - useUserPackages = true; - extraSpecialArgs = { inherit inputs; }; - users.elias = import ./home/default-desktop.nix; - }; - nixpkgs.overlays = [ - inputs.nur.overlays.default - ]; - } - ]; + outputs = + { + nixpkgs, + home-manager, + nur, + nixvim, + ... + }@inputs: + { + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; + nixosConfigurations = { + eliasLaptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/configuration-laptop.nix + ./home/services/pipewire.nix + nur.modules.nixos.default + home-manager.nixosModules.home-manager + { + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users.elias = import ./home/default-laptop.nix; + }; + nixpkgs.overlays = [ + # (import ./overlays/river-status.nix) + inputs.nur.overlays.default + inputs.nix-vscode-extensions.overlays.default + ]; + } + ]; + }; + eliasDesktop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/configuration-desktop.nix + ./home/services/pipewire.nix + nur.modules.nixos.default + home-manager.nixosModules.home-manager + { + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users.elias = import ./home/default-desktop.nix; + }; + nixpkgs.overlays = [ + inputs.nur.overlays.default + inputs.nix-vscode-extensions.overlays.default + ]; + } + ]; + }; }; }; - }; } diff --git a/home/default.nix b/home/default.nix index 082877f..e10ee31 100644 --- a/home/default.nix +++ b/home/default.nix @@ -19,10 +19,6 @@ pavucontrol sshfs - obsidian - lean4 - gcc - cups firefox bitwarden-desktop diff --git a/home/programs/default.nix b/home/programs/default.nix index 9b3bf35..61eaf89 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -12,10 +12,9 @@ ./inkscape.nix ./libreoffice.nix ./messenger.nix - ./neovim ./nextcloud.nix + ./nixvim ./picard.nix - ./planify.nix ./prismlauncher.nix ./pulseaudio ./river diff --git a/home/programs/nixvim/default.nix b/home/programs/nixvim/default.nix new file mode 100644 index 0000000..835f881 --- /dev/null +++ b/home/programs/nixvim/default.nix @@ -0,0 +1,104 @@ +{ inputs, pkgs, ... }: + +{ + imports = [ + inputs.nixvim.homeModules.nixvim + ./plugins + ]; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + + programs.nixvim = { + enable = true; + defaultEditor = true; + + nixpkgs.useGlobalPackages = false; + + clipboard = { + providers = { + wl-copy.enable = true; + }; + }; + + viAlias = true; + vimAlias = true; + + lualoader.enable = true; + + extraPackages = with pkgs; [ + texliveFull + texlivePackages.standalone + # papis-nvim + ] + ; + extraConfigVim = '' + filetype plugin on + set nocompatible + syntax on + ''; + + colorscheme = "catppuccin"; + colorschemes.catppuccin = { + #lazyLoad.enable = true; + enable = true; + flavour = "mocha"; + settings = { + integrations = { + markdown = true; + leap = true; + dap = true; + dap_ui = true; + lsp_trouble = true; + blink_cmp = true; + gitsigns = true; + diffview = true; + treesitter = true; + barbar = true; + telescope = true; + native_lsp = { + enabled = true; + virtual_text = { + errors = [ "italic" ]; + hints = [ "italic" ]; + warnings = [ "italic" ]; + information = [ "italic" ]; + ok = [ "italic" ]; + }; + underlines = { + errors = [ "underline" ]; + hints = [ "underline" ]; + warnings = [ "underline" ]; + information = [ "underline" ]; + ok = [ "underline" ]; + }; + inlay_hints = { + background = true; + }; + }; + lsp_saga = true; + }; + }; + }; + + globals = { + mapleader = " "; + maplocalleader = ","; + }; + + opts = { + cursorline = true; # Enable highlighting of the current line + expandtab = true; # Use spaces instead of tabs + list = true; # Show some invisible characters (tabs...) + mouse = "a"; # Enable mouse mode + number = true; # Print line number + relativenumber = true; # Relative line numbers + shiftround = true; # Round indent + shiftwidth = 2; # Size of an indent + smartindent = true; # Insert indents automatically + spelllang = [ "en" ]; + tabstop = 2; # Number of spaces tabs count for + }; + }; +} diff --git a/home/programs/nixvim/plugins/autopairs.nix b/home/programs/nixvim/plugins/autopairs.nix new file mode 100644 index 0000000..2aed7bb --- /dev/null +++ b/home/programs/nixvim/plugins/autopairs.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + nvim-autopairs = { + enable = true; + settings = { + check_ts = true; + }; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/barbar.nix b/home/programs/nixvim/plugins/barbar.nix new file mode 100644 index 0000000..2392280 --- /dev/null +++ b/home/programs/nixvim/plugins/barbar.nix @@ -0,0 +1,85 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + barbar = { + enable = true; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "b"; + group = "Buffers"; + icon = "󰓩 "; + } + { + __unkeyed-1 = ","; + icon = " "; + } + { + __unkeyed-1 = "."; + icon = " "; + } + ]; + }; + keymaps = [ + { + action = "BufferPrevious"; + key = ","; + mode = "n"; + options = { + desc = "Tab "; + }; + } + { + action = "BufferNext"; + key = "."; + mode = "n"; + options = { + desc = "Tab "; + }; + } + { + action = "BufferMovePrevious"; + key = "b<"; + mode = "n"; + options = { + desc = "Re-Order "; + }; + } + { + action = "BufferMoveNext"; + key = "b>"; + mode = "n"; + options = { + desc = "Re-Order "; + }; + } + { + action = "BufferClose"; + key = "bc"; + mode = "n"; + options = { + desc = "Close"; + }; + } + { + action = "tabnew +Telescope\\ file_browser"; + key = "bn"; + mode = "n"; + options = { + desc = "Create"; + }; + } + { + action = "BufferPick"; + key = "bp"; + mode = "n"; + options = { + desc = "Pick Tab"; + }; + } + ]; + }; +} + diff --git a/home/programs/nixvim/plugins/bullets.nix b/home/programs/nixvim/plugins/bullets.nix new file mode 100644 index 0000000..46076a6 --- /dev/null +++ b/home/programs/nixvim/plugins/bullets.nix @@ -0,0 +1,68 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + bullets = { + enable = true; + settings = { + enabled_file_types = [ + "markdown" + "text" + "gitcommit" + ]; + set_mappings = 0; + checkbox_markers = " -X"; + custom_mappings = [ + [ + "nmap" + "o" + "(bullets-newline)" + ] + [ + "vmap" + "gN" + "(bullets-renumber)" + ] + [ + "nmap" + "gN" + "(bullets-renumber)" + ] + [ + "imap" + "" + "(bullets-demote)" + ] + [ + "nmap" + ">>" + "(bullets-demote)" + ] + [ + "vmap" + ">" + "(bullets-demote)" + ] + [ + "imap" + "" + "(bullets-promote)" + ] + [ + "nmap" + "<<" + "(bullets-promote)" + ] + [ + "vmap" + "<" + "(bullets-promote)" + ] + ]; + }; + }; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/cmp.nix b/home/programs/nixvim/plugins/cmp.nix new file mode 100644 index 0000000..6f3ee2e --- /dev/null +++ b/home/programs/nixvim/plugins/cmp.nix @@ -0,0 +1,73 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + blink-cmp = { + enable = true; + settings = { + keymap = { + preset = "default"; + }; + snippets = { + preset = "luasnip"; + }; + completion = { + accept = { + auto_brackets = { + enabled = true; + kind_resolution = { + enabled = true; + }; + semantic_token_resolution = { + enabled = true; + timeout_ms = 400; + }; + }; + }; + }; + sources = { + per_filetype = { + yaml = [ "papis" ]; + }; + providers = { + spell = { + module = "blink-cmp-spell"; + name = "Spell"; + score_offset = 100; + opts = { }; + }; + vimtex = { + name = "vimtex"; + module = "blink.compat.source"; + }; + dap = { + name = "dap"; + module = "blink.compat.source"; + }; + mkdnflow = { + name = "mkdnflow"; + module = "blink.compat.source"; + }; + }; + default = [ + "lsp" + "mkdnflow" + "path" + "snippets" + # "dap" + "vimtex" + "buffer" + "spell" + ]; + }; + }; + }; + blink-cmp-spell.enable = true; + blink-compat.enable = true; + cmp-vimtex.enable = true; + # cmp-dap.enable = true; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/comment-box.nix b/home/programs/nixvim/plugins/comment-box.nix new file mode 100644 index 0000000..4cefedb --- /dev/null +++ b/home/programs/nixvim/plugins/comment-box.nix @@ -0,0 +1,56 @@ +{...}: + +{ + programs.nixvim = { + plugins = { + comment-box = { + enable = true; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "c"; + group = "Boxes"; + icon = "□ "; + } + ]; + }; + keymaps = [ + { + key = "cb"; + action = "CBccbox"; + options = { + desc = "Box Title"; + }; + } + { + key = "ct"; + action = "CBllline"; + options = { + desc = "Titled Line"; + }; + } + { + key = "cl"; + action = "CBline"; + options = { + desc = "Simple Line"; + }; + } + { + key = "cm"; + action = "CBllbox14"; + options = { + desc = "Marked"; + }; + } + { + key = "cd"; + action = "CBd"; + options = { + desc = "Remove a Box"; + }; + } + ]; + }; +} + diff --git a/home/programs/nixvim/plugins/comment.nix b/home/programs/nixvim/plugins/comment.nix new file mode 100644 index 0000000..8a4d813 --- /dev/null +++ b/home/programs/nixvim/plugins/comment.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + comment = { + enable = true; + settings = { + mappings = { + basic = true; + }; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/conform.nix b/home/programs/nixvim/plugins/conform.nix new file mode 100644 index 0000000..c71798d --- /dev/null +++ b/home/programs/nixvim/plugins/conform.nix @@ -0,0 +1,133 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ + stylua + rustfmt + fourmolu + shellcheck + shellharden + shfmt + black + beamMinimal28Packages.elixir + clang-tools + prettierd + nixfmt-rfc-style + tex-fmt + hclfmt + topiary # TODO: Install https://github.com/blindFS/topiary-nushell somehow, e.g. clone languages.ncl to ~/.config/topiary/languages.ncl & nu.scm to ~/.config/topiary/topiary-queries/queries/nu.scm + ]; + + programs.nixvim.plugins = { + conform-nvim = { + enable = true; + settings = { + formatters_by_ft = { + lua = [ "stylua" ]; + rust = [ "rustfmt" ]; + python = [ + "black" + ]; + haskell = [ "fourmolu" ]; + terraform = [ "hcl" ]; + elixir = [ "mix" ]; + bash = [ + "shellcheck" + "shellharden" + "shfmt" + ]; + sh = [ + "shellcheck" + "shfmt" + ]; + c = [ "clang-format" ]; + cpp = [ "clang-format" ]; + markdown = [ "prettierd" ]; + json = [ "prettierd" ]; + yaml = [ "prettierd" ]; + nu = [ "topiary_nu" ]; + nix = [ "nixfmt" ]; + tex = [ + "tex-fmt" + ]; + "_" = [ + "squeeze_blanks" + "trim_whitespace" + "trim_newlines" + ]; + }; + format_on_save = # Lua + '' + function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + return { lsp_fallback = true } + end + ''; + format_after_save = # Lua + '' + function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + return { lsp_fallback = true } + end + ''; + formatters = { + topiary_nu = { + command = "topiary"; + args = [ + "format" + "--language" + "nu" + ]; + }; + stylua = { + "inherit" = true; + prepend_args = [ + "--indent-type" + "Spaces" + "--indent-width" + "2" + ]; + }; + tex-fmt = { + command = "tex-fmt"; + }; + }; + }; + }; + }; + + programs.nixvim.userCommands = { + FormatDisable = { + bang = true; + desc = "Disable autoformat-on-save"; + command.__raw = # Lua + '' + function(args) + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end + ''; + }; + FormatEnable = { + desc = "Re-enable autoformat-on-save"; + command.__raw = # Lua + '' + function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end + ''; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/dap.nix b/home/programs/nixvim/plugins/dap.nix new file mode 100644 index 0000000..4cd659c --- /dev/null +++ b/home/programs/nixvim/plugins/dap.nix @@ -0,0 +1,298 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + lldb_19 + gdb + rustc + # python3.withPackages + # (ps: with ps; [ debugpy ]) + ]; + + programs.nixvim = { + plugins = { + dap-python = { + enable = true; + }; + + dap = { + enable = true; + luaConfig.post = '' + local dap, dapui = require("dap"), require("dapui") + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + ''; + adapters = { + executables = { + lldb = { + command = "${pkgs.lldb_19}/bin/lldb-dap"; + }; + gdb = { + command = "${pkgs.gdb}/bin/gdb"; + args = [ + "--interpreter=dap" + "--eval-command" + "set print pretty on" + ]; + }; + rust-gdb = { + command = "${pkgs.rustc}/bin/rust-gdb"; + args = [ + "--interpreter=dap" + "--eval-command" + "set print pretty on" + ]; + }; + }; + }; + signs = { + dapBreakpoint.text = ""; + }; + configurations = { + cpp = [ + { + name = "Launch"; + type = "gdb"; + request = "launch"; + program.__raw = # lua + '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + cwd = "\${workspaceFolder}"; + stopAtBeginningOfMainSubprogram = false; + } + { + name = "Select and attach to process"; + type = "gdb"; + request = "attach"; + program._raw = # lua + '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + pid.__raw = '' + function() + local name = vim.fn.input('Executable name (filter): ') + return require("dap.utils").pick_process({ filter = name }) + end + ''; + cwd = "\${workspaceFolder}"; + } + { + name = "Attach to gdbserver :1234"; + type = "gdb"; + request = "attach"; + target = "localhost:1234"; + program.__raw = '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + cwd = "\${workspaceFolder}"; + } + ]; + c = [ + { + name = "Launch file"; + type = "lldb"; + request = "launch"; + cwd = "\${workspaceFolder}"; + stopOnEntry = false; + program.__raw = # lua + '' + function() + return coroutine.create(function(coro) + local opts = {} + require("telescope.pickers") + .new(opts, { + prompt_title = "Path to executable", + finder = require("telescope.finders").new_oneshot_job({ "fd", "--hidden", "--no-ignore", "--type", "x" }, {}), + sorter = require("telescope.config").values.generic_sorter(opts), + attach_mappings = function(buffer_number) + require("telescope.actions").select_default:replace(function() + require("telescope.actions").close(buffer_number) + coroutine.resume(coro, require("telescope.actions.state").get_selected_entry()[1]) + end) + return true + end, + }) + :find() + end) + end + ''; + args = { }; + } + ]; + rust = [ + { + name = "Launch"; + type = "rust-gdb"; + request = "launch"; + program.__raw = '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + args = { }; + cwd = "\${workspaceFolder}"; + stopAtBeginningOfMainSubprogram = false; + } + { + name = "Select and attach to process"; + type = "rust-gdb"; + request = "attach"; + program.__raw = '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + pid.__raw = '' + function() + local name = vim.fn.input('Executable name (filter): ') + return require("dap.utils").pick_process({ filter = name }) + end + ''; + cwd = "\${workspaceFolder}"; + } + { + name = "Attach to gdbserver :1234"; + type = "rust-gdb"; + request = "attach"; + target = "localhost:1234"; + program.__raw = '' + function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end + ''; + cwd = "\${workspaceFolder}"; + } + ]; + }; + }; + dap-ui = { + enable = true; + }; + dap-virtual-text = { + enable = true; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "d"; + group = "Debugger"; + icon = " "; + } + ]; + }; + keymaps = [ + { + key = "dt"; + action.__raw = "function() require('dap').toggle_breakpoint() end"; + mode = [ "n" ]; + options = { + desc = "Toggle Breakpoint"; + }; + } + { + key = "dc"; + action.__raw = "function() require('dap').continue() end"; + mode = [ "n" ]; + options = { + desc = "Continue"; + }; + } + { + key = "dc"; + action.__raw = "function() require('dap').continue() end"; + mode = [ "n" ]; + options = { + desc = "Continue"; + }; + } + { + key = "di"; + action.__raw = "function() require('dap').step_into() end"; + mode = [ "n" ]; + options = { + desc = "Step Into"; + }; + } + { + key = "do"; + action.__raw = "function() require('dap').step_over() end"; + mode = [ "n" ]; + options = { + desc = "Step Over"; + }; + } + { + key = "du"; + action.__raw = "function() require('dap').step_out() end"; + mode = [ "n" ]; + options = { + desc = "Step Out"; + }; + } + { + key = "dr"; + action.__raw = "function() require('dap').repl.open() end"; + mode = [ "n" ]; + options = { + desc = "Open REPL"; + }; + } + { + key = "dl"; + action.__raw = "function() require('dap').run_last() end"; + mode = [ "n" ]; + options = { + desc = "Run Last"; + }; + } + { + key = "dq"; + action.__raw = # lua + '' + function() + require("dap").terminate() + require("dapui").close() + require("nvim-dap-virtual-text").toggle() + end + ''; + mode = [ "n" ]; + options = { + desc = "Terminate"; + }; + } + { + key = "db"; + action.__raw = "function() require('dap').list_breakpoints() end"; + mode = [ "n" ]; + options = { + desc = "List Breakpoints"; + }; + } + { + key = "de"; + action.__raw = "function() require('dap').set_exception_breakpoints({ ' all ' }) end"; + mode = [ "n" ]; + options = { + desc = "Set Exception Breakpoints"; + }; + } + ]; + }; +} + diff --git a/home/programs/nixvim/plugins/default.nix b/home/programs/nixvim/plugins/default.nix new file mode 100644 index 0000000..562a96c --- /dev/null +++ b/home/programs/nixvim/plugins/default.nix @@ -0,0 +1,52 @@ +{ + imports = [ + ./autopairs.nix + ./barbar.nix + ./bullets.nix + ./cmp.nix + ./comment-box.nix + ./comment.nix + ./conform.nix + ./dap.nix + ./diffview.nix + ./dynomark.nix + ./edgy.nix + ./gitsigns.nix + ./haskell-tools.nix + ./knap.nix + ./leap.nix + ./lsp.nix + ./ltex-extra.nix + ./lualine.nix + ./markdown-preview.nix + ./mkdnflow.nix + ./neoscroll.nix + ./neotree.nix + ./noice.nix + ./notify.nix + ./oil.nix + ./otter.nix + ./papis.nix + ./peek.nix + ./markdown-preview.nix + ./smart-splits.nix + ./sniprun.nix + ./startup.nix + ./surround.nix + ./telescope.nix + ./texpresso.nix + ./todo-comments.nix + ./toggleterm.nix + ./treesitter.nix + ./trouble.nix + ./typst-preview.nix + ./typst-vim.nix + ./undotree.nix + ./vimtex.nix + ./which-key.nix + ./yanky.nix + ./zk.nix + + ./snippets.nix + ]; +} diff --git a/home/programs/nixvim/plugins/diffview.nix b/home/programs/nixvim/plugins/diffview.nix new file mode 100644 index 0000000..2b7bc78 --- /dev/null +++ b/home/programs/nixvim/plugins/diffview.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: + +{ + programs.nixvim = { + plugins = { + diffview = { + enable = true; + }; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/dynomark.nix b/home/programs/nixvim/plugins/dynomark.nix new file mode 100644 index 0000000..ba922aa --- /dev/null +++ b/home/programs/nixvim/plugins/dynomark.nix @@ -0,0 +1,43 @@ +{ pkgs, ... }: + +let + dynomark-nvim = pkgs.vimUtils.buildVimPlugin { + name = "dynomark.nvim"; + doCheck = false; + src = pkgs.pkgs.fetchFromGitHub { + owner = "k-lar"; + repo = "dynomark.nvim"; + rev = "a59f4e44a7619747552d869747d0f3fbb7be32b3"; + hash = "sha256-zrPpFMLI2lbqm0W/I530519d7RQKDK9HRouMNAsXv+U="; + }; + }; +in +{ + programs.nixvim = { + + extraPlugins = [ + dynomark-nvim + ]; + + extraConfigLua = ''require('dynomark').setup({})''; + + keymaps = [ + { + key = "v"; + action = "(DynomarkToggle)"; + mode = [ "n" ]; + options = { + desc = "Toggle Dynomark"; + }; + } + { + key = "V"; + action = "(DynomarkRun)"; + mode = [ "n" ]; + options = { + desc = "Run dynomark query under cursor"; + }; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/edgy.nix b/home/programs/nixvim/plugins/edgy.nix new file mode 100644 index 0000000..d158c14 --- /dev/null +++ b/home/programs/nixvim/plugins/edgy.nix @@ -0,0 +1,80 @@ +{ ... }: + +{ + programs.nixvim = { + localOpts = { + # views can only be fully collapsed with the global statusline + laststatus = 3; + # Default splitting will cause your main splits to jump when opening an edgebar. + # To prevent this, set `splitkeep` to either `screen` or `topline`. + splitkeep = "screen"; + }; + plugins = { + edgy = { + enable = true; + autoLoad = true; + settings = { + bottom.__raw = '' + { + -- toggleterm / lazyterm at the bottom with a height of 40% of the screen + { + ft = "toggleterm", + size = { height = 0.2 }, + -- exclude floating windows + filter = function(buf, win) + return vim.api.nvim_win_get_config(win).relative == "" + end + }, + "Trouble", + { ft = "qf", title = "QuickFix" }, + { + ft = "help", + size = { height = 20 }, + -- only show help buffers + filter = function(buf) + return vim.bo[buf].buftype == "help" + end + } + } + ''; + left.__raw = '' + { + -- Neo-tree filesystem always takes half the screen height + { + title = "Neo-Tree", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "filesystem" + end, + size = { height = 0.2 } + }, + { + title = "Neo-Tree Git", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "git_status" + end, + pinned = true, + collapsed = true, -- show window as closed/collapsed on start + open = "Neotree position=right git_status" + }, + { + title = "Neo-Tree Buffers", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "buffers" + end, + pinned = true, + collapsed = true, -- show window as closed/collapsed on start + open = "Neotree position=top buffers" + }, + -- any other neo-tree windows + "neo-tree" + } + ''; + }; + }; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/gitsigns.nix b/home/programs/nixvim/plugins/gitsigns.nix new file mode 100644 index 0000000..85acb44 --- /dev/null +++ b/home/programs/nixvim/plugins/gitsigns.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + gitsigns = { + enable = true; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/haskell-tools.nix b/home/programs/nixvim/plugins/haskell-tools.nix new file mode 100644 index 0000000..ae590df --- /dev/null +++ b/home/programs/nixvim/plugins/haskell-tools.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + +{ + programs.nixvim = { + extraPackages = with pkgs; [ + haskell.compiler.native-bignum.ghc912 + haskellPackages.haskell-language-server + haskellPackages.stack + haskellPackages.fast-tags + haskellPackages.hoogle + haskellPackages.haskell-debug-adapter + haskellPackages.ghci-dap + ]; + + extraPlugins = with pkgs.vimPlugins; [ + haskell-tools-nvim + ]; + }; +} diff --git a/home/programs/nixvim/plugins/knap.nix b/home/programs/nixvim/plugins/knap.nix new file mode 100644 index 0000000..b2f8fea --- /dev/null +++ b/home/programs/nixvim/plugins/knap.nix @@ -0,0 +1,68 @@ +{ pkgs, ... }: + +# TODO: Make filetype keybindings work +let + keys = [ + { + action.__raw = "function() require('knap').close_viewer() end"; + key = "c"; + mode = [ + "n" + "v" + "i" + ]; + options = { + desc = "Close Viewer (knap)"; + }; + } + { + action.__raw = "function() require('knap').toggle_autopreviewing() end"; + key = "k"; + mode = [ + "n" + "v" + "i" + ]; + options = { + desc = "Toggle Auto-Processing (knap)"; + }; + } + { + action.__raw = "function() require('knap').forward_jump() end"; + key = "s"; + mode = [ + "n" + "v" + "i" + ]; + options = { + desc = "SyncTeX Forward Search (Knap)"; + }; + } + ]; +in +{ + home.packages = with pkgs; [ + pandoc + texliveFull + rubber + ]; + programs.nixvim = { + extraPlugins = with pkgs.vimPlugins; [ knap ]; + globals = { + knap_settings = { + htmltohtmlviewerlaunch = "luakit %outputfile%"; + mdtohtmlviewerlaunch = "luakit %outputfile%"; + markdowntohtmlviewerlaunch = "luakit %outputfile%"; + }; + }; + files = { + "ftplugin/latex.lua" = { + keymaps = keys; + }; + "ftplugin/markdown.lua" = { + keymaps = keys; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/leap.nix b/home/programs/nixvim/plugins/leap.nix new file mode 100644 index 0000000..98dcdd7 --- /dev/null +++ b/home/programs/nixvim/plugins/leap.nix @@ -0,0 +1,30 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + leap = { + enable = true; + settings = { + case_sensitive = false; + }; + }; + }; + keymaps = [ + { + key = "s"; + action = "(leap)"; + mode = [ + "n" + "x" + "o" + ]; + } + { + key = "S"; + action = "(leap-from-window)"; + mode = [ "n" ]; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/lsp.nix b/home/programs/nixvim/plugins/lsp.nix new file mode 100644 index 0000000..c1fdc8a --- /dev/null +++ b/home/programs/nixvim/plugins/lsp.nix @@ -0,0 +1,102 @@ +{ pkgs, config, ... }: + +{ + home.packages = with pkgs; [ + tofu-ls + zuban + ]; + + programs.nixvim = { + plugins.lsp.enable = true; + + lsp = { + luaConfig = { + post = '' + vim.lsp.enable('tofu_ls') + vim.lsp.enable('prolog_ls') + ''; + }; + servers = { + nixd = { + enable = false; + }; + rust_analyzer = { + enable = true; + }; + leanls = { + enable = true; + }; + nil_ls = { + enable = !config.programs.nixvim.plugins.lsp.servers.nixd.enable; + config = { + nil = { + formatting = { + command = [ + "nixfmt" + ]; + }; + diagnostics = { + ignored = [ ]; + }; + nix = { + flake = { + autoArchive = true; + }; + }; + }; + }; + }; + nushell = { + enable = true; + }; + pylsp = { + enable = true; + }; + pylyzer = { + enable = false; + }; + pyright = { + enable = true; + }; + clangd = { + enable = true; + }; + zk = { + enable = true; + }; + elixirls = { + enable = true; + }; + marksman = { + enable = true; + }; + texlab = { + enable = true; + }; + lua_ls = { + enable = true; + }; + ltex_plus = { + enable = true; + package = pkgs.ltex-ls-plus; + config = { + ltex = { + language = "en-US"; + enabled = [ + "latex" + "tex" + "bibtex" + "markdown" + "typst" + "quarto" + ]; + }; + }; + }; + tinymist = { + enable = true; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/ltex-extra.nix b/home/programs/nixvim/plugins/ltex-extra.nix new file mode 100644 index 0000000..55f59fd --- /dev/null +++ b/home/programs/nixvim/plugins/ltex-extra.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + ltex-extra = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/lualine.nix b/home/programs/nixvim/plugins/lualine.nix new file mode 100644 index 0000000..d506ffa --- /dev/null +++ b/home/programs/nixvim/plugins/lualine.nix @@ -0,0 +1,49 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + lualine = { + enable = true; + settings = { + theme = "catppuccin"; + # sections = { + # lualine_c = [ + # { + # __unkeyed-1 = { + # __raw = '' + # function() + # require("trouble").statusline({ + # mode = "lsp_document_symbols", + # groups = {}, + # title = false, + # filter = { range = true }, + # format = "{kind_icon}{symbol.name:Normal}", + # -- The following line is needed to fix the background color + # -- Set it to the lualine section you want to use + # hl_group = "lualine_c_normal", + # } + # ).get + # end + # ''; + # }; + # cond = { + # __raw = '' + # require("trouble").statusline({ + # mode = "lsp_document_symbols", + # groups = {}, + # title = false, + # filter = { range = true }, + # format = "{kind_icon}{symbol.name:Normal}", + # -- The following line is needed to fix the background color + # -- Set it to the lualine section you want to use + # hl_group = "lualine_c_normal", + # }).has + # ''; + # }; + # } + # ]; + # }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/markdown-preview.nix b/home/programs/nixvim/plugins/markdown-preview.nix new file mode 100644 index 0000000..ddb9dd1 --- /dev/null +++ b/home/programs/nixvim/plugins/markdown-preview.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + markdown-preview = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/mkdnflow.nix b/home/programs/nixvim/plugins/mkdnflow.nix new file mode 100644 index 0000000..4068f44 --- /dev/null +++ b/home/programs/nixvim/plugins/mkdnflow.nix @@ -0,0 +1,191 @@ +{ ... }: + +{ + programs.nixvim = { + extraConfigLua = '' + vim.api.nvim_create_autocmd("FileType", {pattern = "markdown", command = "set awa"}) + ''; + + plugins = { + mkdnflow = { + enable = true; + settings = { + links = { + style = "wiki"; + create_on_follow_failure = true; + conceal = true; + name_is_source = false; + implicit_extension = "md"; + context = 0; + transform_explicit.__raw = # Lua + '' + function(input) + if input:match('%d%d%d%d%-%d%d%-%d%d') then + return('journals/'..input) + else + require("zk.api").new(vim.fn.expand('%:p:h'), { dryRun = true }, function(err, res) + file_name = res.path:match("[^/]*.md$"):match("(.+)%..+$") + end) + return(file_name) + end + end + ''; + }; + modules = { + conceal = true; + cursor = true; + folds = true; + links = true; + lists = true; + maps = true; + paths = true; + tables = true; + yaml = true; + }; + filetypes = { + md = true; + qmd = true; + }; + to_do = { + symbols = [ + " " + "-" + "X" + ]; + update_parents = true; + }; + foldtext = { + title_transformer.__raw = '' + function() + local function my_title_transformer(text) + local updated_title = text:gsub("%b{}", "") + updated_title = updated_title:gsub("^%s*", "") + updated_title = updated_title:gsub("%s*$", "") + updated_title = updated_title:gsub("^######", "░░░░░▓") + updated_title = updated_title:gsub("^#####", "░░░░▓▓") + updated_title = updated_title:gsub("^####", "░░░▓▓▓") + updated_title = updated_title:gsub("^###", "░░▓▓▓▓") + updated_title = updated_title:gsub("^##", "░▓▓▓▓▓") + updated_title = updated_title:gsub("^#", "▓▓▓▓▓▓") + return updated_title + end + return my_title_transformer + end + ''; + object_count_icon_set = "nerdfont"; + object_count_opts.__raw = '' + function() + local opts = { + link = false, -- Prevent links from being counted + blockquote = { -- Count block quotes (these aren't counted by default) + icon = ' ', + count_method = { + pattern = { "^>.+$" }, + tally = "blocks", + } + }, + fncblk = { + -- Override the icon for fenced code blocks with  + icon = " " + } + } + return opts + end + ''; + line_count = false; + word_count = true; + fill_chars = { + left_edge = "╾─🖿 ─"; + right_edge = "──╼"; + item_separator = " · "; + section_separator = " // "; + left_inside = " ┝"; + right_inside = "┥ "; + middle = "─"; + }; + }; + mappings = { + MkdnEnter = { + key = ""; + modes = [ + "n" + "v" + "i" + ]; + }; + MkdnGoBack = { + key = ""; + modes = "n"; + }; + MkdnDecreaseHeading = { + key = "-"; + modes = "n"; + }; + MkdnIncreaseHeading = { + key = "+"; + modes = "n"; + }; + MkdnNewListItemAboveInsert = { + key = "O"; + modes = "n"; + }; + MkdnNewListItemBelowInsert = { + key = "o"; + modes = "n"; + }; + MkdnTableNewColAfter = { + key = "ic"; + modes = "n"; + }; + MkdnTableNewColBefore = { + key = "iC"; + modes = "n"; + }; + MkdnTableNewRowAbove = { + key = "iR"; + modes = "n"; + }; + MkdnTableNewRowBelow = { + key = "ir"; + modes = "n"; + }; + MkdnTableNextCell = { + key = ""; + modes = "i"; + }; + MkdnTablePrevCell = { + key = ""; + modes = "i"; + }; + MkdnToggleToDo = { + key = ""; + modes = [ + "n" + "v" + ]; + }; + }; + create_dirs = true; + new_file_template = { + use_template = true; + placeholders = { + before = { + title = "link_title"; + date = "os_date"; + }; + after = { }; + }; + template = '' + --- + title: {{ title }} + date: {{ date }} + tags: [] + --- + # {{ title }} + ''; + }; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/neoscroll.nix b/home/programs/nixvim/plugins/neoscroll.nix new file mode 100644 index 0000000..40a4403 --- /dev/null +++ b/home/programs/nixvim/plugins/neoscroll.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + neoscroll = { + enable = true; + settings = { + cursor_scrolls_alone = true; + easing_function = "quadratic"; + hide_cursor = true; + mappings = [ + "" + "" + "" + "" + "" + "" + "zt" + "zz" + "zb" + ]; + respect_scrolloff = false; + stop_eof = true; + }; + + }; + }; +} diff --git a/home/programs/nixvim/plugins/neotree.nix b/home/programs/nixvim/plugins/neotree.nix new file mode 100644 index 0000000..bc288dc --- /dev/null +++ b/home/programs/nixvim/plugins/neotree.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + neo-tree = { + enable = true; + settings = { + enable_git_status = true; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/noice.nix b/home/programs/nixvim/plugins/noice.nix new file mode 100644 index 0000000..91b521a --- /dev/null +++ b/home/programs/nixvim/plugins/noice.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + noice = { + enable = true; + settings = { + lsp.override = { + "vim.lsp.util.convert_input_to_markdown_lines" = true; + "vim.lsp.util.stylize_markdown" = true; + }; + prests = { + bottom_search = true; + command_palette = true; + inc_rename = false; + long_message_to_split = true; + lsp_doc_border = false; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/notify.nix b/home/programs/nixvim/plugins/notify.nix new file mode 100644 index 0000000..d5cb17a --- /dev/null +++ b/home/programs/nixvim/plugins/notify.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + notify = { + enable = true; + settings = { + render = "wrapped-compact"; + }; + }; + }; + opts = { + termguicolors = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/oil.nix b/home/programs/nixvim/plugins/oil.nix new file mode 100644 index 0000000..bb8c8eb --- /dev/null +++ b/home/programs/nixvim/plugins/oil.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + oil = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/otter.nix b/home/programs/nixvim/plugins/otter.nix new file mode 100644 index 0000000..272af71 --- /dev/null +++ b/home/programs/nixvim/plugins/otter.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + otter = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/papis.nix b/home/programs/nixvim/plugins/papis.nix new file mode 100644 index 0000000..3b5b62b --- /dev/null +++ b/home/programs/nixvim/plugins/papis.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + programs.nixvim = { + plugins = { + papis = { + enable = true; + settings = { + yq_bin = "${pkgs.yq-go}/bin/yq"; + search = { + provider = "telescope"; + }; + }; + }; + }; + + keymaps = [ + { + key = "pp"; + action = "Papis search"; + mode = [ "n" ]; + options = { + desc = "Papis"; + }; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/peek.nix b/home/programs/nixvim/plugins/peek.nix new file mode 100644 index 0000000..fa9f229 --- /dev/null +++ b/home/programs/nixvim/plugins/peek.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + peek = { + enable = true; + settings = { + app = "firefox"; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/render-markdown.nix b/home/programs/nixvim/plugins/render-markdown.nix new file mode 100644 index 0000000..4ab73d4 --- /dev/null +++ b/home/programs/nixvim/plugins/render-markdown.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ python312Packages.pylatexenc ]; + + programs.nixvim.plugins = { + render-markdown = { + enable = true; + settings = { + ft = [ + "markdown" + "quarto" + ]; + latex = { + enabled = false; + }; + completions = { + lsp = { + enabled = true; + }; + }; + }; + }; + + web-devicons = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/smart-splits.nix b/home/programs/nixvim/plugins/smart-splits.nix new file mode 100644 index 0000000..dcf3e43 --- /dev/null +++ b/home/programs/nixvim/plugins/smart-splits.nix @@ -0,0 +1,104 @@ +{ ... }: +{ + programs.nixvim.plugins = { + smart-splits = { + enable = true; + }; + }; + programs.nixvim.keymaps = [ + { + action.__raw = "require('smart-splits').move_cursor_left"; + key = "h"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').move_cursor_right"; + key = "l"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').move_cursor_down"; + key = "j"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').move_cursor_up"; + key = "k"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').resize_left"; + key = "h"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').resize_right"; + key = "l"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').resize_down"; + key = "j"; + mode = "n"; + } + { + action.__raw = "require('smart-splits').resize_up"; + key = "k"; + mode = "n"; + } + { + action = "silent !kitten @ launch --location=hsplit"; + key = "s"; + mode = [ + "n" + "v" + "i" + ]; + } + { + action = "silent !kitten @ launch --location=vsplit"; + key = "v"; + mode = [ + "n" + "v" + "i" + ]; + } + { + action = "silent !kitten @ launch --location=hsplit --cwd=current --bias=35"; + key = "p"; + mode = [ + "n" + "v" + "i" + ]; + } + { + action = "silent !kitten @ close-window"; + key = "q"; + mode = [ + "n" + "v" + "i" + ]; + } + { + action = "silent !kitten @ action layout_action rotate"; + key = "r"; + mode = [ + "n" + "v" + "i" + ]; + } + { + action = "silent !kitten @ action toggle_layout stack"; + key = "f"; + mode = [ + "n" + "v" + "i" + ]; + } + ]; +} diff --git a/home/programs/nixvim/plugins/snippets.nix b/home/programs/nixvim/plugins/snippets.nix new file mode 100644 index 0000000..a4d9aeb --- /dev/null +++ b/home/programs/nixvim/plugins/snippets.nix @@ -0,0 +1,15 @@ +{...}: + +{ + programs.nixvim.plugins = { + luasnip = { + enable = true; + fromVscode = [ { } ]; + }; + + friendly-snippets = { + enable = true; + }; + }; +} + diff --git a/home/programs/nixvim/plugins/sniprun.nix b/home/programs/nixvim/plugins/sniprun.nix new file mode 100644 index 0000000..450f8f0 --- /dev/null +++ b/home/programs/nixvim/plugins/sniprun.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + sniprun = { + enable = true; + settings = { + display = [ "VirtualLine" ]; + snipruncolors = { + SniprunVirtualTextOk = { + bg = "#91d7e3"; + fg = "#000000"; + ctermbg = "Cyan"; + ctermfg = "Black"; + }; + SniprunVirtualTextErr = { + bg = "#ee99a0"; + fg = "#000000"; + ctermbg = "DarkRed"; + ctermfg = "Black"; + }; + }; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/startup.nix b/home/programs/nixvim/plugins/startup.nix new file mode 100644 index 0000000..b05b83c --- /dev/null +++ b/home/programs/nixvim/plugins/startup.nix @@ -0,0 +1,71 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + startup = { + enable = true; + settings = { + theme = "dashboard"; + sections = { + body = { + align = "center"; + content = [ + [ + " Find File" + "Telescope find_files" + "ff" + ] + [ + "󰍉 Find Word" + "Telescope live_grep" + "lg" + ] + [ + " Recent Files" + "Telescope oldfiles" + "of" + ] + [ + " File Browser" + "Telescope file_browser" + "fb" + ] + [ + " Colorschemes" + "Telescope colorscheme" + "cs" + ] + [ + " New File" + "lua require'startup'.new_file()" + "nf" + ] + ]; + defaultColor = ""; + foldSection = true; + highlight = "String"; + margin = 5; + oldfilesAmount = 0; + title = "Basic Commands"; + type = "mapping"; + }; + header = { + align = "center"; + content = { + __raw = "require('startup.headers').hydra_header"; + }; + defaultColor = ""; + foldSection = false; + highlight = "Statement"; + margin = 5; + oldfilesAmount = 0; + title = "Header"; + type = "text"; + }; + }; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/surround.nix b/home/programs/nixvim/plugins/surround.nix new file mode 100644 index 0000000..2bcb458 --- /dev/null +++ b/home/programs/nixvim/plugins/surround.nix @@ -0,0 +1,162 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + nvim-surround = { + enable = true; + luaConfig.post = # lua + '' + local M = {} + + M.get_input = function(prompt) + local input = require("nvim-surround.input") + return input.get_input(prompt) + end + + M.get_selection = function(args) + if args.char then + return M.get_find(args.char)(args.char) + elseif args.motion then + return require("nvim-surround.motions").get_selection(args.motion) + elseif args.node then + return require("nvim-surround.treesitter").get_selection(args.node) + elseif args.pattern then + return require("nvim-surround.patterns").get_selection(args.pattern) + elseif args.query then + return require("nvim-surround.queries").get_selection(args.query.capture, args.query.type) + else + vim.notify("Invalid key provided for `:h nvim-surround.config.get_selection()`.", vim.log.levels.ERROR) + end + end + + surrounds = { + ["("] = { + add = { "( ", " )" }, + find = function() + return M.get_selection({ motion = "a(" }) + end, + delete = "^(. ?)().-( ?.)()$", + }, + [")"] = { + add = { "(", ")" }, + find = function() + return M.get_selection({ motion = "a)" }) + end, + delete = "^(.)().-(.)()$", + }, + ["{"] = { + add = { "{ ", " }" }, + find = function() + return M.get_selection({ motion = "a{" }) + end, + delete = "^(. ?)().-( ?.)()$", + }, + ["}"] = { + add = { "{", "}" }, + find = function() + return M.get_selection({ motion = "a}" }) + end, + delete = "^(.)().-(.)()$", + }, + ["<"] = { + add = { "< ", " >" }, + find = function() + return M.get_selection({ motion = "a<" }) + end, + delete = "^(. ?)().-( ?.)()$", + }, + [">"] = { + add = { "<", ">" }, + find = function() + return M.get_selection({ motion = "a>" }) + end, + delete = "^(.)().-(.)()$", + }, + ["["] = { + add = { "[ ", " ]" }, + find = function() + return M.get_selection({ motion = "a[" }) + end, + delete = "^(. ?)().-( ?.)()$", + }, + ["]"] = { + add = { "[", "]" }, + find = function() + return M.get_selection({ motion = "a]" }) + end, + delete = "^(.)().-(.)()$", + }, + ["'"] = { + add = { "'", "'" }, + find = function() + return M.get_selection({ motion = "a'" }) + end, + delete = "^(.)().-(.)()$", + }, + ['"'] = { + add = { '"', '"' }, + find = function() + return M.get_selection({ motion = 'a"' }) + end, + delete = "^(.)().-(.)()$", + }, + ["`"] = { + add = { "`", "`" }, + find = function() + return M.get_selection({ motion = "a`" }) + end, + delete = "^(.)().-(.)()$", + }, + ["i"] = { + add = function() + local left_delimiter = M.get_input("Enter the left delimiter: ") + local right_delimiter = left_delimiter and M.get_input("Enter the right delimiter: ") + if right_delimiter then + return { { left_delimiter }, { right_delimiter } } + end + end, + find = function() end, + delete = function() end, + }, + } + ''; + settings = { + aliases = { + "a" = ">"; + "b" = ")"; + "B" = "}"; + "r" = "]"; + "q" = [ + "\"" + "'" + "`" + ]; + "Q" = "''"; + "s" = [ + "}" + "]" + ")" + ">" + "\"" + "'" + "`" + ]; + }; + keymaps = { + insert = "s"; + insert_line = "S"; + normal = "ys"; + normal_cur = "yss"; + normal_line = "yS"; + normal_cur_line = "ySS"; + visual = "S"; + visual_line = "gS"; + delete = "ds"; + # TODO: This keymap clashed with comment boxses + change = "cs"; + change_line = "cS"; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/telescope.nix b/home/programs/nixvim/plugins/telescope.nix new file mode 100644 index 0000000..1e51056 --- /dev/null +++ b/home/programs/nixvim/plugins/telescope.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ + ripgrep + fd + ]; + programs.nixvim.plugins = { + telescope = { + enable = true; + extensions = { + fzf-native.enable = true; + ui-select.enable = true; + undo.enable = true; + file-browser = { + enable = true; + settings = { + hijack_netrw = true; + }; + }; + }; + keymaps = { + "ff" = { + action = "find_files"; + options.desc = "List Files"; + }; + "fb" = { + action = "file_browser path=%:p:h select_buffer=true"; + options.desc = "File Browser"; + }; + "fs" = { + action = "buffers"; + options.desc = "List Open Buffers"; + }; + "fu" = { + action = "undo"; + options.desc = "Undo Tree"; + }; + }; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "f"; + group = "Telescope"; + icon = "󰭎 "; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/texpresso.nix b/home/programs/nixvim/plugins/texpresso.nix new file mode 100644 index 0000000..488ee2f --- /dev/null +++ b/home/programs/nixvim/plugins/texpresso.nix @@ -0,0 +1,30 @@ +{ ... }: + +# TODO: Make filetype keybindings work +{ + programs.nixvim = { + plugins = { + texpresso = { + enable = false; + }; + }; + files = { + "ftplugin/latex.lua" = { + keymaps = [ + { + action = "Texpresso %"; + key = "t"; + mode = [ + "n" + "v" + "i" + ]; + options = { + desc = "Start Texpresso"; + }; + } + ]; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/todo-comments.nix b/home/programs/nixvim/plugins/todo-comments.nix new file mode 100644 index 0000000..b489a0f --- /dev/null +++ b/home/programs/nixvim/plugins/todo-comments.nix @@ -0,0 +1,94 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + todo-comments = { + enable = true; + settings = { + highlight = { + comments_only = false; + }; + colors = { + default = [ + "Identifier" + "#7C3AED" + ]; + error = [ + "DiagnosticError" + "ErrorMsg" + "#DC2626" + ]; + hint = [ + "DiagnosticHint" + "#10B981" + ]; + info = [ + "DiagnosticInfo" + "#2563EB" + ]; + test = [ + "Identifier" + "#FF00FF" + ]; + warning = [ + "DiagnosticWarn" + "WarningMsg" + "#FBBF24" + ]; + }; + keywords = { + FIX = { + alt = [ + "FIXME" + "BUG" + "FIXIT" + "ISSUE" + ]; + color = "error"; + icon = " "; + }; + HACK = { + color = "warning"; + icon = " "; + }; + NOTE = { + alt = [ + "INFO" + ]; + color = "hint"; + icon = " "; + }; + PERF = { + alt = [ + "OPTIM" + "PERFORMANCE" + "OPTIMIZE" + ]; + icon = " "; + }; + TEST = { + alt = [ + "TESTING" + "PASSED" + "FAILED" + ]; + color = "test"; + icon = "⏲ "; + }; + TODO = { + color = "info"; + icon = " "; + }; + WARN = { + alt = [ + "WARNING" + "XXX" + ]; + color = "warning"; + icon = " "; + }; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/toggleterm.nix b/home/programs/nixvim/plugins/toggleterm.nix new file mode 100644 index 0000000..e8c606c --- /dev/null +++ b/home/programs/nixvim/plugins/toggleterm.nix @@ -0,0 +1,43 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + toggleterm = { + enable = true; + settings = { + open_mapping.__raw = "[[]]"; + insert_mappings = true; + shade_terminals = false; + }; + }; + }; + + keymaps = [ + { + action = "ToggleTermSendCurrentLine"; + key = "sts"; + mode = "n"; + options = { + desc = "Send Current Line"; + }; + } + { + action = "ToggleTermSendVisualLines"; + key = "stv"; + mode = "x"; + options = { + desc = "Send all the (whole) lines in selection"; + }; + } + { + action = "ToggleTermSendVisualSelection"; + key = "sts"; + mode = "x"; + options = { + desc = "Send selection"; + }; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/treesitter.nix b/home/programs/nixvim/plugins/treesitter.nix new file mode 100644 index 0000000..2292946 --- /dev/null +++ b/home/programs/nixvim/plugins/treesitter.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + treesitter = { + enable = true; + folding.enable = false; + settings = { + auto_install = false; + highlight.enable = true; + }; + }; + + ts-context-commentstring = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/trouble.nix b/home/programs/nixvim/plugins/trouble.nix new file mode 100644 index 0000000..aef0736 --- /dev/null +++ b/home/programs/nixvim/plugins/trouble.nix @@ -0,0 +1,170 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + trouble = { + enable = true; + settings = { + modes = { + diagnostics = { + auto_close = true; + auto_open = false; + }; + # Diagnostics for the current buffer only + diagnostics_buffer = { + mode = "diagnostics"; + filter = { + buf = 0; + }; + }; + }; + focus = false; + open_no_results = true; + # Plugin Default + keys = { + "<2-leftmouse>" = "jump"; + "" = "jump_split"; + "" = "jump_vsplit"; + "" = "jump"; + "" = "cancel"; + "?" = "help"; + P = "toggle_preview"; + R = "toggle_refresh"; + "[[" = "prev"; + "]]" = "next"; + d = { + action = "delete"; + mode = "v"; + }; + dd = "delete"; + gb = { + action = { + __raw = '' + function(view) + view:filter({ buf = 0 }, { toggle = true }) + end + ''; + }; + desc = "Toggle Current Buffer Filter"; + }; + i = "inspect"; + o = "jump_close"; + p = "preview"; + q = "close"; + r = "refresh"; + s = { + action = { + __raw = '' + function(view) + local f = view:get_filter("severity") + local severity = ((f and f.filter.severity or 0) + 1) % 5 + view:filter({ severity = severity }, { + id = "severity", + template = "{hl:Title}Filter:{hl} {severity}", + del = severity == 0, + }) + end + ''; + }; + desc = "Toggle Severity Filter"; + }; + zA = "fold_toggle_recursive"; + zC = "fold_close_recursive"; + zM = "fold_close_all"; + zN = "fold_enable"; + zO = "fold_open_recursive"; + zR = "fold_open_all"; + zX = "fold_update_all"; + za = "fold_toggle"; + zc = "fold_close"; + zi = "fold_toggle_enable"; + zm = "fold_more"; + zn = "fold_disable"; + zo = "fold_open"; + zr = "fold_reduce"; + zx = "fold_update"; + "{" = "prev"; + "}" = "next"; + }; + # Plugin Default + icons = { + folder_closed = " "; + folder_open = " "; + indent = { + fold_closed = " "; + fold_open = " "; + last = "└╴"; + middle = "├╴"; + top = "│ "; + ws = " "; + }; + kinds = { + Array = " "; + Boolean = "󰨙 "; + Class = " "; + Constant = "󰏿 "; + Constructor = " "; + Enum = " "; + EnumMember = " "; + Event = " "; + Field = " "; + File = " "; + Function = "󰊕 "; + Interface = " "; + Key = " "; + Method = "󰊕 "; + Module = " "; + Namespace = "󰦮 "; + Null = " "; + Number = "󰎠 "; + Object = " "; + Operator = " "; + Package = " "; + Property = " "; + String = " "; + Struct = "󰆼 "; + TypeParameter = " "; + Variable = "󰀫 "; + }; + }; + + }; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "x"; + group = "Trouble"; + icon = " "; + } + ]; + }; + keymaps = [ + { + key = "xx"; + action = "Trouble diagnostics toggle"; + options.desc = "Diagnostics"; + } + { + key = "xt"; + action = "Trouble todo toggle"; + options.desc = "Todos"; + } + { + key = "xX"; + action = "Trouble diagnostics toggle filter.buf=0"; + options.desc = "Buffer Diagnostics"; + } + { + key = "xL"; + action = "Trouble loclist toggle"; + options.desc = "Location List"; + } + { + key = "xQ"; + action = "Trouble qflist toggle"; + options.desc = "Quickfix List"; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/typst-preview.nix b/home/programs/nixvim/plugins/typst-preview.nix new file mode 100644 index 0000000..7122474 --- /dev/null +++ b/home/programs/nixvim/plugins/typst-preview.nix @@ -0,0 +1,38 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + typst-preview = { + enable = true; + lazyLoad = { + settings = { + ft = "typst"; + cmd = "TypstPreview"; + }; + }; + settings = { + open_command = "qutebrowser --target tab %s"; + }; + }; + }; + files = { + "ftplugin/typst.lua" = { + keymaps = [ + { + action = "TypstPreview"; + key = "t"; + mode = [ + "n" + "v" + "i" + ]; + options = { + desc = "Typst Preview"; + }; + } + ]; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/typst-vim.nix b/home/programs/nixvim/plugins/typst-vim.nix new file mode 100644 index 0000000..8de7abd --- /dev/null +++ b/home/programs/nixvim/plugins/typst-vim.nix @@ -0,0 +1,17 @@ +{ ... }: + +# TODO: coneal does not work +{ + programs.nixvim = { + plugins = { + typst-vim = { + enable = true; + settings = { + conceal = 1; + conceal_math = 1; + conceal_emoji = 1; + }; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/undotree.nix b/home/programs/nixvim/plugins/undotree.nix new file mode 100644 index 0000000..ea56afa --- /dev/null +++ b/home/programs/nixvim/plugins/undotree.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + undotree = { + enable = true; + }; + }; + }; +} diff --git a/home/programs/nixvim/plugins/vimtex.nix b/home/programs/nixvim/plugins/vimtex.nix new file mode 100644 index 0000000..d5b38fe --- /dev/null +++ b/home/programs/nixvim/plugins/vimtex.nix @@ -0,0 +1,40 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + vimtex = { + enable = true; + settings = { + view_automatic = false; + mappings_disable = { + "n" = [ "K" ]; + }; + }; + }; + }; + + autoGroups = { + "lazyvim_vimtex_conceal" = { + clear = true; + }; + }; + + autoCmd = [ + { + event = [ "FileType" ]; + group = "lazyvim_vimtex_conceal"; + pattern = [ + "bib" + "tex" + ]; + callback.__raw = # lua + '' + function () + vim.wo.conceallevel = 2 + end + ''; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/which-key.nix b/home/programs/nixvim/plugins/which-key.nix new file mode 100644 index 0000000..a2da0cf --- /dev/null +++ b/home/programs/nixvim/plugins/which-key.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim.plugins = { + which-key = { + enable = true; + }; + }; +} diff --git a/home/programs/nixvim/plugins/yanky.nix b/home/programs/nixvim/plugins/yanky.nix new file mode 100644 index 0000000..022ea31 --- /dev/null +++ b/home/programs/nixvim/plugins/yanky.nix @@ -0,0 +1,69 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + yanky = { + enable = true; + settings = { + ring = { + storage = "sqlite"; + }; + }; + }; + + sqlite-lua = { + enable = true; + }; + }; + + keymaps = [ + { + key = "p"; + action = "(YankyPutAfter)"; + mode = [ + "n" + "x" + ]; + } + { + key = "P"; + action = "(YankyPutBefore)"; + mode = [ + "n" + "x" + ]; + } + { + key = "gp"; + action = "(YankyGPutAfter)"; + mode = [ + "n" + "x" + ]; + } + { + key = "gP"; + action = "(YankyGPutBefore)"; + mode = [ + "n" + "x" + ]; + } + { + key = ""; + action = "(YankyPreviousEntry)"; + mode = [ + "n" + ]; + } + { + key = ""; + action = "(YankyNextEntry)"; + mode = [ + "n" + ]; + } + ]; + }; +} diff --git a/home/programs/nixvim/plugins/zk.nix b/home/programs/nixvim/plugins/zk.nix new file mode 100644 index 0000000..00665a2 --- /dev/null +++ b/home/programs/nixvim/plugins/zk.nix @@ -0,0 +1,95 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + zk = { + enable = true; + settings = { + picker = "telescope"; + }; + }; + which-key.settings.spec = [ + { + __unkeyed-1 = "z"; + group = "Zettelkasten"; + icon = "󰝰 "; + } + ]; + }; + keymaps = [ + { + key = "zn"; + action = "ZkNew { title = vim.fn.input('Title: ') }"; + mode = [ "n" ]; + options = { + desc = "Create"; + }; + } + { + key = "zo"; + action = "ZkNotes { sort = { 'modified' } }"; + mode = [ "n" ]; + options = { + desc = "Open"; + }; + } + { + key = "zt"; + action = "ZkTags"; + mode = [ "n" ]; + options = { + desc = "Open Tags"; + }; + } + { + key = "zf"; + action = "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }"; + mode = [ "n" ]; + options = { + desc = "Search"; + }; + } + { + key = "zf"; + action = ":'<,'>ZkMatch"; + mode = [ "v" ]; + options = { + desc = "Search (Matching the Selection)"; + }; + } + ]; + files = { + # TODO: Add descriptions + # TODO: Did the sytnax change? + "ftplugin/markdown.lua" = { + extraConfigLua = # lua + '' + -- Add the key mappings only for Markdown files in a zk notebook. + if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then + local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end + local opts = { noremap=true, silent=false } + + -- Create a new note after asking for its title. + -- This overrides the global `zn` mapping to create the note in the same directory as the current buffer. + map("n", "zn", "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) + -- Create a new note in the same directory as the current buffer, using the current selection for title. + map("v", "znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }", opts) + -- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title. + map("v", "znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) + + -- Open notes linking to the current buffer. + map("n", "zb", "ZkBacklinks", opts) + -- Open notes linked by the current buffer. + map("n", "zl", "ZkLinks", opts) + + -- Preview a linked note. + map("n", "K", "lua vim.lsp.buf.hover()", opts) + -- Open the code actions for a visual selection. + map("v", "za", ":'<,'>lua vim.lsp.buf.range_code_action()", opts) + end + ''; + }; + }; + }; +} diff --git a/home/programs/planify.nix b/home/programs/planify.nix deleted file mode 100644 index 5b3ab0c..0000000 --- a/home/programs/planify.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ planify ]; -} diff --git a/home/programs/taskwarrior/catppuccin.theme b/home/programs/taskwarrior/catppuccin.theme index b122fc1..27479c1 100644 --- a/home/programs/taskwarrior/catppuccin.theme +++ b/home/programs/taskwarrior/catppuccin.theme @@ -17,8 +17,8 @@ color.active=green color.recurring=blue color.scheduled=white on green color.until=yellow -color.blocked=black on white -color.blocking=black on bright white +color.blocked=green +color.blocking=yellow # Project color.project.none=red diff --git a/home/programs/taskwarrior/default.nix b/home/programs/taskwarrior/default.nix index 8afb8ea..b16f6ab 100644 --- a/home/programs/taskwarrior/default.nix +++ b/home/programs/taskwarrior/default.nix @@ -13,6 +13,41 @@ enable = true; colorTheme = ./catppuccin.theme; package = pkgs.taskwarrior3; + dataLocation = "~/Nextcloud/tasks"; + config = { + uda.parentName = { + type = "string"; + label = "Parent"; + }; + report.projall = { + description = "All tasks grouped by projet"; + columns = [ + "id" + "project.indented" + "depends" + "tags" + "due" + "description" + "urgency" + "start.age" + ]; + labels = [ + "ID" + "Project" + "Deps" + "Tag" + "Due" + "Description" + "Urgency" + "Age" + ]; + sort = [ + "parentName+\\/" + "project+" + ]; + filter = "status:pending"; + }; + }; }; home.file.".local/share/task/hooks/on-modify.timewarrior" = { @@ -20,6 +55,11 @@ source = "${pkgs.timewarrior}/share/doc/timew/ext/on-modify.timewarrior"; }; + home.file."Nextcloud/tasks/hooks/on-add.sh" = { + executable = true; + source = ./hooks/on-add.sh; + }; + # TODO: This need the python package timew-report, pyfzf and plumbum # home.file.".config/timewarrior/extensions/twfzf.py" = { # source = builtins.fetchurl { diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix index bcced2a..4ad0811 100644 --- a/home/programs/zsh.nix +++ b/home/programs/zsh.nix @@ -26,7 +26,9 @@ size = 100000000000; path = "${config.xdg.dataHome}/zsh/zsh_history"; }; - syntaxHighlighting = { enable = true; }; + syntaxHighlighting = { + enable = true; + }; initContent = '' export LD_LIBRARY_PATH="/nix/store/yjm4j9n85bcp42v5nkz2xifrp4a9s63k-sqlite-3.46.1/lib"o export CHROME_EXECUTABLE="/run/current-system/sw/bin/google-chrome-stable" @@ -36,6 +38,20 @@ RPROMPT='[%F{yellow}%?%f]' bindkey "^[[A" history-beginning-search-backward bindkey "^[[B" history-beginning-search-forward + + # trep: tree projall report - top-level projects with headers + trep() { + project() { + echo -e "\e[1;34m/----- Project $1 -----\e[0m" + task projall "project:$1" + echo "" + } + while IFS= read -r proj; do + project "$proj" + done < <(task _projects | grep -v '\.') + } + + alias trep='trep' ''; plugins = [ { diff --git a/home/services/default.nix b/home/services/default.nix index dd49fd1..cd66027 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -1,5 +1,10 @@ { ... }: { - imports = [ ./ssh-agent ./gpg-agent ./hypridle.nix ./nextcloud.nix ./nextcloud.nix ]; + imports = [ + ./ssh-agent + ./gpg-agent + ./hypridle.nix + ./nextcloud.nix + ]; }