From b6e01b91007de22ac804d29df724263b62fd0478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Lepage?= <33058747+GaetanLepage@users.noreply.github.com> Date: Tue, 14 Feb 2023 20:50:47 +0100 Subject: [PATCH] plugins: Add tagbar (#156) * plugins: Add tagbar * tagbar: fix typo --------- Co-authored-by: Pedro Alves --- plugins/default.nix | 1 + plugins/languages/tagbar.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 plugins/languages/tagbar.nix diff --git a/plugins/default.nix b/plugins/default.nix index 25e901b6..4b5650f0 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -27,6 +27,7 @@ ./languages/nix.nix ./languages/plantuml-syntax.nix ./languages/rust.nix + ./languages/tagbar.nix ./languages/treesitter.nix ./languages/treesitter-context.nix ./languages/treesitter-refactor.nix diff --git a/plugins/languages/tagbar.nix b/plugins/languages/tagbar.nix new file mode 100644 index 00000000..0b3f48e0 --- /dev/null +++ b/plugins/languages/tagbar.nix @@ -0,0 +1,35 @@ +{ pkgs +, lib +, config +, ... +}: +let + cfg = config.plugins.tagbar; + helpers = import ../helpers.nix { inherit lib; }; +in +with lib; +{ + options.plugins.tagbar = { + + enable = mkEnableOption "tagbar"; + + package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar; + + extraConfig = helpers.mkNullOrOption types.attrs '' + The configuration options for tagbar without the 'tagbar_' prefix. + Example: To set 'tagbar_show_tag_count' to 1, write + extraConfig = { + show_tag_count= true; + }; + ''; + }; + + config = mkIf cfg.enable { + + extraPlugins = [ cfg.package ]; + + extraPackages = [ pkgs.ctags ]; + + globals = mapAttrs' (name: value: nameValuePair ("tagbar_" + name) value) cfg.extraConfig; + }; +}