mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +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)
|
buffers.create(path)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
share = function(path)
|
share = function(path, bang)
|
||||||
if path == nil then
|
if path == nil then
|
||||||
local cwd = vim.fn.getcwd()
|
local cwd = vim.fn.getcwd()
|
||||||
local full_path = vim.fn.expand("%:p")
|
local full_path = vim.fn.expand("%:p")
|
||||||
|
@ -85,7 +85,7 @@ local joined_actions = {
|
||||||
end
|
end
|
||||||
if #path > 0 then
|
if #path > 0 then
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
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)
|
local content = utils.buffer.get_content(buf)
|
||||||
buffers.attach(path, buf, content)
|
buffers.attach(path, buf, content)
|
||||||
window.update() -- TODO would be nice to do automatically inside
|
window.update() -- TODO would be nice to do automatically inside
|
||||||
|
@ -109,7 +109,9 @@ local joined_actions = {
|
||||||
|
|
||||||
attach = function(path, bang)
|
attach = function(path, bang)
|
||||||
if path == nil then error("missing buffer name") end
|
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,
|
end,
|
||||||
|
|
||||||
detach = function(path)
|
detach = function(path)
|
||||||
|
|
Loading…
Reference in a new issue