File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed
lua/codecompanion/_extensions/history Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,11 @@ require("codecompanion").setup({
113
113
refresh_every_n_prompts = 0 , -- e.g., 3 to refresh after every 3rd user prompt
114
114
--- Maximum number of times to refresh the title (default: 3)
115
115
max_refreshes = 3 ,
116
+ format_title = function (original_title )
117
+ -- this can be a custom function that applies some custom
118
+ -- formatting to the title.
119
+ return original_title
120
+ end
116
121
},
117
122
--- On exiting and entering neovim, loads the last chat on opening chat
118
123
continue_last_chat = false ,
Original file line number Diff line number Diff line change 1
- *codecompanion-history.txt* For NVIM v0.8.0 Last change: 2025 June 24
1
+ *codecompanion-history.txt* For NVIM v0.8.0 Last change: 2025 July 05
2
2
3
3
==============================================================================
4
4
Table of Contents *codecompanion-history-table-of-contents*
@@ -159,6 +159,11 @@ ADD HISTORY EXTENSION TO CODECOMPANION CONFIG ~
159
159
refresh_every_n_prompts = 0, -- e.g., 3 to refresh after every 3rd user prompt
160
160
---Maximum number of times to refresh the title (default: 3)
161
161
max_refreshes = 3,
162
+ format_title = function(original_title)
163
+ -- this can be a custom function that applies some custom
164
+ -- formatting to the title.
165
+ return original_title
166
+ end
162
167
},
163
168
---On exiting and entering neovim, loads the last chat on opening chat
164
169
continue_last_chat = false,
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ local default_opts = {
55
55
refresh_every_n_prompts = 0 ,
56
56
--- Maximum number of times to refresh the title (default: 3)
57
57
max_refreshes = 3 ,
58
+ format_title = nil ,
58
59
},
59
60
--- On exiting and entering neovim, loads the last chat on opening chat
60
61
continue_last_chat = false ,
@@ -189,6 +190,9 @@ function History:_setup_autocommands()
189
190
local should_generate , is_refresh = self .title_generator :should_generate (chat )
190
191
if should_generate then
191
192
self .title_generator :generate (chat , function (generated_title )
193
+ if type (self .opts .title_generation_opts .format_title ) == " function" then
194
+ generated_title = self .opts .title_generation_opts .format_title (generated_title )
195
+ end
192
196
if generated_title and generated_title ~= " " then
193
197
-- Always update buffer title for feedback
194
198
self .ui :_set_buf_title (chat .bufnr , generated_title )
Original file line number Diff line number Diff line change 11
11
--- @field model ? string ? The model of the adapter to use for generation
12
12
--- @field refresh_every_n_prompts ? number Number of user prompts after which to refresh the title (0 to disable )
13
13
--- @field max_refreshes ? number Maximum number of times to refresh the title (default : 3)
14
+ --- @field format_title ? fun ( original_title : string ): string a function that applies a custom transformation to the title.
14
15
15
16
--- @class HistoryOpts
16
17
--- @field default_buf_title ? string A name for the chat buffer that tells that this is an auto saving chat
You can’t perform that action at this time.
0 commit comments