From 4cfa7baa28ac9da9179d9b65a936f387990a9715 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 6 Sep 2024 19:40:52 +0200 Subject: [PATCH] fix: set buffer name when attaching --- lua/codemp/buffers.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/codemp/buffers.lua b/lua/codemp/buffers.lua index 0a2dd1c..fcb56c9 100644 --- a/lua/codemp/buffers.lua +++ b/lua/codemp/buffers.lua @@ -19,12 +19,11 @@ local function attach(name, buffer, content, nowait) error("already attached to buffer " .. name) end if buffer == nil then - buffer = vim.api.nvim_create_buf(true, true) - vim.api.nvim_set_option_value('fileformat', 'unix', { buf = buffer }) - -- vim.api.nvim_buf_set_option(buffer, 'filetype', 'codemp') -- TODO get from codemp? - vim.api.nvim_buf_set_name(buffer, name) + buffer = vim.api.nvim_create_buf(true, false) vim.api.nvim_set_current_buf(buffer) 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() if not nowait then controller:poll():await() -- wait for current state to get synched