You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add intelligent model picker with favorites, recent usage (#182)
This pull request adds an intelligent model picker with favorites and recent usage tracking to enhance the model selection experience. Users can mark models as favorites using <C-f> in the picker, and the list automatically sorts to show favorites first, followed by recently used models, then alphabetically sorted remaining models.
Changes:
Using state persistence for model favorites and recent usage in ~/.local/state/opencode/model.json (same as opencode CLI)
Implemented model picker with visual indicators (star for favorites, clock for recent)
Added <C-f> keybinding to toggle favorite status in the model picker
Updated documentation with new feature details and configuration options
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.
16
-
17
-
Don't hesitate to give it a try and provide feedback!
18
-
19
-
Refer to the [Quick Chat](#-quick-chat) section for more details.
@@ -34,10 +18,28 @@ Refer to the [Quick Chat](#-quick-chat) section for more details.
34
18
35
19
This plugin provides a bridge between neovim and the [opencode](https://github.com/sst/opencode) AI agent, creating a chat interface while capturing editor context (current file, selections) to enhance your prompts. It maintains persistent sessions tied to your workspace, allowing for continuous conversations with the AI assistant similar to what tools like Cursor AI offer.
36
20
21
+
## Main Features
22
+
23
+
### Chat Panel
24
+
25
+
The chat panel is a dedicated window inside Neovim that lets you hold a persistent conversation with the opencode AI agent. It displays your previous messages and responses, and automatically uses your current workspace and editor state as context so you can iterate on code without leaving Neovim. You can type prompts, review answers, and navigate back to your code buffer while keeping the ongoing chat session open.
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.
34
+
35
+
Don't hesitate to give it a try and provide feedback!
36
+
37
+
Refer to the [Quick Chat](#-quick-chat) section for more details.
38
+
39
+
<divalign="center">
40
+
<imgsrc="https://i.imgur.com/5JNlFZn.png">
41
+
</div>
42
+
41
43
## 📑 Table of Contents
42
44
43
45
-[⚠️Caution](#caution)
@@ -189,7 +191,10 @@ require('opencode').setup({
189
191
history_picker= {
190
192
delete_entry= { '<C-d>', mode= { 'i', 'n' } }, -- Delete selected entry in the history picker
191
193
clear_all= { '<C-X>', mode= { 'i', 'n' } }, -- Clear all entries in the history picker
192
-
}
194
+
},
195
+
model_picker= {
196
+
toggle_favorite= { '<C-f>', mode= { 'i', 'n' } },
197
+
},
193
198
},
194
199
ui= {
195
200
position='right', -- 'right' (default), 'left' or 'current'. Position of the UI split. 'current' uses the current window for the output.
@@ -347,6 +352,28 @@ require('opencode').setup({
347
352
})
348
353
```
349
354
355
+
### Model Sorting and Favorites
356
+
357
+
The provider/model picker supports intelligent sorting based on your favorites and usage history:
358
+
359
+
#### Sorting Priority
360
+
361
+
When you open the model picker (`<leader>op`), models are sorted in the following order:
362
+
363
+
1.**Favorite models** - shown with a ⭐ icon and sorted by the order they were favorited
364
+
2.**Recently accessed models** - sorted by most recent usage
365
+
3.**Other models** - sorted alphabetically
366
+
367
+
#### Managing Favorites
368
+
369
+
In the model picker, press **`<C-f>`** to toggle the currently selected model as a favorite. Favorite models will:
370
+
371
+
- Display with a ⭐ star icon prefix
372
+
- Always appear at the top of the list
373
+
- Persist across Neovim sessions
374
+
375
+
No configuration is needed - the plugin respects and updates the OpenCode CLI format automatically.
376
+
350
377
### UI icons (disable emojis or customize)
351
378
352
379
By default, opencode.nvim uses emojis for icons in the UI. If you prefer a plain, emoji-free interface, you can switch to the `text` preset or override icons individually.
@@ -443,6 +470,7 @@ You can configure a custom action in Snacks pickers to send selected files direc
443
470
```
444
471
445
472
This allows you to:
473
+
446
474
1. Open any Snacks file picker (`:Snacks picker files`, `:Snacks picker git_files`, etc.)
447
475
2. Select one or more files using multi-select
448
476
3. Press `<localleader>o` to send those files to opencode as context
0 commit comments