From 28ac81cee5f96ea561fe4743832159eac6585c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 29 Sep 2023 20:07:30 +0200 Subject: [PATCH] feat(nvim): add nvim-devdocs --- flake.lock | 17 ++++++++++++ flake.nix | 3 +++ modules/programs/nvim/plugins/coding.nix | 34 ++++++++++++++++++++++++ overlays/vimPlugins.nix | 6 +++++ 4 files changed, 60 insertions(+) diff --git a/flake.lock b/flake.lock index a3e2659..e89a7cd 100644 --- a/flake.lock +++ b/flake.lock @@ -863,6 +863,22 @@ "type": "github" } }, + "nvim-devdocs": { + "flake": false, + "locked": { + "lastModified": 1695706852, + "narHash": "sha256-Hwq3iGS8mY4WISyrBoRZIzWW5aozQEy9yeYcBxKYEy4=", + "owner": "luckasRanarison", + "repo": "nvim-devdocs", + "rev": "8e0cb37b2bd35f6025074b3d4c6f62d77b21836c", + "type": "github" + }, + "original": { + "owner": "luckasRanarison", + "repo": "nvim-devdocs", + "type": "github" + } + }, "nvim-treesitter": { "flake": false, "locked": { @@ -939,6 +955,7 @@ "nix-lazy-nvim": "nix-lazy-nvim", "nix-super": "nix-super", "nixpkgs": "nixpkgs_7", + "nvim-devdocs": "nvim-devdocs", "nvim-treesitter": "nvim-treesitter", "pre-commit-hooks": "pre-commit-hooks", "rofi-wayland": "rofi-wayland", diff --git a/flake.nix b/flake.nix index fb57451..00fc2bb 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,9 @@ actions-preview-nvim.flake = false; actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim"; + nvim-devdocs.flake = false; + nvim-devdocs.url = "github:luckasRanarison/nvim-devdocs"; + nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim"; # Hyprland diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index ae3d393..3bff4bc 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -313,5 +313,39 @@ with builtins; ]; opts = { }; } + { + plugin = nvim-devdocs; + dependencies = [ + { plugin = plenary-nvim; } + { plugin = telescope-nvim; } + { plugin = nvim-treesitter; } + ]; + opts = { + previewer_cmd = lib.getExe pkgs.glow; + picker_cmd = lib.getExe pkgs.glow; + picker_cmd_args = [ "-p" ]; + telescope = { + layout_strategy = "vertical"; + layout_config = { + prompt_position = "top"; + }; + }; + }; + cmd = [ + "DevdocsFetch" + "DevdocsInstall" + "DevdocsUninstall" + "DevdocsOpen" + "DevdocsOpenFloat" + "DevdocsOpenCurrent" + "DevdocsOpenCurrentFloat" + "DevdocsUpdate" + "DevdocsUpdateAll" + ]; + keys = [ + { key = "fd"; cmd = "DevdocsOpenCurrentFloat"; desc = "Search documentation"; } + { key = "fD"; cmd = "DevdocsOpenFloat"; desc = "Search documentation (all installed)"; } + ]; + } ]; } diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 7cafdf5..b1a1f41 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -37,5 +37,11 @@ with lib.my; version = mkVersionInput inputs.nvim-treesitter; src = inputs.nvim-treesitter; }); + + nvim-devdocs = prev.vimUtils.buildVimPluginFrom2Nix { + pname = "nvim-devdocs"; + version = mkVersionInput inputs.nvim-devdocs; + src = inputs.nvim-devdocs; + }; }; }