From 5b0a6eb34b94fe54c0759974962acc22d9c96d7b Mon Sep 17 00:00:00 2001 From: Frede Braendstrup Date: Tue, 26 Aug 2025 17:27:55 +0200 Subject: [PATCH] plugins/perfanno: add perfanno-nvim plugin --- plugins/by-name/perfanno/default.nix | 41 ++++++++++++++++ .../plugins/by-name/perfanno/default.nix | 49 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 plugins/by-name/perfanno/default.nix create mode 100644 tests/test-sources/plugins/by-name/perfanno/default.nix diff --git a/plugins/by-name/perfanno/default.nix b/plugins/by-name/perfanno/default.nix new file mode 100644 index 00000000..ece2247c --- /dev/null +++ b/plugins/by-name/perfanno/default.nix @@ -0,0 +1,41 @@ +{ lib, ... }: + +lib.nixvim.plugins.mkNeovimPlugin { + name = "perfanno"; + packPathName = "perfanno.nvim"; + package = "perfanno-nvim"; + description = "NeoVim lua plugin that annotates source code with profiling information from perf, LuaJIT, or other profilers."; + + maintainers = [ lib.maintainers.fredeb ]; + + settingsExample = { + line_highlights = lib.nixvim.nestedLiteralLua "require('perfanno.util').make_bg_highlights(nil, '#CC3300', 10)"; + vt_highlight = lib.nixvim.nestedLiteralLua "require('perfanno.util').make_fg_highlight('#CC3300')"; + formats = [ + { + percent = true; + format = "%.2f%%"; + minimum = 0.5; + } + { + percent = false; + format = "%d"; + minimum = 1; + } + ]; + + annotate_after_load = true; + annotate_on_open = true; + telescope = { + enabled = lib.nixvim.nestedLiteralLua "pcall(require, 'telescope')"; + annotate = true; + }; + + ts_function_patterns = { + default = [ + "function" + "method" + ]; + }; + }; +} diff --git a/tests/test-sources/plugins/by-name/perfanno/default.nix b/tests/test-sources/plugins/by-name/perfanno/default.nix new file mode 100644 index 00000000..d4dba35b --- /dev/null +++ b/tests/test-sources/plugins/by-name/perfanno/default.nix @@ -0,0 +1,49 @@ +{ + empty = + { pkgs, ... }: + { + plugins.perfanno.enable = !pkgs.stdenv.isDarwin; + }; + + example = + { pkgs, ... }: + { + plugins.perfanno = { + enable = !pkgs.stdenv.isDarwin; + + settings = { + line_highlights.__raw = ''require("perfanno.util").make_bg_highlights(nil, "#CC3300", 10)''; + vt_highlight.__raw = ''require("perfanno.util").make_fg_highlight("#CC3300")''; + formats = [ + { + percent = true; + format = "%.2f%%"; + minimum = 0.5; + } + { + percent = false; + format = "%d"; + minimum = 1; + } + ]; + + annotate_after_load = true; + annotate_on_open = true; + telescope = { + enabled.__raw = ''pcall(require, "telescope")''; + annotate = true; + }; + + ts_function_patterns = { + default = [ + "function" + "method" + ]; + weirdlang = [ + "weirdfunc" + ]; + }; + }; + }; + }; +}