Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lua/model/core/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ M.mode = {
BUFFER = 'buffer', -- create a new buffer and insert
INSERT = 'insert', -- insert at the cursor position
INSERT_OR_REPLACE = 'insert_or_replace', -- insert at the cursor position if no selection, or replace the selection
SPLIT = 'split', -- create a new buffer and open in a split
VSPLIT = 'vsplit', -- create a new buffer and open in a vsplit
}

---@class StreamHandlers
Expand Down Expand Up @@ -71,8 +73,16 @@ local function create_segment(source, segment_mode, hl_group)
else
return segment.create_segment_at(#source.lines, 0, hl_group, 0)
end
elseif segment_mode == M.mode.BUFFER then
vim.cmd.vnew()
elseif
segment_mode == M.mode.BUFFER
or segment_mode == M.mode.SPLIT
or segment_mode == M.mode.VSPLIT
then
if segment_mode == M.mode.SPLIT then
vim.cmd.new()
else
vim.cmd.vnew()
end

vim.api.nvim_set_option_value('buflisted', true, { scope = 'local' })
vim.api.nvim_set_option_value('buftype', 'nowrite', { scope = 'local' })
Expand Down
Loading