Skip to content

Commit b77b6aa

Browse files
committed
some config updates
1 parent afdb9f1 commit b77b6aa

File tree

3 files changed

+188
-148
lines changed

3 files changed

+188
-148
lines changed

docs/configuration.md

Lines changed: 142 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -6,122 +6,162 @@ ECA is highly configurable. This page lists all available options and provides c
66

77
```lua
88
require("eca").setup({
9-
-- === BASIC SETTINGS ===
9+
-- === SERVER ===
1010

11-
-- Enable debug mode (shows detailed logs)
12-
debug = false,
13-
14-
-- Path to ECA binary (empty = automatic download)
11+
-- Path to the ECA binary
12+
-- - Empty string: automatically download & manage the binary
13+
-- - Custom path: use your own binary
1514
server_path = "",
1615

17-
-- Extra arguments for ECA server
18-
server_args = "--log-level info",
16+
-- Extra arguments passed to the ECA server (eca start ...)
17+
server_args = "",
18+
19+
-- === LOGGING ===
20+
log = {
21+
-- Where to display logs inside Neovim
22+
-- "split" - use a split window
23+
-- "float" - use a floating window
24+
-- "none" - disable the log window
25+
display = "split",
1926

20-
-- Usage string format (tokens/cost)
21-
usage_string_format = "{messageCost} / {sessionCost}",
27+
-- Minimum log level to record
28+
-- vim.log.levels.TRACE | DEBUG | INFO | WARN | ERROR
29+
level = vim.log.levels.INFO,
30+
31+
-- Optional file path for persistent logs (empty = disabled)
32+
file = "",
33+
34+
-- Maximum log file size before ECA warns you (in MB)
35+
max_file_size_mb = 10,
36+
},
2237

2338
-- === BEHAVIOR ===
2439
behavior = {
25-
-- Set keymaps automatically
40+
-- Set default keymaps automatically
2641
auto_set_keymaps = true,
2742

28-
-- Focus sidebar automatically when opening
43+
-- Focus the ECA sidebar when opening it
2944
auto_focus_sidebar = true,
3045

31-
-- Start server automatically
46+
-- Automatically start the server on plugin setup
3247
auto_start_server = false,
3348

34-
-- Download server automatically if not found
49+
-- Automatically download the server if not found
3550
auto_download = true,
3651

37-
-- Show status updates in notifications
52+
-- Show status updates (startup, downloads, errors) as notifications
3853
show_status_updates = true,
3954
},
4055

41-
-- === KEY MAPPINGS ===
42-
mappings = {
43-
chat = "<leader>ec", -- Open chat
44-
focus = "<leader>ef", -- Focus sidebar
45-
toggle = "<leader>et", -- Toggle sidebar
56+
-- === CONTEXT ===
57+
context = {
58+
-- Automatically attach repo context (repoMap) when starting new chats
59+
auto_repo_map = true,
4660
},
4761

48-
-- === CHAT ===
49-
chat = {
50-
headers = {
51-
user = "> ",
52-
assistant = "",
53-
},
54-
welcome = {
55-
-- If non-empty, overrides server-provided welcome message
56-
message = "",
57-
-- Tips appended under the welcome (set {} to disable)
58-
tips = {
59-
"Type your message and use CTRL+s to send",
60-
},
61-
},
62-
tool_call = {
63-
icons = {
64-
success = "", -- Shown when a tool call succeeds
65-
error = "", -- Shown when a tool call fails
66-
running = "", -- Shown while a tool call is running / has no final status yet
67-
expanded = "", -- Arrow when the tool call details are expanded
68-
collapsed = "", -- Arrow when the tool call details are collapsed
69-
},
70-
diff_label = {
71-
collapsed = "+ view diff", -- Label when the diff is collapsed
72-
expanded = "- view diff", -- Label when the diff is expanded
73-
},
74-
},
75-
reasoning = {
76-
-- When true, "Thinking" blocks are expanded by default
77-
expanded = false,
78-
-- Customize the labels used for the reasoning block
79-
running_label = "Thinking...",
80-
finished_label = "Thought",
81-
},
62+
-- === TODOS PANEL ===
63+
todos = {
64+
enabled = true, -- Enable or disable todos integration
65+
max_height = 5, -- Maximum height for the todos container
66+
},
67+
68+
-- === SELECTED CODE PANEL ===
69+
selected_code = {
70+
enabled = true, -- Show currently selected code in the UI
71+
max_height = 8, -- Maximum height for the selected code container
72+
},
73+
74+
-- === KEY MAPPINGS ===
75+
mappings = {
76+
chat = "<leader>ec", -- Open chat
77+
focus = "<leader>ef", -- Focus sidebar
78+
toggle = "<leader>et",-- Toggle sidebar
8279
},
8380

84-
-- === WINDOW SETTINGS ===
81+
-- === WINDOWS & UI ===
8582
windows = {
86-
-- Automatic line wrapping
83+
-- Automatic line wrapping in ECA buffers
8784
wrap = true,
8885

89-
-- Width as percentage of screen (1-100)
86+
-- Width as percentage of Neovim columns (1–100)
9087
width = 40,
9188

9289
-- Sidebar header configuration
9390
sidebar_header = {
9491
enabled = true,
95-
align = "center", -- "left", "center", "right"
92+
align = "center", -- "left", "center", "right"
9693
rounded = true,
9794
},
9895

9996
-- Input area configuration
10097
input = {
101-
prefix = "> ", -- Input line prefix
102-
height = 8, -- Input window height
98+
prefix = "> ", -- Input line prefix
99+
height = 8, -- Input window height (lines)
100+
101+
-- Maximum length for web context names in the input area
102+
web_context_max_len = 20,
103103
},
104104

105105
-- Edit window configuration
106106
edit = {
107-
border = "rounded", -- "none", "single", "double", "rounded"
108-
start_insert = true, -- Start in insert mode
107+
border = "rounded", -- "none", "single", "double", "rounded"
108+
start_insert = true, -- Start in insert mode
109109
},
110110

111-
-- Ask window configuration
112-
ask = {
113-
floating = false, -- Use floating window
114-
start_insert = true, -- Start in insert mode
115-
border = "rounded",
116-
focus_on_apply = "ours", -- "ours" or "theirs"
111+
-- Usage line configuration (token / cost display)
112+
usage = {
113+
-- Supported placeholders:
114+
-- {session_tokens} - raw session token count (e.g. "30376")
115+
-- {limit_tokens} - raw token limit (e.g. "400000")
116+
-- {session_tokens_short} - shortened session tokens (e.g. "30k")
117+
-- {limit_tokens_short} - shortened token limit (e.g. "400k")
118+
-- {session_cost} - session cost (e.g. "0.09")
119+
-- Default: "30k / 400k ($0.09)" ->
120+
-- "{session_tokens_short} / {limit_tokens_short} (${session_cost})"
121+
format = "{session_tokens_short} / {limit_tokens_short} (${session_cost})",
117122
},
118-
},
119123

120-
-- === HIGHLIGHTS AND COLORS ===
121-
highlights = {
122-
diff = {
123-
current = "DiffText", -- Highlight for current diff
124-
incoming = "DiffAdd", -- Highlight for incoming diff
124+
-- Chat window & behavior
125+
chat = {
126+
-- Prefixes for each speaker
127+
headers = {
128+
user = "> ",
129+
assistant = "",
130+
},
131+
132+
-- Welcome message configuration
133+
welcome = {
134+
-- If non-empty, overrides the server-provided welcome message
135+
message = "",
136+
137+
-- Tips appended under the welcome (set {} to disable)
138+
tips = {
139+
"Type your message and use CTRL+s to send",
140+
},
141+
},
142+
143+
-- Tool call display settings
144+
tool_call = {
145+
icons = {
146+
success = "", -- Shown when a tool call succeeds
147+
error = "", -- Shown when a tool call fails
148+
running = "", -- Shown while a tool call is running
149+
expanded = "", -- Arrow when the tool call details are expanded
150+
collapsed = "", -- Arrow when the tool call details are collapsed
151+
},
152+
diff = {
153+
collapsed_label = "+ view diff", -- Label when the diff is collapsed
154+
expanded_label = "- view diff", -- Label when the diff is expanded
155+
expanded = false, -- When true, tool diffs start expanded
156+
},
157+
},
158+
159+
-- Reasoning ("Thinking") block behavior
160+
reasoning = {
161+
expanded = false, -- When true, "Thinking" blocks start expanded
162+
running_label = "Thinking...", -- Label while reasoning is running
163+
finished_label = "Thought", -- Base label when reasoning is finished
164+
},
125165
},
126166
},
127167
})
@@ -131,21 +171,27 @@ require("eca").setup({
131171

132172
## Presets
133173

174+
These examples show how to override just a subset of the configuration.
175+
134176
### Minimalist
135177
```lua
136178
require("eca").setup({
137-
behavior = { show_status_updates = false },
138-
windows = { width = 30 },
139-
chat = {
140-
headers = {
141-
user = "> ",
142-
assistant = "",
179+
behavior = {
180+
show_status_updates = false,
181+
},
182+
windows = {
183+
width = 30,
184+
chat = {
185+
headers = {
186+
user = "> ",
187+
assistant = "",
188+
},
143189
},
144190
},
145191
})
146192
```
147193

148-
### Visual/UX focused
194+
### Visual / UX focused
149195
```lua
150196
require("eca").setup({
151197
behavior = { auto_focus_sidebar = true },
@@ -154,11 +200,14 @@ require("eca").setup({
154200
wrap = true,
155201
sidebar_header = { enabled = true, rounded = true },
156202
input = { prefix = "💬 ", height = 10 },
157-
},
158-
chat = {
159-
headers = {
160-
user = "## 👤 You\n\n",
161-
assistant = "## 🤖 ECA\n\n",
203+
chat = {
204+
headers = {
205+
user = "## 👤 You\n\n",
206+
assistant = "## 🤖 ECA\n\n",
207+
},
208+
reasoning = {
209+
expanded = true,
210+
},
162211
},
163212
},
164213
})
@@ -167,35 +216,21 @@ require("eca").setup({
167216
### Development
168217
```lua
169218
require("eca").setup({
170-
debug = true,
171219
server_args = "--log-level debug",
172-
behavior = {
173-
auto_start_server = true,
174-
show_status_updates = true,
175-
},
176-
mappings = {
177-
chat = "<F12>",
178-
toggle = "<F11>",
179-
focus = "<F10>",
180-
},
181-
})
182-
```
183-
184-
### Performance-oriented
185-
```lua
186-
require("eca").setup({
187-
behavior = {
188-
auto_focus_sidebar = false,
189-
show_status_updates = false,
220+
log = {
221+
level = vim.log.levels.DEBUG,
222+
display = "split",
190223
},
191-
windows = { width = 25 },
192224
})
193225
```
194226

195227
---
196228

197229
## Notes
198230
- Set `server_path` if you prefer using a local ECA binary.
199-
- For noisy environments, disable `show_status_updates`.
231+
- Use the `log` block to control verbosity and where logs are written.
232+
- `context.auto_repo_map` controls whether repo context is attached automatically.
233+
- `todos` and `selected_code` can be disabled entirely if you prefer a simpler UI.
200234
- Adjust `windows.width` to fit your layout.
201-
- Keymaps can be set manually by turning off `auto_set_keymaps`.
235+
- Keymaps can be set manually by turning off `behavior.auto_set_keymaps` and defining your own mappings.
236+
- The `windows.usage.format` string controls how token and cost usage are displayed.

0 commit comments

Comments
 (0)