File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ function M.handle_submit()
6262 return
6363 end
6464
65- if input_content :match (' ^/' ) then
65+ local key = config .get_key_for_function (' input_window' , ' slash_commands' ) or ' /'
66+ if input_content :match (' ^' .. key ) then
6667 M ._execute_slash_command (input_content )
6768 return
6869 end
@@ -71,16 +72,21 @@ function M.handle_submit()
7172end
7273
7374M ._execute_slash_command = function (command )
74- local slash_commands = require (' opencode.config_file' ).get_user_commands ()
75+ local slash_commands = require (' opencode.api' ).get_slash_commands ()
76+ local key = config .get_key_for_function (' input_window' , ' slash_commands' ) or ' /'
77+
7578 local cmd = command :sub (2 ):match (' ^%s*(.-)%s*$' )
7679 if cmd == ' ' then
7780 return
7881 end
7982 local parts = vim .split (cmd , ' ' )
80- local command_cfg = slash_commands [parts [1 ]]
83+
84+ local command_cfg = vim .tbl_filter (function (c )
85+ return c .slash_cmd == key .. parts [1 ]
86+ end , slash_commands )[1 ]
8187
8288 if command_cfg then
83- require ( ' opencode.api ' ). run_user_command ( parts [ 1 ], vim .list_slice (parts , 2 ))
89+ command_cfg . fn ( vim .list_slice (parts , 2 ))
8490 else
8591 vim .notify (' Unknown command: ' .. cmd , vim .log .levels .WARN )
8692 end
You can’t perform that action at this time.
0 commit comments