Skip to content

Commit 759fa0b

Browse files
committed
add documentation
1 parent e9d9067 commit 759fa0b

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<img src="https://raw.githubusercontent.com/sst/opencode/dev/packages/web/src/assets/logo-ornate-dark.svg" alt="Opencode logo" width="30%" />
1111
</div>
1212

13-
### Quick buffer chat (<leader>o/) EXPERIMENTAL:
13+
### Quick buffer chat (<leader>o/) EXPERIMENTAL
1414

1515
This is an experimental feature that allows you to chat with the AI using the current buffer context. In visual mode, it captures the selected text as context, while in normal mode, it uses the current line. The AI will respond with quick edits to the files that are applied by the plugin.
1616

@@ -219,6 +219,9 @@ require('opencode').setup({
219219
wrap = false, -- Wraps text inside input window
220220
},
221221
},
222+
picker = {
223+
snacks_layout = nil -- `layout` opts to pass to Snacks.picker.pick({ layout = ... })
224+
},
222225
completion = {
223226
file_sources = {
224227
enabled = true,
@@ -371,6 +374,61 @@ Available icon keys (see implementation at lua/opencode/ui/icons.lua lines 7-29)
371374
- status_on, status_off
372375
- border, bullet
373376

377+
### Picker Layout
378+
379+
You can customize the layout of the picker used for history, session, references, and timeline
380+
381+
#### Snacks Picker Layout
382+
383+
There's 3 main ways on how to change the snacks picker layout
384+
385+
1. Don't specify the new options -> it'll just default to the user's snack picker layout preset from their snacks config
386+
2. Specify the new options for opencode, e.g.
387+
388+
```lua
389+
require("opencode").setup({
390+
ui = {
391+
picker = {
392+
---@module "snacks"
393+
---@type snacks.picker.layout.Config | nil
394+
snacks_layout = {
395+
layout = { border = "none", box = "vertical", ... }
396+
},
397+
},
398+
},
399+
})
400+
```
401+
402+
3. Specify a [builtin layout preset](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#%EF%B8%8F-layouts) for snacks picker OR a custom layout defined in your snacks config's `opts.picker.layouts`
403+
404+
```lua
405+
-- opencode.lua
406+
require("opencode").setup({
407+
ui = {
408+
picker = {
409+
---@module "snacks"
410+
---@type snacks.picker.layout.Config | nil
411+
snacks_layout = {
412+
preset = "custom_layout" -- or builtin snacks, like "select", "default", etc
413+
},
414+
},
415+
},
416+
})
417+
```
418+
419+
```lua
420+
-- snacks.lua
421+
{
422+
"folke/snacks.nvim",
423+
opts = {
424+
picker = {
425+
layouts = {
426+
custom_layout = {
427+
layout = { border = "none", box = "vertical", ... }
428+
-- ...
429+
}
430+
```
431+
374432
## 🧰 Usage
375433

376434
### Available Actions
@@ -458,7 +516,7 @@ Run a prompt in a new session using the Plan agent and disabling current file co
458516
:Opencode run "Fix the bug in the current file" model=github-copilot/claude-sonned-4
459517
```
460518

461-
##👮 Permissions
519+
## 👮 Permissions
462520

463521
Opencode can issue permission requests for potentially destructive operations (file edits, reverting files, running shell commands, or enabling persistent tool access). Permission requests appear inline in the output and must be responded to before the agent performs the action. Visit [Opencode Permissions Documentation](https://opencode.ai/docs/permissions/) for more details.
464522

lua/opencode/config.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ M.defaults = {
135135
wrap = false,
136136
},
137137
},
138+
picker = {
139+
snacks_layout = nil,
140+
},
138141
completion = {
139142
file_sources = {
140143
enabled = true,

0 commit comments

Comments
 (0)