irongit

A readme explaining how to make neovim work fast

improved ai docstring command

huncholanehuncholaneauthored
parent 84188bbcommit abad0130833c52e5a31c29b8cd18bb1878557caaBrowse files

3 files changed, +30 -1

+1-1lazy-lock.json
@@ -17,6 +17,7 @@
1717 "friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
1818 "gitsigns.nvim": { "branch": "main", "commit": "ee7e50dfbdf49e3acfa416fd3ad3abbdb658582c" },
1919 "grug-far.nvim": { "branch": "main", "commit": "631331f9c6611b1a47e887f50b92b7cf450f51e7" },
20+ "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
2021 "hydra.nvim": { "branch": "main", "commit": "f3d4822060376cb253d4cc0d5af2c272c28de2a7" },
2122 "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
2223 "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
@@ -50,7 +51,6 @@
5051 "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
5152 "ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
5253 "venv-selector.nvim": { "branch": "regexp", "commit": "c677caa1030808a9f90092e522de7cc20c1390dd" },
53- "vim-anyfold": { "branch": "master", "commit": "3ed5d8ccbf0f5031f7c7d2be05aa7ddb4550dc5c" },
5454 "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
5555 "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }
5656 }
+1-0lazyvim.json
@@ -4,6 +4,7 @@
44 "lazyvim.plugins.extras.ai.copilot-chat",
55 "lazyvim.plugins.extras.coding.luasnip",
66 "lazyvim.plugins.extras.coding.yanky",
7+ "lazyvim.plugins.extras.editor.harpoon2",
78 "lazyvim.plugins.extras.editor.neo-tree",
89 "lazyvim.plugins.extras.editor.telescope",
910 "lazyvim.plugins.extras.lang.git",
+28-0lua/plugins/copilot.lua
@@ -23,6 +23,7 @@ return {
2323 },
2424 },
2525 },
26+
2627 -- chat config
2728 {
2829 "CopilotC-Nvim/CopilotChat.nvim",
@@ -32,6 +33,13 @@ return {
3233 local user = vim.env.USER or "User"
3334 user = user:sub(1, 1):upper() .. user:sub(2)
3435 return {
36+ prompts = {
37+ Docs = {
38+ prompt = "Add docstrings that clearly explain parameters and returns with the correct format.",
39+ system = "You write good docs.",
40+ description = "Add structured, language-aware documentation",
41+ },
42+ },
3543 auto_insert_mode = true,
3644 question_header = " " .. user .. " ",
3745 answer_header = " Copilot ",
@@ -44,6 +52,18 @@ return {
4452 keys = {
4553 { "<c-s>", "<CR>", ft = "copilot-chat", desc = "Submit Prompt", remap = true },
4654 { "<leader>a", "", desc = "+ai", mode = { "n", "v" } },
55+ {
56+ "<leader>ad",
57+ function()
58+ local cpc = require("CopilotChat")
59+ vim.cmd("normal vaf")
60+ cpc.ask(
61+ "Add docstrings that clearly explain parameters and returns with the correct indentations using tabs and newlines."
62+ )
63+ end,
64+ desc = "Add docs to function",
65+ mode = "n",
66+ },
4767 {
4868 "<leader>aa",
4969 function()
@@ -82,6 +102,14 @@ return {
82102 desc = "Prompt Actions (CopilotChat)",
83103 mode = { "n", "v" },
84104 },
105+ {
106+ "<C-a>",
107+ "<Esc><C-y>q",
108+ ft = "copilot-chat",
109+ desc = "Submit and close",
110+ mode = { "n", "i" },
111+ remap = true,
112+ },
85113 },
86114 config = function(_, opts)
87115 vim.env.OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")