From 5ac6a13095255d2ebe3ebb99ad89f7b2addd8fa8 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Mon, 18 May 2026 21:53:27 +0200 Subject: fix(nvim): replace O(n²) loop concat with table.concat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- after/ftplugin/lua.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'after/ftplugin/lua.lua') diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua index 2ffd62c..756026e 100644 --- a/after/ftplugin/lua.lua +++ b/after/ftplugin/lua.lua @@ -1,9 +1,6 @@ local function format() local view = vim.fn.winsaveview() - local buf_str = "" - for _, v in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, false)) do - buf_str = buf_str .. v .. "\n" - end + local buf_str = table.concat(vim.api.nvim_buf_get_lines(0, 0, -1, false), "\n") .. "\n" local tempname = vim.fn.tempname() local tempfile = assert(io.open(tempname, "w"), "Could not open temporary file") tempfile:write(buf_str) -- cgit v1.3.1