Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
53aeea9
wip
olimorris Dec 24, 2025
5bd26fa
Merge branch 'main' into feat/new-diff
olimorris Dec 24, 2025
84767dd
wip
olimorris Dec 24, 2025
f95d34c
wip
olimorris Dec 24, 2025
2d344f7
wup
olimorris Dec 24, 2025
4196e26
wip
olimorris Dec 25, 2025
603a4d5
wip
olimorris Dec 25, 2025
c1412bd
wip
olimorris Dec 26, 2025
4ec8f43
wip
olimorris Dec 27, 2025
93f0d2b
update tests
olimorris Dec 27, 2025
0fa8571
wip
olimorris Dec 27, 2025
dd1fd33
wip
olimorris Dec 27, 2025
72bdb6d
wip
olimorris Dec 27, 2025
1c4467e
wip
olimorris Dec 27, 2025
503c079
wip
olimorris Dec 28, 2025
3c8f43a
wip
olimorris Dec 28, 2025
2ba48a3
Merge branch 'main' into feat/new-diff
olimorris Dec 28, 2025
26880d1
wip
olimorris Dec 28, 2025
d42f228
update tests
olimorris Dec 28, 2025
0f8158d
navigate hunks with virtual text keymaps
olimorris Dec 29, 2025
f9d1405
wip
olimorris Dec 29, 2025
48755d2
show hunk navigation
olimorris Dec 29, 2025
0867ce5
wip
olimorris Dec 30, 2025
b55841b
fix tests
olimorris Dec 30, 2025
e2b40c5
refactor insert_edit_into_file tool
olimorris Dec 30, 2025
8ba519c
streamline tests
olimorris Dec 30, 2025
59c1cfd
refactor
olimorris Dec 30, 2025
f24f19f
refactor
olimorris Dec 31, 2025
768ee28
refactor
olimorris Dec 31, 2025
a9ec0eb
refactor
olimorris Dec 31, 2025
8e3c5eb
refactor - remove superdiff and edit tracker
olimorris Dec 31, 2025
630655b
refactor
olimorris Dec 31, 2025
60fbce9
refactor
olimorris Dec 31, 2025
aa21ae3
fix stats
olimorris Jan 1, 2026
a81d45f
chore
olimorris Jan 1, 2026
f5ffd14
refactor
olimorris Jan 1, 2026
e94920f
Merge branch 'main' into feat/new-diff
olimorris Jan 1, 2026
3616d21
refactor
olimorris Jan 2, 2026
e2b1106
fix tests
olimorris Jan 2, 2026
578d56a
Merge remote-tracking branch 'origin/main' into feat/new-diff
olimorris Jan 2, 2026
151c42b
wip
olimorris Jan 2, 2026
d4c61e2
wip
olimorris Jan 2, 2026
a5b8e7b
wip
olimorris Jan 3, 2026
5f79892
wip
olimorris Jan 5, 2026
0ace9d4
wip
olimorris Jan 6, 2026
fb7f5d1
update tests
olimorris Jan 6, 2026
6241226
Merge branch 'main' into feat/new-diff
olimorris Jan 7, 2026
7239e91
add tests
olimorris Jan 7, 2026
de64d6d
wip
olimorris Jan 7, 2026
3719310
Merge branch 'main' into feat/new-diff
olimorris Jan 8, 2026
e3c7aab
wip
olimorris Jan 8, 2026
f668692
wip
olimorris Jan 9, 2026
3932074
wip
olimorris Jan 9, 2026
269a570
wip
olimorris Jan 9, 2026
b6af0b6
wip
olimorris Jan 9, 2026
81500a2
wip
olimorris Jan 9, 2026
b414d75
Merge branch 'main' into feat/new-diff
olimorris Jan 10, 2026
711e639
Merge branch 'main' into feat/new-diff
olimorris Jan 11, 2026
eebf194
Merge branch 'main' into feat/new-diff
olimorris Jan 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions doc/usage/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ The events that are fired from within the plugin are:
- `CodeCompanionRequestStarted` - Fired at the start of any API request
- `CodeCompanionRequestStreaming` - Fired at the start of a streaming API request
- `CodeCompanionRequestFinished` - Fired at the end of any API request
- `CodeCompanionDiffAttached` - Fired when in Diff mode
- `CodeCompanionDiffDetached` - Fired when exiting Diff mode
- `CodeCompanionDiffAccepted` - Fired when a user accepts a change
- `CodeCompanionDiffRejected` - Fired when a user rejects a change
- `CodeCompanionDiffAccepted` - Fired when a user accepts a diff
- `CodeCompanionDiffRejected` - Fired when a user rejects a diff
- `CodeCompanionDiffHunkChanged` - Fired when a user moves between diff hunks

There are also events that can be utilized to trigger commands from within the plugin:

Expand Down
2 changes: 1 addition & 1 deletion lua/codecompanion/acp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Inspired by Zed's ACP implementation patterns.

This code is licensed under the MIT License.
This code is licensed under the Apache-2.0 License.
-------------------------------------------------------------------------------
Attribution:
If you use or distribute this code, please credit:
Expand Down
16 changes: 7 additions & 9 deletions lua/codecompanion/adapters/http/copilot/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ function M.show()
if is_limited then
table.insert(lines, "## Limited Copilot ")
elseif premium then
table.insert(lines, "## Premium Interactions ")
table.insert(lines, "## Premium Interactions")
table.insert(lines, "")
local used, usage_percent = calculate_usage(premium.entitlement, premium.remaining)
table.insert(lines, fmt("- Used: %d / %d ", used, premium.entitlement))
local bar = make_progress_bar(usage_percent, PROGRESS_BAR_WIDTH)
Expand Down Expand Up @@ -168,17 +169,14 @@ function M.show()

-- Create floating window
local float_opts = {
title = "  Copilot Stats ",
ft = "markdown",
ignore_keymaps = false,
lock = true,
relative = "editor",
row = "center",
col = "center",
window = {
width = 43,
height = math.min(#lines + 2, 20),
},
ignore_keymaps = false,
style = "minimal",
title = "  Copilot Stats ",
width = 43,
height = math.min(#lines + 2, 20),
}
local _, winnr = ui_utils.create_float(lines, float_opts)

Expand Down
118 changes: 27 additions & 91 deletions lua/codecompanion/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,6 @@ If you are providing code changes, use the insert_edit_into_file tool (if availa
callback = "keymaps.copilot_stats",
description = "[Adapter] Copilot statistics",
},
super_diff = {
modes = { n = "gD" },
index = 23,
callback = "keymaps.super_diff",
description = "[Tools] Show Super Diff",
},
-- Keymaps for ACP permission requests
_acp_allow_always = {
modes = { n = "g1" },
Expand Down Expand Up @@ -701,23 +695,33 @@ The user is working on a %s machine. Please respond with system specific command
callback = "keymaps.always_accept",
description = "Always accept changes in this buffer",
index = 1,
modes = { n = "gdy" },
modes = { n = "g1" },
opts = { nowait = true },
},
accept_change = {
callback = "keymaps.accept_change",
description = "Accept change",
index = 2,
modes = { n = "gda" },
modes = { n = "g2" },
opts = { nowait = true, noremap = true },
},
reject_change = {
callback = "keymaps.reject_change",
description = "Reject change",
index = 3,
modes = { n = "gdr" },
modes = { n = "g3" },
opts = { nowait = true, noremap = true },
},
next_hunk = {
callback = "keymaps.next_hunk",
description = "Go to next hunk",
modes = { n = "}" },
},
previous_hunk = {
callback = "keymaps.previous_hunk",
description = "Go to previous hunk",
modes = { n = "{" },
},
stop = {
callback = "keymaps.stop",
description = "Stop request",
Expand Down Expand Up @@ -870,13 +874,13 @@ The user is working on a %s machine. Please respond with system specific command
action_palette = {
width = 95,
height = 10,
prompt = "Prompt ", -- Prompt used for interactive LLM calls
prompt = "Prompt ", -- Title used for interactive LLM calls
provider = providers.action_palette, -- telescope|mini_pick|snacks|default
opts = {
show_preset_actions = true, -- Show the preset actions in the action palette?
show_preset_prompts = true, -- Show the preset prompts in the action palette?
show_preset_rules = true, -- Show the preset rules in the action palette?
title = "CodeCompanion actions", -- The title of the action palette
show_preset_actions = true,
show_preset_prompts = true,
show_preset_rules = true,
title = "CodeCompanion actions",
},
},
chat = {
Expand Down Expand Up @@ -913,35 +917,18 @@ The user is working on a %s machine. Please respond with system specific command
},
},

-- Options for any windows that open within the chat buffer
-- Options for an floating windows
floating_window = {
---@return number|fun(): number
width = function()
return vim.o.columns - 5
end,
---@return number|fun(): number
height = function()
return vim.o.lines - 2
end,
row = "center",
col = "center",
width = 0.9, ---@return number|fun(): number
height = 0.8, ---@return number|fun(): number
border = "single",
relative = "editor",
opts = {},
},

-- Options for diff windows that open within the chat buffer
-- Options for any diff windows (extends from floating_window)
diff_window = {
---@return number|fun(): number
width = function()
return math.min(120, vim.o.columns - 10)
end,
---@return number|fun(): number
height = function()
return vim.o.lines - 4
end,
opts = {
number = true,
},
opts = {},
},

-- Chat buffer options --------------------------------------------------
Expand All @@ -965,65 +952,14 @@ The user is working on a %s machine. Please respond with system specific command
---The function to display the token count
---@param tokens number
---@param adapter CodeCompanion.HTTPAdapter|CodeCompanion.ACPAdapter
---@return string
token_count = function(tokens, adapter) -- The function to display the token count
return " (" .. tokens .. " tokens)"
end,
},
diff = {
enabled = true,
provider = providers.diff, -- mini_diff|split|inline

provider_opts = {
-- Options for inline diff provider
inline = {
layout = "float", -- float|buffer - Where to display the diff

diff_signs = {
signs = {
text = "▌", -- Sign text for normal changes
reject = "✗", -- Sign text for rejected changes in super_diff
highlight_groups = {
addition = "DiagnosticOk",
deletion = "DiagnosticError",
modification = "DiagnosticWarn",
},
},
-- Super Diff options
icons = {
accepted = " ",
rejected = " ",
},
colors = {
accepted = "DiagnosticOk",
rejected = "DiagnosticError",
},
},

opts = {
context_lines = 3, -- Number of context lines in hunks
show_dim = true, -- Enable dimming background for floating windows (applies to both diff and super_diff)
dim = 25, -- Background dim level for floating diff (0-100, [100 full transparent], only applies when layout = "float")
full_width_removed = true, -- Make removed lines span full width
show_keymap_hints = true, -- Show "gda: accept | gdr: reject" hints above diff
show_removed = true, -- Show removed lines as virtual text
},
},

-- Options for the split provider
split = {
close_chat_at = 240, -- Close an open chat buffer if the total columns of your display are less than...
layout = "vertical", -- vertical|horizontal split
opts = {
"internal",
"filler",
"closeoff",
"algorithm:histogram", -- https://adamj.eu/tech/2024/01/18/git-improve-diff-histogram/
"indent-heuristic", -- https://blog.k-nut.eu/better-git-diffs
"followwrap",
"linematch:120",
},
},
},
word_highlights = true,
},
inline = {
-- If the inline prompt creates a new buffer, how should we display this?
Expand Down Expand Up @@ -1079,7 +1015,7 @@ M.setup = function(args)
)
end

-- TODO: Remove in v19.0.0
-- TODO: Remove in v20.0.0
if args.strategies then
args.interactions = vim.tbl_deep_extend("force", vim.deepcopy(defaults.interactions), args.strategies)
args.strategies = nil
Expand Down
Loading