Skip to content

Commit

Permalink
ci: add profile.nvim to nvim-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jghauser committed Jun 16, 2024
1 parent fcead3d commit 2c29d12
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion nix/ci-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
}: final: prev: let
mkNvimMinimal = nvim:
with final; let
profile-nvim = pkgs.vimUtils.buildVimPlugin {
name = "profile.nvim";
src = pkgs.fetchFromGitHub {
owner = "stevearc";
repo = "profile.nvim";
rev = "0ee32b7aba31d84b0ca76aaff2ffcb11f8f5449f";
hash = "sha256-usyy1kST8hq/3j0sp7Tpf/1mld6RtcVABPo/ygeqzbU=";
};
};

neovimConfig = neovimUtils.makeNeovimConfig {
withPython3 = true;
viAlias = true;
Expand All @@ -19,6 +29,7 @@
with ps; [
tree-sitter-yaml
]))
profile-nvim
];
};
runtimeDeps = [
Expand Down Expand Up @@ -49,7 +60,34 @@
-- be loaded from the current directory
vim.opt.runtimepath:prepend(vim.fn.getcwd())
-- setup dependencies
-- profile.nvim
local should_profile = os.getenv("NVIM_PROFILE")
if should_profile then
require("profile").instrument_autocmds()
if should_profile:lower():match("^start") then
require("profile").start("*papis")
else
require("profile").instrument("*")
end
end
local function toggle_profile()
local prof = require("profile")
if prof.is_recording() then
prof.stop()
vim.ui.input({ prompt = "Save profile to:", completion = "file", default = "profile.json" }, function(filename)
if filename then
prof.export(filename)
vim.notify(string.format("Wrote %s", filename))
end
end)
else
vim.notify("Starting profiling")
prof.start("*papis")
end
end
vim.keymap.set("", "<f1>", toggle_profile)
-- cmp
local cmp = require("cmp")
cmp.setup({
mapping = cmp.mapping.preset.insert({
Expand All @@ -63,6 +101,8 @@
{ name = "papis" },
}),
})
-- telescope
local telescope = require("telescope")
telescope.setup({
defaults = {
Expand Down

0 comments on commit 2c29d12

Please sign in to comment.