@@ -182,27 +182,36 @@ M._execute_slash_command = function(command)
182182 end
183183end
184184
185- function M .setup (windows )
185+ local function set_win_option (option , value , windows )
186+ windows = windows or state .windows
187+ vim .api .nvim_set_option_value (option , value , { win = windows .input_win , scope = ' local' })
188+ end
186189
190+ local function set_buf_option (option , value , windows )
191+ windows = windows or state .windows
192+ vim .api .nvim_set_option_value (option , value , { buf = windows .input_buf })
193+ end
194+
195+ function M .setup (windows )
187196 if config .ui .input .text .wrap then
188- vim . api . nvim_set_option_value (' wrap' , true , { win = windows . input_win } )
189- vim . api . nvim_set_option_value (' linebreak' , true , { win = windows . input_win } )
197+ set_win_option (' wrap' , true , windows )
198+ set_win_option (' linebreak' , true , windows )
190199 end
191200
192- vim . api . nvim_set_option_value (' filetype' , ' opencode' , { buf = windows . input_buf } )
193- vim . api . nvim_set_option_value (' winhighlight' , config .ui .window_highlight , { win = windows . input_win } )
194- vim . api . nvim_set_option_value (' signcolumn' , ' yes' , { win = windows . input_win } )
195- vim . api . nvim_set_option_value (' cursorline' , false , { win = windows . input_win } )
196- vim . api . nvim_set_option_value (' number' , false , { win = windows . input_win } )
197- vim . api . nvim_set_option_value (' relativenumber' , false , { win = windows . input_win } )
198- vim . api . nvim_set_option_value (' buftype' , ' nofile' , { buf = windows . input_buf } )
199- vim . api . nvim_set_option_value (' swapfile' , false , { buf = windows . input_buf } )
201+ set_buf_option (' filetype' , ' opencode' , windows )
202+ set_win_option (' winhighlight' , config .ui .window_highlight , windows )
203+ set_win_option (' signcolumn' , ' yes' , windows )
204+ set_win_option (' cursorline' , false , windows )
205+ set_win_option (' number' , false , windows )
206+ set_win_option (' relativenumber' , false , windows )
207+ set_buf_option (' buftype' , ' nofile' , windows )
208+ set_buf_option (' swapfile' , false , windows )
200209
201210 if config .ui .position ~= ' current' then
202- vim . api . nvim_set_option_value (' winfixbuf' , true , { win = windows . input_win } )
211+ set_win_option (' winfixbuf' , true , windows )
203212 end
204- vim . api . nvim_set_option_value (' winfixheight' , true , { win = windows . input_win } )
205- vim . api . nvim_set_option_value (' winfixwidth' , true , { win = windows . input_win } )
213+ set_win_option (' winfixheight' , true , windows )
214+ set_win_option (' winfixwidth' , true , windows )
206215
207216 M .update_dimensions (windows )
208217 M .refresh_placeholder (windows )
0 commit comments