diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-18 21:53:27 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-18 21:53:27 +0200 |
| commit | 5ac6a13095255d2ebe3ebb99ad89f7b2addd8fa8 (patch) | |
| tree | fdf2354bc8912c1432746a862014b3c39a0eb244 /after/ftplugin/lua.lua | |
| parent | aabdb89c0578a483c1bea29dbb5deaf3bfef85e0 (diff) | |
| download | nvim-config-5ac6a13095255d2ebe3ebb99ad89f7b2addd8fa8.tar.gz nvim-config-5ac6a13095255d2ebe3ebb99ad89f7b2addd8fa8.zip | |
fix(nvim): replace O(n²) loop concat with table.concat
Diffstat (limited to 'after/ftplugin/lua.lua')
| -rw-r--r-- | after/ftplugin/lua.lua | 5 |
1 files changed, 1 insertions, 4 deletions
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) |
