Compare commits

..

2 Commits

Author SHA1 Message Date
Sam ac5833c8af revert neovim to stable 2024-11-04 15:54:26 +00:00
Sam b9c0b70fc8 rm parrot.nvim 2024-11-04 15:53:53 +00:00
3 changed files with 3 additions and 91 deletions

View File

@ -29,7 +29,7 @@
];
programs.nixvim = {
enable = true;
package = pkgs.unstable.neovim-unwrapped;
package = pkgs.neovim-unwrapped;
enableMan = true; # install man pages for nixvim options
clipboard.register = "unnamedplus"; # use system clipboard instead of internal registers
globals.mapleader = " ";

View File

@ -1,18 +1,7 @@
{
pkgs,
config,
lib,
inputs,
...
}: let
user = config.home.username;
mistralAPIKey = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."mistral-api-key".path;
in {
sops.secrets = {
"mistral-api-key" = {
};
};
}: {
imports = [
./cmp.nix
./colorizer.nix
@ -52,17 +41,6 @@ in {
};
})
(pkgs.vimUtils.buildVimPlugin
{
name = "parrot.nvim";
src = pkgs.fetchFromGitHub {
owner = "frankroeder";
repo = "parrot.nvim";
rev = "c992483";
sha256 = "sha256-P899qNY/h5LTW0pp3sAmcSDsDGWQedXa20J7EggL7F8=";
};
})
(pkgs.vimUtils.buildVimPlugin
{
name = "buffer_manager.nvim";
@ -176,71 +154,5 @@ in {
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
-- parrot.nvim setup
require("parrot").setup {
toggle_target = "popup",
providers = {
mistral = {
api_key = read_api_key("${mistralAPIKey}"),
params = {
chat = { temperature = 0, top_p = 1, max_tokens = 16384 },
command = { temperature = 0, top_p = 1, max_tokens = 16384 },
},
-- api_key = os.getenv "MISTRAL_API_KEY",
},
},
hooks = {
AskCoder = function(prt, params)
local prompt = [[
You are a code assistent. Answer my question carefully and concisely.
Answer with code snippets only. Do not give a summary or include any
code comments in your response. Never repeate code from a prevous
response or write obvious or unnecessary code, instead refer to such
code like: "**rest of code here**", or something to that effect.
Tokens are expensive, to we need to be very consice. If you uses
excessive tokens, then I will send you the invoice to pay the bill.
Question: {{command}}
```
]]
prt.ChatNew(params, prompt)
end,
AskCoderSel = function(parrot, params)
local template = [[
You are an expert programmer. Here is a code snippet along with a
question. Give me a short, accurate and consice answer.
```{{filetype}}
{{selection}}
```
]]
local model_obj = parrot.get_model("command")
parrot.logger.info("Asking model: " .. model_obj.name)
parrot.Prompt(params, parrot.ui.Target.popup, model_obj, "🤖 Ask ~ ", template)
end,
GitCommit = function(parrot, params)
local template = [[
You are a git commit generator. You will be provided with a git diff file.
Your role is to create a concise commit message that outlines all of the
most relevant and impactful changes in the diff. You only output a commit
message, do not write anything else not related to the commit. Use
imperative mood for you writing style. Your message should include a
short summary in the first line followed by more detailed descriptions of
the changes on subsequent lines. The first line summary should be no more
than 70 characters, not end with a period, and a blank line should
separate the summary from the body of the message. There should only be 1
summary line, and 1 body with the description. The body should include no
more than 3 bullet points with more detailed descriptions of the files
and functions that have been modified. Do not output any code.
Diff: {{selection}}
]]
local model_obj = parrot.get_model("command")
parrot.logger.info("Asking model: " .. model_obj.name)
parrot.Prompt(params, parrot.ui.Target.popup, model_obj, nil, template)
end,
}
}
'';
}

View File

@ -19,7 +19,7 @@
pkgs.gnome.simple-scan
pkgs.pandoc
pkgs.texlive.combined.scheme-small
pkgs.libreoffice-qt
pkgs.libreoffice-fresh
pkgs.hunspell
pkgs.hunspellDicts.en-gb-large
pkgs.hunspellDicts.en-gb-large