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
Copy file name to clipboardExpand all lines: README.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -252,6 +252,12 @@ require('opencode').setup({
252
252
enabled=false, -- Enable debug messages in the output window
253
253
},
254
254
prompt_guard=nil, -- Optional function that returns boolean to control when prompts can be sent (see Prompt Guard section)
255
+
256
+
-- User Hooks for custom behavior at certain events
257
+
hooks= {
258
+
on_file_edited=nil, -- Called after a file is edited by opencode.
259
+
on_session_loaded=nil, -- Called after a session is loaded.
260
+
},
255
261
})
256
262
```
257
263
@@ -585,6 +591,28 @@ The plugin defines several highlight groups that can be customized to match your
585
591
586
592
The `prompt_guard` configuration option allows you to control when prompts can be sent to Opencode. This is useful for preventing accidental or unauthorized AI interactions in certain contexts.
587
593
594
+
## 🪝Custom user hooks
595
+
596
+
You can define custom functions to be called at specific events in Opencode:
597
+
598
+
-`on_file_edited`: Called after a file is edited by Opencode.
599
+
-`on_session_loaded`: Called after a session is loaded.
0 commit comments