mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 05:44:52 +01:00
fix: if not given, default to current buffer
This commit is contained in:
parent
07344401dc
commit
637a6ee11d
1 changed files with 6 additions and 1 deletions
|
@ -10,7 +10,7 @@ local user_buffer_name = {}
|
|||
local ticks = {}
|
||||
|
||||
---@param name string name of buffer to attach to
|
||||
---@param buffer integer buffer to use for attaching (will clear content)
|
||||
---@param buffer? integer buffer to use for attaching (will clear content)
|
||||
---@param content? string if provided, set this content after attaching
|
||||
---@param nowait? boolean skip waiting for initial content sync
|
||||
---@return BufferController
|
||||
|
@ -18,6 +18,11 @@ local function attach(name, buffer, content, nowait)
|
|||
if buffer_id_map[name] ~= nil then
|
||||
error("already attached to buffer " .. name)
|
||||
end
|
||||
|
||||
if buffer == nil then
|
||||
buffer = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_option_value('fileformat', 'unix', { buf = buffer })
|
||||
vim.api.nvim_buf_set_name(buffer, name)
|
||||
local controller = session.workspace:attach_buffer(name):await()
|
||||
|
|
Loading…
Reference in a new issue