-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
226 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
modules/common/nvim/lua/chrishrb/plugins/config/codecompanion-lualine.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local M = require("lualine.component"):extend() | ||
|
||
M.processing = false | ||
M.spinner_index = 1 | ||
|
||
local spinner_symbols = { | ||
"⠋", | ||
"⠙", | ||
"⠹", | ||
"⠸", | ||
"⠼", | ||
"⠴", | ||
"⠦", | ||
"⠧", | ||
"⠇", | ||
"⠏", | ||
} | ||
local spinner_symbols_len = 10 | ||
|
||
-- Initializer | ||
function M:init(options) | ||
M.super.init(self, options) | ||
|
||
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {}) | ||
|
||
vim.api.nvim_create_autocmd({ "User" }, { | ||
pattern = "CodeCompanionRequest*", | ||
group = group, | ||
callback = function(request) | ||
if request.match == "CodeCompanionRequestStarted" then | ||
self.processing = true | ||
elseif request.match == "CodeCompanionRequestFinished" then | ||
self.processing = false | ||
end | ||
end, | ||
}) | ||
end | ||
|
||
-- Function that runs every time statusline is updated | ||
function M:update_status() | ||
if self.processing then | ||
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1 | ||
return spinner_symbols[self.spinner_index] | ||
else | ||
return nil | ||
end | ||
end | ||
|
||
return M |
48 changes: 48 additions & 0 deletions
48
modules/common/nvim/lua/chrishrb/plugins/config/codecompanion.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require("dressing").setup({ | ||
input = { | ||
enabled = false | ||
}, | ||
select = { | ||
enabled = true | ||
} | ||
}) | ||
|
||
require("codecompanion").setup({ | ||
display = { | ||
action_palette = { | ||
prompt = "🤖 ~ " | ||
} | ||
}, | ||
strategies = { | ||
chat = { | ||
adapter = "copilot", | ||
}, | ||
inline = { | ||
adapter = "copilot", | ||
}, | ||
agent = { | ||
adapter = "copilot", | ||
}, | ||
}, | ||
}) | ||
|
||
-- setup which-key mappings | ||
local which_key = require("which-key") | ||
which_key.add({ | ||
{ | ||
{ "<leader>c", group = "CodeCompanion (AI)", nowait = true, remap = false }, | ||
{ "<leader>cc", "<cmd>CodeCompanion<CR>", desc = "Quick chat", nowait = true, remap = false }, | ||
{ "<leader>ca", "<cmd>CodeCompanionActions<CR>", desc = "Actions", nowait = true, remap = false }, | ||
{ "<leader>co", "<cmd>CodeCompanionChat<CR>", desc = "New Chat", nowait = true, remap = false }, | ||
{ "<leader>ct", "<cmd>CodeCompanionToggle<CR>", desc = "Toggle chat", nowait = true, remap = false }, | ||
{ | ||
mode = { "v" }, | ||
{ "<leader>c", group = "CodeCompanion (AI)", nowait = true, remap = false }, | ||
{ "<leader>cc", ":CodeCompanion<CR>", desc = "Quick chat", nowait = true, remap = false }, | ||
{ "<leader>ca", ":CodeCompanionActions<CR>", desc = "Actions", nowait = true, remap = false }, | ||
}, | ||
} | ||
}) | ||
|
||
-- Expand 'cc' into 'CodeCompanion' in the command line | ||
vim.cmd([[cab cc CodeCompanion]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.