From 792f0db6ba8b626b14bc127e1ce7247185b3be91 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Thu, 14 Nov 2024 19:18:21 -0800 Subject: [PATCH] perf: only sort entries after we have them all --- lua/oil/view.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/oil/view.lua b/lua/oil/view.lua index 8aa8ed7..cd39a52 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -614,7 +614,10 @@ local function render_buffer(bufnr, opts) local entries = cache.list_url(bufname) local entry_list = vim.tbl_values(entries) - table.sort(entry_list, get_sort_function(adapter, #entry_list)) + -- Only sort the entries once we have them all + if not vim.b[bufnr].oil_rendering then + table.sort(entry_list, get_sort_function(adapter, #entry_list)) + end local jump_idx if opts.jump_first then