Skip to content

Commit

Permalink
perf: processing open buffers only processes normal buffers
Browse files Browse the repository at this point in the history
Buffers are processed when renaming, deleting, and trashing files in
yazi. Previously all open buffers were processed, but now only normal
buffers are.

This actually doesn't have a big impact on performance. I just wanted to
have a `perf` commit in the history 😄. Perhaps in big projects it might
be noticeable, or if some future feature will require more performance.
  • Loading branch information
mikavilpas committed Jun 5, 2024
1 parent a4e85c9 commit 5acce15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/yazi/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ function M.get_open_buffers()
local open_buffers = {}
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
local path = vim.api.nvim_buf_get_name(bufnr)
if path ~= '' and path ~= nil then
local type = vim.api.nvim_get_option_value('buftype', { buf = bufnr })

local is_ordinary_file = path ~= '' and type == ''
if is_ordinary_file then
local renameable_buffer = RenameableBuffer.new(bufnr, path)
open_buffers[#open_buffers + 1] = renameable_buffer
end
Expand Down

0 comments on commit 5acce15

Please sign in to comment.