mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-21 23:14:54 +01:00
feat: allow attaching/sharing overwriting
This commit is contained in:
parent
2176d32540
commit
46de8c5661
1 changed files with 5 additions and 3 deletions
|
@ -77,7 +77,7 @@ local joined_actions = {
|
|||
buffers.create(path)
|
||||
end,
|
||||
|
||||
share = function(path)
|
||||
share = function(path, bang)
|
||||
if path == nil then
|
||||
local cwd = vim.fn.getcwd()
|
||||
local full_path = vim.fn.expand("%:p")
|
||||
|
@ -85,7 +85,7 @@ local joined_actions = {
|
|||
end
|
||||
if #path > 0 then
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
buffers.create(path)
|
||||
if not bang then buffers.create(path) end
|
||||
local content = utils.buffer.get_content(buf)
|
||||
buffers.attach(path, buf, content)
|
||||
window.update() -- TODO would be nice to do automatically inside
|
||||
|
@ -109,7 +109,9 @@ local joined_actions = {
|
|||
|
||||
attach = function(path, bang)
|
||||
if path == nil then error("missing buffer name") end
|
||||
buffers.attach(path)
|
||||
local buffer = nil
|
||||
if bang then buffer = vim.api.nvim_get_current_buf() end
|
||||
buffers.attach(path, buffer)
|
||||
end,
|
||||
|
||||
detach = function(path)
|
||||
|
|
Loading…
Reference in a new issue